Hi, >>Try including the vertex and fragment shaders you are using then >>others might have a chance of spotting what is up.
My apologies for the lack of source code. The Normal Vertex Map Shader: varying vec3 lightVec; varying vec3 eyeVec; varying vec2 texCoord; attribute vec3 tangent; void main(void) { gl_Position = ftransform(); texCoord = gl_MultiTexCoord0.xy; vec3 n = normalize(gl_NormalMatrix * gl_Normal); vec3 t = normalize(gl_NormalMatrix * tangent); 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); } The Normal Fragment Map Shader: varying vec3 lightVec; varying vec3 eyeVec; varying vec2 texCoord; uniform sampler2D diffuseMap; uniform sampler2D normalMap; uniform float lightFallOff; void main (void) { float distSqr = dot(lightVec, lightVec); float att = clamp(1.0 - lightFallOff * sqrt(distSqr), 0.0, 1.0); vec3 lVec = lightVec * inversesqrt(distSqr); vec3 vVec = normalize(eyeVec); vec4 base = texture2D(diffuseMap, texCoord.xy); vec3 bump = normalize( texture2D(normalMap, texCoord.xy).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; vec3 color = vec3(( vAmbient*base + vDiffuse*base + vSpecular) * att); gl_FragColor = vec4(color,gl_FrontMaterial.ambient.a); ////gl_FragColor = mix(base, colour, gl_FrontMaterial.ambient.a); ////gl_FragColor = vec4(1,0,0,1); } -----Original Message----- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert Osfield Sent: Friday, 12 June 2009 6:10 PM To: OpenSceneGraph Users Subject: Re: [osg-users] OSGSpotLight example on a GLSL material Hi Bino, I can't see how many of us will be able divine what is up with your shaders as we have absolutely no knowledge of what you've put into your shader. You question is equivalent to "I have a piece of string you can't see, but can you tell me exactly how long it is". Try including the vertex and fragment shaders you are using then others might have a chance of spotting what is up. Robert. On Fri, Jun 12, 2009 at 6:28 AM, Albino Rodrigues<b...@vrspace.com.au> wrote: > Hi, > > > > I have been using the OSGSpotLight example as a starting base to simulate a > flashlight with success. > > > > The scene I was using has now been updated to be drawn with a GLSL NormalMap > shader (included as part of the .ive). The spotlight can no longer be seen. > It does however appear to affect the general lighting of the area it's in, > but the spotlight and the texture image that goes with it can no longer be > seen. > > > > Any ideas on how to get around this would be much appreciated. > > > > Cheers, > > Bino > > > > > > > > _______________________________________________ > 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 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org