PDA

View Full Version : Bump mapping



User137
26-09-2010, 03:34 PM
I've been trying since yesterday to get bump mapping to work with OpenGL but it just refuses. This is main source:
http://www.paulsprojects.net/tutorials/simplebump/simplebump.html
Containing C++ source project which i couldn't compile but its executable runs well with my gfx card.

I was able to make code that generates a bump map texture from any texture. This simply compares luminosity of neighbouring pixels and then forms a normal vector, saving it in rgb. This works and looks the same as any other normal maps i've seen. So i applied it to a donut model of mine and tried to render it.

The bumps are not showing at all. I read the C++ source more to find what to comment out to reduce the problem area smaller; so i figured it is rendered in 2 passes. First the normalMap combined with cubeMap through a ARB calculation and after that the object is multiplied on top. I commented the last part and tried to see only the result of normalMap * cubeMap. In C++ example it looked black and white bumpy texture, but in my program it showed plain normalMap in true colors like ignoring the cubeMap completely. Why is that i have no clue anymore... Am i generating the cubeMap wrong? It's checked over and over again etc.

Code posted here if you can notice anything: http://pastebin.com/jWPUh0py
Screeny of the donut as what the code does: http://tinypic.com/r/6yk30n/7

edit: About tangentSpaceLight[] array i'm almost sure it's not right. However i don't think it would have that big effect on the rendering outcome even if it was wrong. Would it?