Jump to content
  • Advertisement
Sign in to follow this  
Khaos Dragon

stupid bump mapping questions

This topic is 5085 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have just got started on bump mapping and the following is my first result: All I did was make a normalmap from that heightmap and scale the original heightmap by the dot product of the lightvector and normalmap vectors. So although I seem to understand how to bump map greyscale images, I am wondering how people do it for color images. Obviousuly when I try to scale the dot product with the color image of the map instead of the greyscale heightmap, it just looks wierd. I suppose specifically I am wondering the following: when bump mapping a color image, is it standard to create a greyscale bump map first and then somehow blend the bump map into the color image?

Share this post


Link to post
Share on other sites
Advertisement
The bumpmapping results in lighting of that surface, see it as a lightmap, to color/texture it simply multiply the result with the color at that specific location.

EDIT: the lighting you got in your image is greyscale probably because your light is white, it can be any combination of colors.

EDIT2: my bad, i thought you meant a greyscale heightmap and a colored texture, but i suppose you meant a color image as heightmap and texture, if so use a luminance alogrithm, see the NeHe bumpmapping example (i think they used a luminance alogrithm). It's nothing more than scaling r,g and b by some value (g is generally brighter than b so g is scaled by a smaller value than b) but you can also just divide the sum by 3 (which might give you bad results depending on how accurate you want it to be).

[Edited by - Tree Penguin on August 17, 2004 11:22:59 AM]

Share this post


Link to post
Share on other sites
Ok, so bumpmaps are typically greyscale images that are lightmapped onto a color version of the picture. I guess I was confused since I always thought the bump map was the final version of the picture.

Is the following a common way of bump mapping a color image:

1) convert color image to greyscale
2) generate normal map
3) take dot product between light vector and normal map to form bump map (this bump map naturally will be greyscale )
4) lightmap bump map onto color image

Share this post


Link to post
Share on other sites
Yes. However i am not that fond of converting color images to greyscale heightmaps and then to bumpmaps as darkness doesn't always mean low and brightness doesn't always mean high, but that's just me. Converting a color image to a bumpmap just makes it look 'bumped' or 'wrinkled' which is good enough in most cases.

Share this post


Link to post
Share on other sites
But how do you convert a color image to a bump map without having a greyscale heightmap to work with in the first place? Is this the luminance algorithm you had referred to, and is this generally better than the 4 step procedure I outlined in my previous post (that is if you just want to add some substance and bumpy texture and not have bumps be dependent on pure brightness)?

Share this post


Link to post
Share on other sites
No, it's the first step of the 4 you outlined in your previous post (converting the color image to greyscale). With that greyscale heightmap you generate a normal map just like you did before, and the following steps are the same too.

The luminance alogrithm (sounds a bit complicated but it's the simplst thing in the world) will be something like this:

r*=0.35;
g*=0.2;
b*=0.45;
greyscale=r+g+b;

The values aren't right, just look them up in the emboss bumpmapping NeHe tutorial or somewhere on the net.

EDIT: Ok, it wasn't a NeHe tutorial but an ATI tut i think, i am not sure but i guess you'll find the right values somewhere :).

Share this post


Link to post
Share on other sites
I'm sorry to drag this thread on even more, but I am having trouble with step 4. No matter how I try to blend my bump map and color map together it looks terrible, as though I applied a random filter in photoshop to it.

All I am doing is for each pixel is:

finalcolor.r = bumpmap.r * colormap.r;
finalcolor.g = bumpmap.g * colormap.g;
finalcolor.b = bumpmap.b * colormap.b;

Share this post


Link to post
Share on other sites
yes I have prepared the following:



The following is the dot product of the light vector and the normal map plus an ambience value of 0.5f.



So in other words, Image2, and the bump map image produce the ugly looking Image4.

[Edited by - Khaos Dragon on August 17, 2004 1:36:45 PM]

Share this post


Link to post
Share on other sites
I just wanted to clear up the terminology confusion, but Sephiroth beat me to it (OK, he deleted his post after I posted): A bumpmap is generally used as a synonym of the heightmap. The result of the DOT3 operation doesn't really have a special name, it's just a light or shadow intensity value. You could call it a lightmap, I guess.

So the steps are as follows:

1) Aquire a heightmap (= bumpmap) from whatever means. This bumpmap is greyscale.

2) Transform the heightmap to a normalmap. You can now throw the heightmap away (unless you want to do parallax mapping, in this case keep the heightmap in the alpha channel of the normalmap)

3) Create the DOT3 'lightmap': c = normalmap DOT lightvector

4) optionally add an ambient term: c += ambient_term

5) Multiply the result of the DOT3 (including the optional ambient term) with the diffuse colour texture: c(final) = c * diffuse_texture

That's basically it.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!