Bumpmap Colors?

Does any one know what the references of bumpmaps are? What colors represent a certain height on a bumpmap?

Unity's a bit weird about its naming convention. What it calls a bump map is actually a normal map.

In a normal map, the XYZ surface normals are mapped to the RGB colour space. A usual mapping would be.

  • r = x
  • g = y
  • b = z

(the only bit that directly answers the question so I bolded it)

"Real" bump maps are greyscale heightmaps so if you've got an 8bit bump map then your values go from 0 to 255 where 0 is the "deepest" value and 255 is the "highest" value.

The effect isn't that different and from what I can tell normal mapping gives more control over what you get in the end.

This should get you started on bump mapping in Unity. But if you want some really fancy 'bump mapping' you should check out Parallax mapping (manual table of contents for shaders, do a find for parallax and you'll find all the different versions); it's more expensive to pull off but man oh man is it pretty (not as good as tessellation but that's dx11 stuff and I'm pretty sure Unity doesn't support it).

How parallax works is by combining a heightmap (like bumpmapping) and an RGB normal map into one texture. It looks self occluding and reacts nicely with lighting, unfortunately the silhouette doesn't change.

Hope that bit of info overkill helps.

This is an interesting question, so I'm going to chip in with a bit of detail on exactly the difference between the terms, and exactly why you see the colours you do in normal maps.

Unity uses "Normal Maps" which are a type of Bump Map (the other common type of Bump Map is a Heightmap). Bump Map is a slightly ambiguous term which covers both of these more specific meanings.

Normal maps typically have a light blueish tinge, and use the RGB channels to contain the data, whereas heightmaps are black and white, and can either use the RGB channels of equal value to contain the data, or they can be an actual greyscale image.

The difference between these two methods of Bump Mapping are that the values for the pixels represent different things.

  • each pixel in a Heightmap defines the height of the surface at that point
  • each pixel in a Normal Map defines the angle of the surface at that point

The way the surface angle is defined in a normal map is by assigning the X,Y & Z direction of the surface normal to the R,G & B channels of the texture. A 'normal' is a vector which points in a particular direction.

Normal maps generally allow for normals which can actually point in any direction (down as well as up, relative to the actual surface of the mesh), however the XYZ values for vectors indicating a direction conventionally range from -1 to 1. Because you can't have a value of -1 in a colour, the normals are encoded by halving their value, and then adding half. This brings the range to 0 to 1, instead of -1 to 1, which is suitable for encoding as a colour.

This means that a normal which is pointing straight up relative to the mesh surface would have a value of R:0.5, G:0.5, B:1 (or 8888FF) which explains the general light-blueish tinge of most normal maps - because most surfaces on a typical normal map are generally pointing somewhere near the "up" direction.

Unity works with Normal Maps instead of Height Maps because the angle data contained in them is much more suited to fast processing and rendering by the graphics card. Essentially the data just tells the graphics shaders to modify the regular angle of lighting on the surface by the angle described in each normal map pixel.

If the shaders had to work with heightmaps, they would have to perform extra computations to work out the angle of the surface based on the looking at the heights of the surrounding pixels rather than just a single pixel.

Unity can automatically convert a black and white heightmap to a normal map for you. To enable this feature, just put a heightmap image into your assets folder, then click on it in Unity's project pane, and check the "Generate Bumpmap" setting in the texture's inspector settings.

Hope you found all this interesting!

see bump maps in wikipedia you can create them easily in unity by placing a tick in texture's import settings. to create a bump map in photoshop or other graphics (pixel art) program just create a grayscale image. 0 means dep and white means flat. so colors in between are vaerage. see this in unity's manual