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&) - not supported"
By searching the Internet I found at http://http://docs.gl/gl3/glTexGen
If the texture generation function is GL_EYE_LINEAR, the function
is used, where
and xe, ye, ze, and we are the eye coordinates of the vertex, p1, p2, p3, and p4 are the values supplied in params
, and M is the modelview matrix when glTexGen is invoked. If M is 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 -
Post generated by Mail2Forum