How to Use Normal Maps in Second Life & OpenSim

WHAT IS A NORMAL MAP, WHAT DOES IT DO?

(This article applies to Normal Maps used in the Second Life® and OpenSim computer gaming systems.  It is likely that other gaming systems will behave in similar ways.)
Normal maps add more definition to the surface of a 3D object in your sim. They make the surface appear like it has more depth.  Essentially a normal map “fakes” a 3D appearance by creating an illusion of variations in the surface like ridges, and high or low spots.  It does this by adding somewhat intelligent shadowing to the surface that varies based on the viewing angle.  Most normal maps will not create a noticeable difference on surfaces that have full “light” shining directly on them, such as a patio surface outside at mid-day.  This is because there are no shadows cast on those surfaces due to the light angle.  Normal Maps will also not work on surfaces set to “full bright”.

REQUIRED VIEWER SETTINGS:

Normal map effects are ONLY VISIBLE if the Second Life or OpenSim viewer is set to higher graphics levels.  While it seems to vary somewhat, the following are guidelines for the necessary settings:
  1. Select “Me” or “Avatar” in the top menu.
  2. Select “Preferences”.
  3. Select “Graphics” settings.
  4. Make sure the following boxes listed under “Shaders” are checked:
    x  Bump mapping and shiny
    x  Basic Shaders
    x  Atmospheric Shaders
    x  Advanced Lighting Model
  5. Click on Apply and close Preferences Window.
Viewer Settings for Firestorm. Others viewers are similar.

MORE DETAILS, CONSIDERATIONS, TROUBLESHOOTING:

A normal map is basically a second texture added to the surface of your object.  The normal map has the same positioning and scale settings that a texture has, ie; scale, rotation, and offsets.  In most cases you will want to use the same positioning settings for the normal map that you use for the texture.
It appears to me that there are many different variables that can impact the appearance created by a normal map, among them the viewer brand and model, the viewer’s graphics settings, computer graphics card, the viewing angle, and rather this is Second Life, OpenSim, or some other version of virtual world.  Also you will notice that at straight edges of the object the normal map effect is not as pronounced and may disappear completely.  In other words straight edges are still straight edges, and at the time I am writing this, the software in these virtual worlds can’t make them appear anything other than straight when viewed from certain angles. Perhaps someday…
Be aware that not everyone will be able to see the normal maps effects!  Older computers just don’t have the graphics cards needed to support normal maps. So normal maps should be used to enhance the appearance of an object and the appearance should not be totally dependent on the normal map.  Make your object with the goal that it will look good without the normal map, but better with it!
The 3D appearance of an object with a normal map applied to the surfaces is very dependent on the sun angle.  If the sun angle is shining directly perpendicular to a surface you will not see any 3D effect.  For example; if you put a normal map on all the faces of a cube and then set the sun to mid-day, the normal map effect will not be visible on the top face, but will be visible on the sides.  If you free-rotate the cube (Edit>Rotate then click on the rotate ball and drag) in random directions you will see the 3D effect on the sides as the cube rotates.

How to Add Normal Maps to Your Objects:

How to install a normal map on your object (prim or mesh):
1. Install a texture on your prim or mesh as you normally would.  Edit your object, (1a) select the “Texture” tab, (1b & 1c) select your desired texture, and (1d) adjust the texture position settings until the texture looks good (Horizontal Scale, Vertical Scale, Repeats, Rotation, Horizontal Offset and Vertical Offset.)
Select Texture & Install
2. Once the texture his set to the parameters you desire, write down on a piece paper those parameters.
3. Now install switch to Bumpiness Settings.  (3a)Click the drop down menu that says “Texture (diffuse)” and (3b) select “Bumpiness (normal)”.  The bumpiness/normal map settings will appear in place of the texture settings.
Switch to Normal Map Mode
4. Make sure “use texture” is selected under “Bumpiness”.  (4b) Click in the box labeled “Texture.”  (4c)The “Pick: Texture” window will open just like it does when you select a texture, but this time select the Normal Map from your inventory and then click OK.  Use a normal map with the same pixel dimensions as your texture.  So for a 256x256px texture, use a 256x256px normal map.  Most normal maps appear to be a mottled purple-blue color when previewed, this color will be decoded to create the 3D effect.  It may also darken the appearance of the texture,  and will not change the color of your object.  Note however than most normal maps will make your object appear slightly darker due to the shadowing!
Select Normal Map
5. Last set the position settings for your normal map to be the same as those for the texture. (Horizontal Scale, Vertical Scale, Repeats, Rotation, Horizontal Offset and Vertical Offset.) As you do this you should notice a 3D effect appear on the surface of your object.  At the time this guide was written the strength of the 3D effect can’t be adjusted on the object without creating a new normal map.  I suspect this may change someday as support for normal maps becomes more robust.
Cube with Normal Map
 

HOW TO MAKE YOUR OWN NORMAL MAPS USING GIMP:

This is a quick guideline, it assumes you already know how to use Gimp and how to make a texture.  Excellent, detailed tutorials and videos on using Gimp and making textures may be found online.
1. Create a texture as you normally would.
2. Save your texture file under a new name to protect your previous work.
3. Flatten your image. Image > Flatten Image
4. Desaturate.  Colors > Desaturate…
Use “Lightness” option
5. Apply Normal Map Filter.  Filters > Map > Normalmap…
Experiment with Filter settings
Try Filter: 7×7 (This effects the size of the depth variations. Compare 3×3 and 9×9)
Try Minimum Z: 0.00000
Try Scale: 12  (This is how pronounced the depth effect will be. Higher makes darker shadows.)
Height source: Average RGB
Alpha channel: Unchanged
Conversion: None
DU/DV map: None
Contrast: 0.00
alpha map: (Empty)
Options:
Don’t check “wrap”
I check the “Invert X” box for most normal maps
I check the “Invert Y” box for most normal maps
Don’t check Swap RGB
6. You may want to lighten the purple normal map.  A darker purple map will cause your texture to look grayer.  From the main menu in Gimp use Colors > Brightness-Contrast.  I find that increasing both the Brightness and Contrast sliders by the same amount works nicely to lighten the map, while not losing the contrast needed to create a nice 3D effect.  It seems to work best for me if the lightest areas on the normal map remain a pale blue color.  If you lighten it all the way to where some of the map is white you will lose the 3D effect!
7. Export to png format. At this point I like to use Edit > Undo and go back to step 5 to create several different normal maps using different combinations of Filter settings (5×5 7×7 9×9) and scale settings in the NormalMap options.
8. Import the png to Second Life or OpenSim and test your texture and the various normal maps.  It can take a bit of testing to get the right effect…
In Second Life I use the Aditi test grid where uploads are free to work out the appearance first, then import it into the main grid.