Advertisement Jump to content
Sign in to follow this  

OpenGL [solved] Annoying problem with a simple cube bumpmapping

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


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:

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:

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
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, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!