hi,

i could fix the problem with eye-space transformation. i multiply the tex gen 
matrix by camera's inverse modelview matrix in every frame, now the shadows 
work also for transformed nodes. to be honest, i don't know why this 
multiplication is needed!? it seems that in older nvidia drivers the built-in 
eye linear planes were already multiplied with that inverse matrix before they 
were passed to the vertex shader.

cheers
boto

boto wrote:
###########
hi,

unfortunately, it seems that the nvidia driver has another bug, the built-in 
uniform gl_ModelViewMatrix it is. see the code below: the vertex position is 
transformed to eye-space by multiplying gl_Vertex with gl_ModelViewMatrix. 
however that results in wrong shadows, actually no shadows on VRC island -- i 
have replaced the eye planes by the matrix 'texgenMatrix' which i pass through 
the _MVPT uniform (for the code see the link in my last posting). if i do not 
transform the vertices via gl_ModelViewMatrix then only meshes with no 
transformation get proper shadows, i.e. the player and other meshes which do 
not origin at 0,0,0 get wrong or no shadows :-(

what the hell happened to nvidia? i wonder how it could happen that the ogl 
support got broken so radically!?

further help to work-around the new bug would be great.

cheers
boto

    "/* \n"
    "* Vertex shader for shadow mapping \n"
    "* http://yag2002.sf.net \n"
    "* 06/27/2006 \n"
    "*/ \n"
    "uniform mat4 texgenMatrix; \n"
    "varying vec4 diffuse, ambient; \n"
    "varying vec3 normal, lightDir, halfVector; \n"
    "varying vec2 baseTexCoords; \n"
    "const int shadowTexChannel = 1; \n"
    " \n"
    "void main() \n"
    "{ \n"
    " normal = normalize( gl_NormalMatrix * gl_Normal ); \n"
    " lightDir = normalize( vec3( gl_LightSource[ 0 ].position ) ); \n"
    " halfVector = normalize( gl_LightSource[ 0 ].halfVector.xyz ); \n"
    " diffuse = gl_FrontMaterial.diffuse * gl_LightSource[ 0 ].diffuse; \n"
    " ambient = gl_FrontMaterial.ambient * gl_LightSource[ 0 ].ambient; \n"
    " ambient += gl_LightModel.ambient * gl_FrontMaterial.ambient; \n"
    " \n"
    " vec4 pos = gl_ModelViewMatrix * gl_Vertex; \n"
    " gl_TexCoord[ shadowTexChannel ] = texgenMatrix * pos; \n"
    " gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; \n"
    " baseTexCoords = gl_MultiTexCoord0.st; \n"
    "} \n" 
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to