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 osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org