Skip to main content
gamedev.net
🔒 Locked

Bump Mapping, how does one implement?

Started by RandomAxess 2 replies 300+ views
Original Post
RandomAxess
RandomAxess
I''ve search google and learnt about the idea in my graphics class. In general, I can read in a black and white image, with each color cooresponding to a different change-in-normal. AKA, white is greatest change, black is least change. Given this, at render time we look up the proper value in this texture, add that to the normal for rendering purposes. I''m familiar with texture shading and know how to implement it, and it seems like this is something similar. I''m more confused about how to actually specifiy the amount of change based on the colors in the image. Do i specifiy a constant amount of change, and based on the color, multiply that perterbation amount?
Ostsol
Ostsol
The "bump-map texture" does not hold height values, but normal vectors. It is not a greyscale texture at all, but can be created from a greyscale heightmap.

Bumpmapping is performed in the same way as standard Phong shading is, using the exact same basic lighting equation. The difference is that instead of deriving per-pixel normal vectors as the interpolation between vertex normals, one gets the per-pixel normals from a texture: the normal-map.

One complication is that the light-vector must be transformed into tangent space. To do this one not only needs the face''s normal vector, but also its tangent and binormal vectors.

Here''s one tutorial:

http://www.paulsprojects.net/tutorials/simplebump/simplebump.html

There''s also an old bit of sample code that ATI released years ago:

http://www.ati.com/developer/sdk/RADEONSDK/Html/Samples/OpenGL/RADEONSimpleDOT3.html
-Ostsol
RandomAxess
RandomAxess
I''m not quite sure what this "rotate into texture space" is. It seems like if I use the provided equations on "paul''s projects" site, namely:
r = (x+1)/2;
g = (y+1)/2;
b = (z+1)/2;

and solve them for x,y, and z, I should have them in coordinate space?
Ostsol
Ostsol
quote:
Original post by RandomAxess
I''m not quite sure what this "rotate into texture space" is. It seems like if I use the provided equations on "paul''s projects" site, namely:
r = (x+1)/2;
g = (y+1)/2;
b = (z+1)/2;

and solve them for x,y, and z, I should have them in coordinate space?

That equation deals with the fact that a 24 bit RGB texture cannot have negative values. All values must be clamped from 0.0 to 1.0. What that equation does is make the normalized vector entirely positive. 0.5 represents zero; 0.0 represents -1.0; 1.0 represents 1.0.
-Ostsol

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.