dot3 Bump mapping GLSL issue

Started by
3 comments, last by dnaxx 18 years, 3 months ago
Hello! I do bump mapping with OpenGL/GLSL. When I run my vertex/fragment shader in "Shaderdesigner" (http://www.typhoonlabs.com/index.php?action=developer.htm), the result is ok (so the shaders seem to be ok): . But when I use them in my application, I get this result: . Changing the normals or the light position does not influence the result in my application. Can someone give a hint, where the problem might be? Thank you,
Advertisement
Hi dnaxx,

You best bet is to change the pixel shader slightly to output the normal as a colour, to make sure they are getting through OK.

When working with shaders, it's always worth using colours to show results of shader calculations.

Hope that helps.
it is indeed a problem with the normals or the light position.
Here is another view from Shaderdesigner:
. As you can see, one side looks ok, and the other side (the darker one) looks like the one in my application.
Shader designer has some strange caveats. Specifically, the lighting is setup is a strange manner in shader designer. I've found that running the full screen preview in shader designer on my machine ususally renders an accurate representation of the pixel/vertex shaders. As far as your screenshots, it would appear as if the diffuse property isnt correctly being rendered. This might be due to the diffuse color of the light, or could be due to the light's position. You might accidentally be using a directional light, or your attenuation may be incorrect. I would suggest hard coding any variables that you're taking from shader designer's light setup. For instance, if your using gl_LightSource[whatever].position/etc, change that to specifically state a position. Doing the same for every property should give you an accurate representation of what the pixel and vertex shader will look like in program. The same goes for shader designer's uniform variables. Also, there's a big difference between a teapot/cube, and a flat surface. Are you correctly generating the normals/tangents/etc. for the flat surface?
These are the tangent, binormal and normal values of the plane:
Quote:
t: 1.00, 0.00, 0.00
b: 0.00, 0.00, 1.00
n: 0.00, 1.00, 0.00
.

And exactly that also seems to be the problem. When I change the planes position (so that the tbn are also changed) then the mapping works.

This topic is closed to new replies.

Advertisement