Sign in to follow this  
Kest

Bump and Invironment Mapping

Recommended Posts

I'm totally new to bump mapping, and I'm getting a bit confused trying to get something working. Does bump mapping require an invironment map? Why so? Should I be using a sphere invironment map or a cube map? Does it matter if the polys belong to a wall or dynamic item or terrain? I know what invironment mapping does alone, but what does it do with bump maps? I can't seem to understand why they are needed to impliment bump mapping. I'm also a bit confused about the luminance attribute. Is the addition of luminance simply a better quality? Or an entirely different effect? There doesn't seem to be any sample programs using bump mapping, other than advanced pixel shader apps that only work in ref mode - basically they won't run with my card. I really appreciate any knowledge thrown my way.

Share this post


Link to post
Share on other sites
hi there Kest, How are you doing buddy?

The Problem
What is Environment/ Bump mapping

The Solution

Environment Mapping
"Environment mapping is a technique that simulates highly reflective surfaces without using ray tracing. In practice, environment mapping applies a special texture map that contains an image of the scene surrounding an object to the object itself."

Bump Mapping
"Bump mapping is a special form of specular or diffuse environment mapping that simulates the reflections of finely tessellated objects without requiring extremely high polygon counts. Bump mapping implemented by Microsoft Direct3D can be accurately described as per-pixel texture coordinate perturbation of specular or diffuse environment maps, because you provide information about the contour of the bump map in terms of delta values, which the system applies to the u and v texture coordinates of an environment map in the next texture stage."

So basically it follows the following transformations and texture stage states.
Base Texture (Stage 0) -> Bump Map (Stage 1) -> Environment Map (Stage 2) -> Polygon


For further reading refer to
Bump Mapping in Direct3D

I hope this helps a bit buddy.
Take care.

Share this post


Link to post
Share on other sites
Environment mapping is different from bump mapping, but they can be used together.

With bump mapping, you get the normal of a fragment from the bump map. The normal is used to determine the diffuse and specular lighting values. Without bump mapping, you interpolate the vertex normals to get the fragment's normal.

With environment mapping, you use the normal of a fragment to determine which texel in the environment map is reflected by that fragment. Without bump mapping, you interpolate the vertex normals to get the fragment's normal. With bump mapping, you get the normal from the bump map.

I'm not sure why they say, "Bump mapping is a special form of specular or diffuse environment mapping". That seems inaccurate to me since a bump map describes the surface being rendered and has nothing to do with the surrounding environment.

Share this post


Link to post
Share on other sites
Bump maps perturb the visible normal of an object using a texture map. This can effect itself in shading differences for regular light sources, and if the object is also environment mapped, it can effect itself in the appropriate changes in reflection of the environment map.

There is nothing that requires that a bump mapped object also use an environment map. However, there are some ways of implementing bump mapped lighting that uses environment maps to approximate the light characteristics. The kind and size of environment map you're using there will determine the quality of the approximation.

Important: if you're reading tutorials on "du/dv" bump maps, or "EMBM" bump mapping, then those are old hacks from previous graphics generations. They basically ended up with a dead end. Instead, when you think "bump mapping" you should think of them in terms of true normal maps, which can be interpreted in either tangent space, object space, or derived from a displacement-style heightfield "bump" map.

Share this post


Link to post
Share on other sites
Quote:
Original post by hplus0603
There is nothing that requires that a bump mapped object also use an environment map.

Quote:

D3DTOP_BUMPENVMAP
Perform per-pixel bump mapping, using the environment map in the next texture stage, without luminance. This operation is supported only for color operations (D3DTSS_COLOROP).

D3DTOP_BUMPENVMAPLUMINANCE
Perform per-pixel bump mapping, using the environment map in the next texture stage, with luminance. This operation is supported only for color operations (D3DTSS_COLOROP).

It looks to me like it requires it. These are the only two bump texture operations that I can find.

Quote:
Important: if you're reading tutorials on "du/dv" bump maps, or "EMBM" bump mapping, then those are old hacks from previous graphics generations. They basically ended up with a dead end. Instead, when you think "bump mapping" you should think of them in terms of true normal maps, which can be interpreted in either tangent space, object space, or derived from a displacement-style heightfield "bump" map.

Like I said before, my video card is not exactly state of the art. It's difficult to program something that cannot be tested. I'm wanting legacy bump mapping for now.

Quote:
Original post by JohnBolton
I'm not sure why they say, "Bump mapping is a special form of specular or diffuse environment mapping". That seems inaccurate to me since a bump map describes the surface being rendered and has nothing to do with the surrounding environment.

It appears to be an invironment mapping only situation in DirectX. I always thought that invironment maps made things look shiny. What if you just want a rough look and don't want it shiny? Shininess just won't cut it for my game world. It will be a very rustic setting. Old wood, concrete, rusted metal.

I appreciate the help so far, but I could really use some more.

Share this post


Link to post
Share on other sites
Quote:
Original post by Kest
It appears to be an invironment mapping only situation in DirectX. I always thought that invironment maps made things look shiny. What if you just want a rough look and don't want it shiny? Shininess just won't cut it for my game world. It will be a very rustic setting. Old wood, concrete, rusted metal.

Environment maps are generally used for reflections in shiny surfaces. To make a rough or bumpy surface you use a bump map.

Share this post


Link to post
Share on other sites
i think EMBM bumpmapping just pertubates the Environment map and doesn't add shadows to the surface like usual diffuse bumpmapping does. So i think you can't use this kins of bumpmapping for reflective surfaces. But i'm not sure about this so anybody correct me if i'm wrong.

regards,
m4gnus

Share this post


Link to post
Share on other sites
Kest,

There is nothing that requires you to use a bump map and an environment map together - it just happens that those two operations you found do so, and they are quite old now, from a time of hacks, where people did typically just want perturbed reflections. Read again what hplus0603 was saying about them being old hacks, and how things have evolved into using normal maps instead - then using bump mapping without an environment mapping is quite simple, you just need a normal map and to use the D3DTOP_DOTPRODUCT3 operation to do a per-pixel dot product between the normal in the texture and a light vector (which you can pass in through a colour register). This performs the N.L calculation per-texel, giving you a nice bump mapped effect.

Here is something I did about 2/3 years ago which uses bump mapping extensively - the floor, wall and object are made up of just a couple of polygons, and all use normal maps to achieve the detail. As you can see, there is no environment map on any of them.

-Mezz

Share this post


Link to post
Share on other sites
Quote:
Original post by Mezz
.. you just need a normal map and to use the D3DTOP_DOTPRODUCT3 operation to do a per-pixel dot product between the normal in the texture and a light vector (which you can pass in through a colour register).

You didn't see my other post? :)

I made the mistake of thinking the DirectX docs would have mentioned it. Look up bump mapping. All you'll get is information about environment map bump mapping. In fact, the Dot product 3 texture operation description doesn't even mention bump maps or normal maps.

Quote:
Here is something I did about 2/3 years ago which uses bump mapping extensively - the floor, wall and object are made up of just a couple of polygons, and all use normal maps to achieve the detail. As you can see, there is no environment map on any of them.

Very nice :)
Is that a morgue? [wink]

Share this post


Link to post
Share on other sites
I did see your other post, and you continued to talk about bump environment mapping. I know the DX docs don't mention normal mapping particularly well (I think they did at some point in the past, when per-pixel lighting was a new-fangled thing). That is why I explained the D3DTOP_DOTPRODUCT3 operation and it's usage. I'm not sure what it is you want.

-Mezz

Share this post


Link to post
Share on other sites
Quote:
Original post by Mezz
I did see your other post, and you continued to talk about bump environment mapping.

Maybe you were having a bad dream? :) I don't mention environment mapping at all. I'm actually now trying to find a method to use vertex shaders with the tangent space normal maps. The only way I can imagine doing it would be to stash an entire matrix transform in every vertex. Doesn't seem like a very reasonable thing to do. I'm thinking maybe two floats instead, to define the texture's oriented rotations on the vertex. Or maybe I'll just say the heck with it and work in object space. I'm still trying to figure out if a matrix per vertex is better than not mirroring textures onto both sides of some models.

Share this post


Link to post
Share on other sites
Quote:
Original post by Kest
Maybe you were having a bad dream? :) I don't mention environment mapping at all.


I was at work (bad), but it was no dream.

Quote:
Original post by Kest
It appears to be an invironment mapping only situation in DirectX. I always thought that invironment maps made things look shiny. What if you just want a rough look and don't want it shiny? Shininess just won't cut it for my game world. It will be a very rustic setting. Old wood, concrete, rusted metal.


Anyway.

Doing tangent space normal mapping requires the tangent basis per vertex ( matrix transform), however this isn't too bad, since it's made up of the tangent, bitangent and normal, you will typically already have the normal, and if you really want to, you only need one of the other vectors as you can generate the third from within a vertex shader if you want.

-Mezz

Share this post


Link to post
Share on other sites
Quote:
Original post by Mezz
Quote:
Original post by Kest
Maybe you were having a bad dream? :) I don't mention environment mapping at all.


I was at work (bad), but it was no dream.

Quote:
Original post by Kest
It appears to be an invironment mapping only situation in DirectX. I always thought that invironment maps made things look shiny. What if you just want a rough look and don't want it shiny? Shininess just won't cut it for my game world. It will be a very rustic setting. Old wood, concrete, rusted metal.


Anyway.

Errm, for what it's worth, I was referring to another post; not my reply in this thread. Bad wording on my part. I wouldn't have asked if you had seen it if it was on the same page. The thread titled "Ambience with normal mapping". It's on the second forum page now, though.

Quote:
Doing tangent space normal mapping requires the tangent basis per vertex ( matrix transform), however this isn't too bad, since it's made up of the tangent, bitangent and normal, you will typically already have the normal, and if you really want to, you only need one of the other vectors as you can generate the third from within a vertex shader if you want.

I hadn't thought of that. But considering you wouldn't want to infuse the vertices with useless information, you'll want to modify the mesh data to add the tangent or bitangent only if normal mapping is enabled. So you don't even need the original normal if normal mapping is enabled. You just need to know the orientation of the texture on the vertex. I believe it could be calculated with two floats. So vertices become one float smaller per vertex with normal mapping.

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