Hi. Do you mean this: vec4 p_worldspace4 = texture2DRect(posMap, gl_FragCoord.xy); vec4 shadowTexCoord = shadowViewProjection * p_worldspace4; float depth = texture2D(shadowMap, shadowTexCoord.x/2 + 0.5, shadowTexCoord.y/2 + 0.5).z; float visibility = 1.0; if (p_worldspace.z < depth) visibility = 0.5;
This doesn't produce any shadow at all. Thanks. 2013/10/12 Marcel Pursche <marcel.purs...@student.hpi.uni-potsdam.de> > Hi, > > In your current implementation you store your fragment positions in world > space and use them for lighting in the final fragment shader. > If you pass a matrix uniform to this pass, that translates from world > space to screen space of the light pass, you can calculate your shadow > texcoords. > So you only need to calculate: "vec4 shadowTexCoord = > shadowViewProjectionMatrix * p_worldposition;" in your final fragment > shader. You can use this to fetch from your depth texture and compare the > depths. > > Thank you! > > Cheers, > Marcel > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=56761#56761 > > > > > > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org