Definitions
A normal map is a texture that defines which way light bounces off a surface, on a per-pixel basis. Normal maps encode the direction of light reflections using RGB colors.
A bump map is a texture that defines the height of bumps on a surface, on a per-pixel basis. Bump maps encode the height as a gray-scale image.
X-Plane does not use bump maps; it only uses normal maps. See the Creating Normal Maps section below for information on creating normal maps from bump maps.
A Specular Level Map (or shininess map) is a texture that defines which parts of a surface are shiny, on a per-pixel basis. (Specular maps are similar to ATTR_shiny_rat in their effect.) . Specular levels are a non-PBR X-Plane 10 concept.
A Gloss Map defines which parts of a texture are smooth, and replace specular level maps in X-Plane 11.
A “UV” map is the mapping of texture coordinates onto your model–that is, it is the shape of how your textures are applied to the mesh. X-Plane supports only one UV map per OBJ – that UV map is used for all textures: the day time (albedo), night LIT (emissive) and normal map textures.
Format
X-Plane 10 uses combined normal and specular level maps in a single texture. The RGB of the texture are used for the normal map, and the alpha channel is used for the specular level.
X-Plane’s normal maps are “tangent space” normal maps. That means that a “flat” (blue) normal map leaves the original surface unperturbed.
Creating Normal Maps
NormalMappr
NormalMappr is a free program for OS X that converts bump-maps to tangent-space normal maps. You open a PNG file, adjust a few parameters, and then save the results. You can apply it to a custom-drawn bump map (drawn in gray-scale using PhotoShop) or simply apply it to your RGB textures.
http://shamyl.zakariya.net/apps/NormalMappr.zip
Converting Normal Maps From FS X Aircraft
FSX and X-Plane do not use the same normal map format. There are three key differences:
- In FS X, the red, green and blue channels have been moved around a bit to reduce texture compression artifacts.
- In X-Plane, normal maps should be uncompressed, in PNG files, not compressed in DDS files.
- In X-Plane, the alpha channel can optionally be used as a specular map.
This tutorial explains how FSX normal maps are created. To use the normal map in X-Plane, you need the original light blue normal map from before the changes (“saving in FSX format” are made).
Generally since X-Plane normal maps are uncompressed, you will get higher image quality by going back to the original materials, rather than trying to re-convert the DXT-compressed normal map.
Using Normal Maps
Normal maps may be used in objects. To use a normal map in an object you must include a line
TEXTURE_NORMAL <filename>
Normal maps must be PNGs (not DDS). The normal map does not have to be the same size as the day or lit textures, but it does have to be a power of 2. It should be a 24-bit RGB + 8-bit alpha texture.
In order for the specular level map to work, you must use ATTR_shiny_rat. X-Plane multiplies the shiny_rat and specular level from the normal map, so it is best to use ATTR_shiny_rat 1.0 when using normal maps.
Normal maps can be used in the draped texture of an object or in other art assets as follows:
TEXTURE_NORMAL <ratio> <filename>
Where ratio scales the normal map relative to the UV map of the parent art asset. The intent of this is to allow for high frequency repeating normal maps that add texture at a rate different from a low frequency albedo.
Warnings and Problems
A few special precautions when making normal maps:
Normals Must Be The Correct Length
In a normal map, the RGB colors represent a “vector” – that is, a direction that light bounces off a surface. The vector must be of length 1. In practical terms, this means that the colors must balance in a certain ratio.
If the colors in the RGB channel do not balance to create a “normalized” vector, X-Plane’s lighting will not function correctly. Therefore it is important that you not modify the RGB channel with a paint program; instead use a program designed to create normal maps.
RGB Behind 0% Alpha
When using a normal map, you may have areas with 0% shininess. This is represented by 0% alpha. Some graphic programs (including some versions of GIMP and PhotoShop) will replace the RGB color behind a 0% alpha (transparent) area with white.
From the above comment, the normal vector must be normalized – since white is not a legal normal map value, these white areas will have strange lighting errors.
Be sure to use a program that can apply an alpha channel without destroying the RGB colors, like Graphics Converter.
Normal Maps Must Not Be Flipped
Normal maps have a “front” and a “back”. The front must face the viewer. If your UV map flips the normal map horizontally or vertically (flipping both is fine, since this is like a 180 degree rotation) then the normal map will not work correctly.
Basically, if you could put writing into your main texture and the writing would not look mirrored, then your UV map (the way your texture is applied to your object) is fine for normal mapping. If the text looks mirrored, the normal map will be reversed.
(Note: it can be very hard to detect incorrect lighting with a mirrored normal map; I suggest using a temporary texture with writing to confirm that your UV map is okay.)
Compatibility
- Normal mapping is available in X-Plane 940 and later.
- Normal mapping requires a graphics card with programmable pixel shaders – that is, a DX9 or later compatible card.
- Normal mapping is only visible if the user enables per-pixel lighting.
- Normal maps may be ignored at the lowest graphics settings for performance.
Technical
X-Plane uses tangent space normal maps with a specular level in the alpha channel:
r = dx, -1,1 mapped 0.255 g = dy, -1,1 mapped 0.255 b = dz, 0,1 mapped 0.255 applied where dz = N, dx = dS, dy = dT
Further Reference
http://wiki.blender.org/index.php/Doc:Manual/Textures/Maps/Bump_and_Normal_Maps