Hi.
I finally came up with the projected shadow map (not shadows yet):
http://youtu.be/geTIxhqT4x4
This is my final pass fragment shader: http://goo.gl/LNtYNh
It's simply the projected shadow map for each fragment.
Although, when I output shadowTexCoord.z:
  gl_FragColor = vec4(shadowTexCoord.z / 2 + 0.5, 0, 0, 1);
the whole scene is black:
https://dl.dropboxusercontent.com/u/12634473/img/20131013_osg_missing_depth.png

What's wrong?
Thanks.


2013/10/13 Marcel Pursche <[email protected]>

> Hi,
>
> this line seems to be wrong:
>
> Code:
>
> float depth = texture2D(shadowMap, shadowTexCoord.x/2 + 0.5,
> shadowTexCoord.y/2 + 0.5).z;
>
>
>
> it should be
>
> Code:
>
> float depth = texture2D(shadowMap, vec2(shadowTexCoord.x/2 + 0.5,
> shadowTexCoord.y/2 + 0.5)).x;
>
>
>
>
> Additionally you compare the depth from the texture, with the z component
> in world space. The z component is not the depth. You need the distance
> from your view plane of the light pass. Depending on what you save in your
> texture you can either directly use the z component of your shadowTexCoord
> or you have to transform this value.
> In my example the distance as it is was used, but normally you get a depth
> normalized to [0,1]. This can be either linear or logarithmic. So you need
> to adapt the value accordingly.
>
> Thank you!
>
> Cheers,
> Marcel
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=56766#56766
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to