Jump to content
  • Advertisement
Sign in to follow this  
dnaxx

OpenGL dot3 Bump mapping GLSL issue

This topic is 4671 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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,

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!