I had a question about the information stored in a .TGA bumpmap.
What does each of the components represent RGBA?
From a per channel preview of the image, what I gathered was that R is the x component of the normal, G is the y component of the normal and B and A I couldn’t think of anything. Can someone correct me if I’m mistaken!!
Should the sqrt(RR+GG+B*B) of each pixel in the bump image be 1.0 necessarily so that all normals are of unit length?
Can someone point me to a website where I can find more info. on this topic?
Usually the RGB components of a normalmap represent the x, y, and z components of a normal vector.
Since negative values cannot be explicitly stored in an RGB image or texture, the values in a normalmap are scaled and biased such that a value of 0.5 in a normal map represents 0, 0 on the normal map represents -1, and 1 on the normal map represents 1. As such, the RGB representation will not have a magnitude of 1.0. To undo this, one must subtract 0.5 from each componant of the normalmap and multiply the result by 2. The resulting vector should have a magnitude of 1.0.
Not sure about a website. . . I kinda learned this stuff all over the place. . .
You can use alpha in the bump map to encode material properties, such as shinyness. That means that you can easily make a bump map called “splotchy leather” or “rusty metal” and have it affect the light correctly.
If I have a OpenGL demo that uses dot3 bump mapping using register combiners and a cubemap,
what will happen if start using 32-bit textures, and encode the alpha channel the same way?
You can use 32bit textures in the combiners just fine with bumpmapping. The alpha won’t do anything to the rgb part unless you specificaly tell it to. The RGB and A are separated so if you do
rgb {
spare0 = expand( tex0 ) . expand( tex1 );
}
it wont even look at the alpha at all because you’re in the rgb portion. Of course you can always then do this
alpha {
spare0 = spare0.rgb * tex0.a;
}
if you wanted to incorporate the alpha into your prev calculation.
I hope my syntax is correct, I havn’t used register combiners in quite a while now.