Doom3 bump map format

Started by
6 comments, last by Blue*Omega 18 years, 11 months ago
Hi all, I was wondering if anyone knew what the texture values for the "bump" map tesxtures of a doom3 model represent? is it the same as what is in the article here at gamedev, [link] http://www.gamedev.net/reference/articles/article1903.asp [/link]... (as refrred as the bump map) or is it something else? I have a quasi memory of reading that doom3 did somekind of alpha to color swapping to store a bump map (but then, what does it store exactly in the bump map, as .rgb--> 3 components already) or was this not about the texture stored, but only what was given to openGL for compression? (i.e. read the texture, swap some of the stuff to the alpha, then give the texture to openGL, if GL compress the texture, by putting stuff in the alpha, fewer artifacts) Best Regards [Edited by - kRogue on April 22, 2005 7:53:18 AM]
Close this Gamedev account, I have outgrown Gamedev.
Advertisement
Doom 3's "bump maps" are what most people reffer to as a "normal map" (the traditional grayscale map is a "height map")

The idea behind a normal map is really quite simple in theory. For each vertex in a 3D scene you have a normal that points away from the surface (perpendicular most of the time), and from that you are able to calculate how well let a surface is. Normal mapping is the exact same thing but on a per-pixel level.

Typically you will have an RGB image (Alpha can be used for special effects, but we won't worry about that) where each color component represents a component of your normal. So your Red value becomes the X normal component, Green becomes your Y component, and Blue your Z. (Which explains why most normal maps are a blueish tint. Surfaces usually point primarily "up", or along Z)

By replacing the surface normal with normals sampled from this map, you end up with lighting information that varies on a per-pixel level, and gives the appearance of much more detailed geometry than is actually present.

(Did that make ANY sense?)
// Tojiart
I think kRogue knew what they were [wink]

anyways, my shader has the move of a => r commented out, I think I had it running at one point but I couldnt tell the difference, but the doom3 shader code does have it in so you should probably do it [smile]
just to check, for the basis of the the vectors:

(texValue.rgb) <----> TangentVector1 * texValue.r + TangentVector2 * texValue.g +
+ NormalVector * texValue.b


where: TangentVector1 is a unit vector along the texture in the "u"-coordinate
TangentVector2 is a unit vector along the texture in the "v"-coordinate
NormalVector= TangentVector1 X TangentVector2 (vector cross product)


quick question for everyone: what is the typical way for choosing the tangent and normal vectors for a triangle on one's meshes? for normal vector's one typically "averages" the normal vectors of surrounding triangle, but the tangent vectors, I am thinking that is NOT the way to go, but one should have that the cross product of the 2 tangent vectors should be the normal... or when one does bump-mapping do you make the vectors entirely facted? (if so, I guess this is why normal mapping gets a "plastic" look often)

Best Regards
Close this Gamedev account, I have outgrown Gamedev.
Quote:Original post by kRogue
Hi all,

I was wondering if anyone knew what the texture values for the "bump" map tesxtures of a doom3 model represent? is it the same as what is in the article here at gamedev, [link] http://www.gamedev.net/reference/articles/article1903.asp [/link]... (as refrred as the bump map) or is it something else? I have a quasi memory of reading that doom3 did somekind of alpha to color swapping to store a bump map (but then, what does it store exactly in the bump map, as .rgb--> 3 components already) or was this not about the texture stored, but only what was given to openGL for compression? (i.e. read the texture, swap some of the stuff to the alpha, then give the texture to openGL, if GL compress the texture, by putting stuff in the alpha, fewer artifacts)

Best Regards



Just to inform you: On these forums, you need to write the link in HTML, which means that:
[link] http://www.gamedev.net/reference/articles/article1903.asp [/link]

Should be:
<a href="http://www.gamedev.net/reference/articles/article1903.asp">http://www.gamedev.net/reference/articles/article1903.asp</a>

Which outputs:
http://www.gamedev.net/reference/articles/article1903.asp
The AP was me, and the output should look like this:

http://www.gamedev.net/reference/articles/article1903.asp
Killers don't end up in jailThey end up on a high-score!
Quote:Original post by Blue*Omega
Doom 3's "bump maps" are what most people reffer to as a "normal map" (the traditional grayscale map is a "height map")

The idea behind a normal map is really quite simple in theory. For each vertex in a 3D scene you have a normal that points away from the surface (perpendicular most of the time), and from that you are able to calculate how well let a surface is. Normal mapping is the exact same thing but on a per-pixel level.

Typically you will have an RGB image (Alpha can be used for special effects, but we won't worry about that) where each color component represents a component of your normal. So your Red value becomes the X normal component, Green becomes your Y component, and Blue your Z. (Which explains why most normal maps are a blueish tint. Surfaces usually point primarily "up", or along Z)

By replacing the surface normal with normals sampled from this map, you end up with lighting information that varies on a per-pixel level, and gives the appearance of much more detailed geometry than is actually present.

(Did that make ANY sense?)
Wow you will get rated up for this, this has explained alot to me. One thing tho, the per-pixel lighting isnt related to the bump mapping is it? I understand now that a normal map is needed for per-pixel lighting, so I am guessing that the blue colour component (in this case) would be used for the bump mapping?

Actually, all of the components are used for bump mapping. This is simply a more exact way of doing it than your standard greyscale image (which I think is now reffered to as "emboss mapping").

The way I understand it (could be wrong) is that when using an old greyscale bump map the "bumpiness" is generated as such:

-For each pixel a sampling is taken of the pixels around it.
-Based on those samplings, a "slope" for the pixel is generated which essentially tells the program which direction the pixel is "faceing" (IE: a normal!)
-That normal is used to compute the per-pixel lighting

There are a couple of downsides to this method, though. Since it has to rely on the pixels around it for directional information, grayscale bumpmaps tend to look blurry close up, and can't have any nice sharp corners. Also, you have to provide a "depth" for the map in order to get the appropriate amount of bump.

Normal maps nicely sidestep these problems by encoding an exact direction (normal) into each pixel, which is independant of those around it. Both of these methods are collectively known as "bump mapping" but the term is more commonly attached to normal mapping in respect to modern hardware.

So, your forms of bump mapping are:
Greyscale - Emboss Map - Blurry and Old.
Color - Normal Map - Crisp and New!
// Tojiart

This topic is closed to new replies.

Advertisement