[osg-users] shadows in an GL 3.2 / glsl 1.5 environment

Werner Modenbach Werner.Modenbach at texion.eu
Wed Sep 2 01:41:08 PDT 2015


Dear all,

I need to do shadows in an GL 3.2 / glsl 1.5 environment.
I was using osgShadow with LightSpacePerspectiveShadowMapCB technique 
before moving to 3.2/1.5.
I tried to track down the necessary actions and I think I have to solve 
3 items:
1) Assigning new shaders to the technique (StandardShadowMap
2) Setting setUseModelViewAndProjectionUniforms(true) and 
setUseVertexAttributeAliasing(true) to the state
3) Find a workaround for TexGen
1) is easy
2) should be possible.
3) Makes me some headache.
osg::TexGen.apply simply says: "TexGen::apply(State&)-notsupported"
By searching the Internet I found at http://http://docs.gl/gl3/glTexGen
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

If the texture generation function is |GL_EYE_LINEAR|, the function

g=p1′′×xe+p2′′×ye+p3′′×ze+p4′′×we

is used, where

(p1′′p2′′p3′′p4′′)=(p1p2p3p4)M-1

and xe, ye, ze, and weare the eye coordinates of the vertex, p1, p2, p3, 
and p4are the values supplied in /|params|/, and Mis the modelview 
matrix when |glTexGen| is invoked. If Mis poorly conditioned or 
singular, texture coordinates generated by the resulting function may be 
inaccurate or undefined.

Note that the values in /|params|/ define a reference plane in eye 
coordinates. The modelview matrix that is applied to them may not be the 
same one in effect when the polygon vertices are transformed. This 
function establishes a field of texture coordinates that can produce 
dynamic contour lines on moving objects.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
That looks like if I have the light position of the shadow casting light 
and the planes somehow given in uniforms
I should be able to do the necessary texture coordinate calculation in 
the vertex shader.
I just don't have the necessary knowledge to do it.
My first question: Is it correct that the planes are constant and not 
depending on camera movements?
Second question: Is it correct that the above modelView matrix is the 
one from the camera when shadow are created (Light view)?

Does anybody has a link where I can dig further into that or is there 
even a "ready to use" example implementation?

Thanks for any hints.

- Werner -

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20150902/4bbf0f2e/attachment-0002.htm>


More information about the osg-users mailing list