Hello We've just noticed that we had issues with bump map and shadowing after upgrading from 3.1.1 to 3.2.0 and I was wondering if it was a known issue and if there were some ways to fix it. The issue is that the nodes that use both features (bump map AND shadowing) are not visible.
I'm not familiar with the techniques used to do these two features (this includes shaders, I'm clueless about this), and the person who implemented them in our software is no longer with us. I think the shadow is produced by using osgShadow/ViewDependentShadowMap, and a shader is used for bump mapping. (Originates from there: http://www.ozone3d.net/tutorials/bump_mapping_p4.php -- I'll add the code at the bottom of the email.) So, is this a known issue and is there a fix for it? Or any pointers on where I should start looking to fix it? (I'm aware that no one but us know our software is done so it's quite not feasible to really pinpoint where the issue is coming from.) If you need more information I'd be glad to come back to you with it. Thanks! [code] [Vertex_Shader] varying vec3 lightVec; varying vec3 eyeVec; varying vec2 texCoord; attribute vec3 vTangent; void main(void) { gl_Position = ftransform(); texCoord = gl_MultiTexCoord0.xy; vec3 n = normalize(gl_NormalMatrix * gl_Normal); vec3 t = normalize(gl_NormalMatrix * vTangent); vec3 b = cross(n, t); vec3 vVertex = vec3(gl_ModelViewMatrix * gl_Vertex); vec3 tmpVec = gl_LightSource[0].position.xyz - vVertex; lightVec.x = dot(tmpVec, t); lightVec.y = dot(tmpVec, b); lightVec.z = dot(tmpVec, n); tmpVec = -vVertex; eyeVec.x = dot(tmpVec, t); eyeVec.y = dot(tmpVec, b); eyeVec.z = dot(tmpVec, n); } [Pixel_Shader] varying vec3 lightVec; varying vec3 eyeVec; varying vec2 texCoord; uniform sampler2D colorMap; uniform sampler2D normalMap; uniform float invRadius; void main (void) { float distSqr = dot(lightVec, lightVec); float att = clamp(1.0 - invRadius * sqrt(distSqr), 0.0, 1.0); vec3 lVec = lightVec * inversesqrt(distSqr); vec3 vVec = normalize(eyeVec); vec4 base = texture2D(colorMap, texCoord); vec3 bump = normalize( texture2D(normalMap, texCoord).xyz * 2.0 - 1.0); vec4 vAmbient = gl_LightSource[0].ambient * gl_FrontMaterial.ambient; float diffuse = max( dot(lVec, bump), 0.0 ); vec4 vDiffuse = gl_LightSource[0].diffuse * gl_FrontMaterial.diffuse * diffuse; float specular = pow(clamp(dot(reflect(-lVec, bump), vVec), 0.0, 1.0), gl_FrontMaterial.shininess ); vec4 vSpecular = gl_LightSource[0].specular * gl_FrontMaterial.specular * specular; gl_FragColor = ( vAmbient*base + vDiffuse*base + vSpecular) * att; } [/code] -- Alexandre Vaillancourt
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

