From BlenderWiki

Jump to: navigation, search

Bump and Normal Maps

Mode: All Modes

Panel: Shading/Texture Context → Image

Hotkey: F6

Description

In CGI, bump maps can be applied to 3D models and thus serve to alter surface appearances. This can alter light interactions with scene objects.

  • While bump maps can simulate topology such as surface bumps and ripples, it does not change the 3D geometry.

Normal Maps and Bump Maps both serve the same purpose: they simulate the impression of a detailed 3D surface, by modifying the shading as if the surface had lots of small angles, rather than being completely flat. Because it's just modifying the shading of each pixel, this will not cast any shadows and will not obstruct other objects. If the camera angle is too flat to the surface, you will notice that the surface is not really shaped.

Both bump maps and normal maps work by modifying the normal angle (the direction pointing perpendicular from a face), which influences how a pixel is shaded. Although the terms normal map and bump map are often used synonymously, there are certain differences.

Bump maps
These are textures that store an intensity, the relative height of pixels from the viewpoint of the camera. The pixels seem to be moved by the required distance in the direction of the face normals. (The "bump" consists only of a displacement, which takes place along the existing, and unchanged, normal-vector of the face.) You may either use greyscale pictures or the intensity values of a RGB-Texture (including images).
Normal maps
These are images that store a direction, the direction of normals directly in the RGB values of an image. They are much more accurate, as rather than only simulating the pixel being away from the face along a line, they can simulate that pixel being moved at any direction, in an arbitrary way. The drawbacks to normal maps are that unlike bump maps, which can easily be painted by hand, normal maps usually have to be generated in some way, often from higher resolution geometry than the geometry you're applying the map to.
Normal maps in Blender store a normal as follows:
  • Red maps from (0-255) to X (-1.0 - 1.0)
  • Green maps from (0-255) to Y (-1.0 - 1.0)
  • Blue maps from (0-255) to Z (0.0 - 1.0)
Since normals all point towards a viewer, negative Z-values are not stored (they would be invisible anyway). In Blender we store a full blue range, although some other implementations also map blue colors (128-255) to (0.0 - 1.0). The latter convention is used in "Doom 3" for example.

Workflow

The steps involved in making and using Bump and Normal Maps is:

  1. Model a highly detailed ("hi-poly") model
  2. Bake the Bump and/or Normal maps
  3. Make a low-poly, less detailed model
  4. Map the map to the low-poly model using a common coordinate system

Consult the Modeling section for how to model a highly detailed model using the Mesh tools. How much detail you put in is totally up to you. The more ridges and details (knobs, creases, protrusions) you put in, the more detailed your map will be.

Baking a map, simply put, is to take the detail of a high polygon mesh, and apply it to a similar object. The similar object is identical to the high-poly mesh except with less vertices. Use the Render Bake feature in Blender to accomplish this.

Modeling a low-poly using Blender's Mesh editing tools. In general, the same or similar faces should exist that reflect the model. For example, a highly detailed ear may have 1000 faces in the high-poly model. In the low-poly model, this may be replaced with a single plane, oriented in the same direction as the detailed ear mesh. (Tip: Blender's multi-resolution mesh modeling feature can be used to good effect here.)

Mapping is the process of applying a texture to the low-poly mesh. Consult the Textures Map To section for more information on applying a texture to a mesh's material. Special considerations for Bump and Normal Maps is:

  • When using a Bump map, map the texture to Nor and enable No RGB.
  • When using a Normal map, map the texture to Nor

The coordinate systems of the two objects must match. For example, if you bake using a UV map of the high-poly model, you must UV map the low poly model and line up its UV coordinates to match the outline of the high-poly image (see UV unwrapping to line up with the high-poly map edges.

Examples

To set up the scene, position an orthographic camera about 10 units from a monkey. UV unwrap the Monkey; in this example we did an easy Project from View (Bounds). Scale the camera so that the monkey fills the frame. Set your format resolution to 512x512 (square textures render faster in game engines, usually). No lights or anything else is required.

Use Render Bake to create a Normal map.

Composite noodle to make Bump Maps

Then, enable Do Composite and set up the compositing noodle shown to the right. This is your Bump Map. You make a bump map by using that same orthographic camera in the composite noodle shown. The front of the model is 9.2 units from the camera, and the visible parts are 1.3 units deep (1/1.3=0.77). If you save your image as a JPG, you will have 24-bit depth. If you save it as a half OpenEXR image, 16-bit depth; as a full OpenEXR image, 32-bit depth. Alternatively, you can use the ZUtilz Plugin, however, it only gives you an 8-bit depth and the resolution of the Bump Map may be too small for the relatively great range of Z-Values. Tip: The "MultiLayer" file-format comes in handy here, since it is OpenEXR-based but additionally can store several "layers" of related information in just one file. The floating-point numeric precision of these formats is very beneficial with normal-maps.)

Now we are going to look at some examples. First the render of "Suzanne" (Suzanne Render). The second picture shows Suzanne's Normal Map (made with Blender's Normal Baking system. The rightmost picture in the top row shows the Bump Map of Suzanne.

Both maps here are used as textures on a plane, first the Normal Map (Render of the Normal Map), then the Bump Map (Render of the Bump Map). In both cases the camera stayed in the same position in which the Maps were made (perpendicular to the plane).

Suzanne Render
Normal Map of Suzanne
Bump Map of Suzanne
Side view render of the Normal Map applied to a plane
Side view render of a Normal Map made with an Ortho camera, applied to a plane. The same camera position as in the previous picture, less perspective distortion.
Render of the Normal Map applied to a plane, perpendicular to the surface.
Render of the Bump Map applied to a plane.

The Render of the Normal Map is only pseudo 3D. You can't look at the side of the head (Side view render).

If you use an Ortho camera to create the Normal Map, you will get less perspective distortion (Render with an Ortho camera).

Baking Options

The Render Bake panel

Render baking is hyperlinked here. In summary, there Blender supports normal map baking, amongst other bakeable things:

  • Tangent: Bakes a normal map that is independent of view, and is thus the best choice for animation.
  • Object: Bakes normals in the object's coordinates, and can be moved, but not deformed.
  • Camera: Bakes normals with the old method, meaning you cannot deform or move the object.
  • World: Bakes normals with coordinates, but object can't be moved or deformed.

Other options include:

  • Selected to active: This option will bake the selected mesh's normals

to the active mesh (e.g. the high poly mesh is the selected and is baked to the low-poly mesh which is the active).

  • Distance: A parameter that controls the max distance from one object to another.
  • Clear: Wipes the current image clear of any data.
  • Margin: The amount (in pixels) of which to extend the normal map.

Using And Creating Normal Maps

Normal Map Button in the Image Panel

Normal and Bump Maps are simple to use. Make sure you apply the Texture in the Material buttons Map To panel to Nor. The strength of the effect is controlled with the NumButton Nor on the same Panel.

If you want to use a Normal Map, you have to set the Normal Map button in the Image Panel in the Texture buttons F6 (Normal Map Button).

Since only the normals get affected during render, you will not get shadow or AO or other '3D' effects. It's still just a texture.

To bake normal maps is a different process, but simple.

1) Make a mesh.

2) Create a low polygon version of the object either by lowering the multires level (if you are using multires), by using a decimate modifier, or by just modeling the same mesh with less vertices. For simplicity, we'll say the low polygon object= mesh L and the high polygon object= mesh H.

3)To make this all work, mesh L needs to have a UV image. Assign seams and unwrap to a new image of the desired size (with UV test grid enabled).

You'll notice a new "32 bit float" option under the new image panel. This
The low-poly mesh unwrapped

option creates your image in 32 bits, which is useful when generating displacement maps. If saving the 32-bit image, it must be saved to a format supporting 32 bits, such as OpenEXR.


4)Before you bake the normal maps, both meshes must be in the exact same location, so mesh L must be moved back to mesh H's location with ALT + G.

5)If the "Selected to active" button is enabled (which it should), you will need to select first mesh H, and then mesh L.

6) Go to the "Scene" tab (F10) and then to the bake tab (next to "anim"). Select "Normals", and customize your options according to your needs. Then press the big shiny "Bake" button and watch your map appear in all it's glory.

The normal map after baking


7) Nope, you're not done yet. We still need to add the normal map as a texture. The next step is to go into the materials tab (F5) and apply a new texture. Select the type as "Image",

and select your normal map texture (hopefully you named it) with the arrows.
Image selected

8) Back in the main material panel under "Map Input", change the texture coordinates to UV. Under "Map To", check "Nor" and deselect "Col". Set the "Nor" value to 1 (Or a different value, depending on how strong you want it). You're done!