#### Archived

This topic is now archived and is closed to further replies.

# Bump Map Creation

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

## Recommended Posts

How exactly do you create a bump map? I have used them and I know how they function but I don''t know how to generate them for I have used PhotoShop for it. What I want to do is to just get an rgb value for a nrmalized vector, and turn it into a color to be used in a DX application. All vectors would have a Z coordinate of at least 0. Does anyone know where a formula is?

##### Share on other sites
Ah, what you''re talking about is a NORMAL MAP (i.e. normals encoded as RGB values). Usually you create that from a height map by treating each pixel in a source height map texture as a vertex for a triangle. The x and y values for the vertices are simply the x and y positions and the z values are specified by the values in the height map. You then just use the same method of finding the normal as you would for any triangle (e.g. cross product), then encode the resultant value as a colour.

As for how to generate them:

1) There is a PhotoShop plugin available on the nVidia site IIRC which generates normal maps from height maps.

2) D3DX has a function to do it too: D3DXComputeNormalMap()

3) Finally you''ll find source code to do it in samples on the nVidia and other IHV websites. The OpenGL code is just as applicable to D3D as long as you''re consistent about which space the normals are in/which elements of the vector maps to R, G and B.

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

##### Share on other sites
I am not using height maps, it is for a totally different technique. All I really need is the relationship between RGB and XYZ which is what I have been looking for. Is it as simple as R = (X*0.5)+1 or is it more complexed?
Thanks...

##### Share on other sites
My first subject post was unclear. What I meant is that I have generated bump maps with software before but I do not know the formula for it which is what I need.

##### Share on other sites
So you already have a normalalised normal vector per pixel (e.g. you''re doing something like collapsing geometric detail into bump maps) ?. If so here''s a snippet of code:

nmap[i*width+j].r = (BYTE)(128 + 127*nx);
nmap[i*width+j].g = (BYTE)(128 + 127*ny);
nmap[i*width+j].b = (BYTE)(128 + 127*nz);

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

##### Share on other sites
What I am doing, incase you are interested, is making a light direction map which would be used together with a lightmap and a bump map to allow for a static bump mapped specularity effect. I know I can do that by taking a direction vector at each vertex for each light and normalizing it with a normal cube map, but I want something more customizeable and I think this technique would be faster, as only the vector between viewpoint and vertex would need calculation. Although it wouldn''t be strictly accurate with multiple lights, it should do a better job based on efficiency.

1. 1
2. 2
Rutin
24
3. 3
4. 4
JoeJ
16
5. 5

• 14
• 29
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631773
• Total Posts
3002265
×