PDA

View Full Version : Bumpmaps...



nishal
10-22-2003, 07:31 PM
I had a question about the information stored in a .TGA bumpmap.

1. 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!!

2. Should the sqrt(R*R+G*G+B*B) of each pixel in the bump image be 1.0 necessarily so that all normals are of unit length?

3. Can someone point me to a website where I can find more info. on this topic?

TIA,
Nishal.

Ostsol
10-23-2003, 03:29 AM
1. Usually the RGB components of a normalmap represent the x, y, and z components of a normal vector.

2. 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.

3. Not sure about a website. . . I kinda learned this stuff all over the place. . .

SeskaPeel
10-23-2003, 06:58 AM
Look on nvidia website for "robust bump mapping", you'll get absolutely everything explained in it.

SeskaPeel.

gator
10-23-2003, 11:49 AM
There is no alpha in a bump map. It wouldn't make sense anyway, since bump mapping is strictly bump mapping.

[This message has been edited by gator (edited 10-23-2003).]

jwatte
10-23-2003, 03:01 PM
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.

gator
10-23-2003, 04:41 PM
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?

SirKnight
10-23-2003, 05:41 PM
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.


-SirKnight

gator
10-24-2003, 01:01 PM
I probably should have said that 90% of time, you probably won't be using the alpha
channel for bump mapping, so I would just ignore it. http://www.opengl.org/discussion_boards/ubb/smile.gif

But if you can use it for transparency, then I see that as being useful.

SirKnight
10-24-2003, 04:49 PM
It's common to include a gloss map for your specular part in the alpha channel of one of your textures.

Remember that the alpha channel is not just for transparency.

-SirKnight

[This message has been edited by SirKnight (edited 10-24-2003).]