Sign in to follow this  
Khaos Dragon

stupid bump mapping questions

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
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
I must have made a mistake with multiplying the color map before since now it works...



My final result is the small one on the right. I suppose it looks somewhat bumpy, but it's kind of hard to notice. I guess I was expecting a bump mapped image to look quite amazing, but I guess it's only supposed to serve as a supplementary detail for textures.

One of my primary reasons for learning bump mapping is for water, and I am now afraid that it just can't produce a dramatic enough effect to give the appearance of waves.

Share this post


Link to post
Share on other sites
Well, couldn't you just scale the height of the bump map when creating the normal map? That's what I've done (though I used the normal map plugin for the Gimp.)
I'm not sure how good it would look for water, but I suppose that unless you're viewing the water from above, you'd want to simulate larger waves by actually moving vertices...

Share this post


Link to post
Share on other sites
Quote:
Original post by TomasH
Well, couldn't you just scale the height of the bump map when creating the normal map? That's what I've done (though I used the normal map plugin for the Gimp.)
I'm not sure how good it would look for water, but I suppose that unless you're viewing the water from above, you'd want to simulate larger waves by actually moving vertices...


Scaling it by a slight amount helped a little (although I get artifacts if I scale too much which is understandable).

However, I still have hope for normal mapping because I think bump maps which change dependent on the light and player's position may look pretty good, as opposed to my purely static one here.

And I have seen many people who have accomplished amazing looking water caustics using just an evolving bump map, I am wondering how they made such a tiny detail to give an effect as dramatic as waves.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this