Skip to main content
GameDev.net gamedev.net
🔒 Locked

Bump mapping help needed!

Started by MARS_999 May 31, 2003 at 8:42 PM 0 replies 300+ views
Original Post
MARS_999
MARS_999
I would like to do some bump mapping. I have a sphere rendered and a texture applied to it. I also have the gray scale for the bump mapped image. I don''t see any good straight forward tutorials on bump mapping? Does anyone have a good newbie site for bump mapping? Also with bump mapping you only have to apply the bump mapping to the polygons when you load up the textures right? Like you do when you apply textures to a polygon? If you are still confused by what I am asking I mean you don''t have to do anything special after you apply the bump mapped texture and you don''t do this in the rendering cycle but at load time?
Yann L
Yann L
It''s a little more involved than that, I''m afraid.

The basic steps you need to perform for typical bumpmapping, go as follows:

Preprocess:
1) Load your greyscale bumpmaps, and convert them to RGB normal maps using finite differencing.

2) Compute the tangent space transformation matrices at every vertex of your model. Store the tangent, and the normal per vertex.

3) Create a normalization cubemap.

Runtime:
1) Load your colour texture map on unit0, and your normal map on unit 1.

2) Load the normalization cubemap on unit2.

3) Enable a DOT3 combiner setup, where you basically perform a perpixel dotproduct between unit1 (the normalmap) and unit2 (the cubemap). Modulate the result of this operation with unit0 (the colour map). Optionally, add combiner logic for self-shadowing.

4) For each vertex you send to the card, compute the binormal by taking the crossproduct of the normal and tangent at that vertex. Form a 3x3 matrix from those 3 vectors. Transform the light vector at the vertex by this matrix.

5) Stream the result of the tangent matrix transform into the s,t,r coordinates of unit2 (the cubemap).

That''s the basic outline for robust diffuse bumpmapping. Various extensions exist, eg. replacing the cubemap with an analytic normalization, adding of a specular component (Blinn shading), combining step 4+5 in a vertex shader, etc.

You can find a couple of links to bumpmapping papers & tutorials here, look under "Light and shadows: bumpmapping". Also, googling for ''OpenGL DOT3 bumpmapping tutorial'' (or similar) will probably give a lot of resources.

Topic Locked

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

Sign in to reply to this topic.