Jump to content
  • Advertisement
Sign in to follow this  
tomek22

OpenGL [solved] Annoying problem with a simple cube bumpmapping

This topic is 2919 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

Hi!

I'm new to GLSL and for my first shader, i decided to try bumpmapping. I followed several examples and tried a whole bunch of stuff, I even wrote my own shader from scratch the way i thought was right. I have about 4-5 versions of the same shader with different complexities and all of them have the same annoying problem. Only one of the cube surfaces maps correctly! I thought i mapped my tangents wrong in opengl or something, but i drew them all on the cube and they seem fine. I'm losing my mind, please can somebody help? :(

The latest shader i tried was this one: http://lumina.sourceforge.net/Tutorials/Bumpmapping.html

I wanted to keep things simple, and all i changed was the texture names and it gives me the same problem! Here's the screenshots: http://img233.imageshack.us/img233/8409/screenshotzo.png

the red line on the surface is the tangent, and green the normal

I found a pattern in the behavior but i can't make sense of it. The planes with normals 0 0 1 and 0 0 -1 are mapped inversed, so one looks fine and the other has holes where the bumps should be. The other planes, i don't know what the hell is going on there. In this example the side ones aren't even mapped and the top and bottom are, but don't seem quite right. This leads me to the conclusion that something is wrong with the transformation to tangent space, but i can't find the problem! I tried every single combination i could think of and none of them worked

I have no previous experience in debugging shaders, and this is killing me. :(

Can someone please give me some advice? Thanks!

[Edited by - tomek22 on October 19, 2010 5:48:24 PM]

Share this post


Link to post
Share on other sites
Advertisement
Never mind! I found the problem!

The problem was that when passing the Tangent vector to the shader, I accidentally searched for a uniform variable called tangent when in fact, tangent is an attribute!

I can sleep peacefully now :)

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!