Normal map
Builderbob (Talk | contribs) m (→Baking Normal Maps Using Max) |
Builderbob (Talk | contribs) (Normal maps in ground textures.) |
||
Line 66: | Line 66: | ||
Note: The ModifyMap token, with a setting of flipgreen, can be used in the texture file to flip the green (Y) channel for a normal map. | Note: The ModifyMap token, with a setting of flipgreen, can be used in the texture file to flip the green (Y) channel for a normal map. | ||
+ | |||
+ | ==Creating a Normal Map for a Ground Texture== | ||
+ | |||
+ | A normal map used for a 3D model is created in a 3D editing program such as Blender or 3D Studio Max using the 3D information in the mesh. This is known as Baking. Ground textures do not use a 3D mesh, so if you want to use a normal map with a ground text you need to create it for yourself. This can be done using software that interprets the 3D information in a texture image using colors or brightness, or it can be done using a drawing program where you actually edit the images that make up the normal map. | ||
+ | |||
+ | NVidia provides a plugin for Photoshop the can create a normal map from an image: | ||
+ | [https://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVidia Texture Tools for Adobe Photoshop] | ||
+ | |||
+ | GIMP has a similar plugin available: | ||
+ | [http://registry.gimp.org/node/69 normalmap] | ||
+ | |||
+ | Paint.Net has several plugins. There is one that creates the map from an image: | ||
+ | [http://forums.getpaint.net/index.php?/topic/24587-normal-map-renderer/ Paint.Net Normal Map Renderer plugin] | ||
+ | |||
+ | and another that allows you to edit the bump map, the specularity, the reflectivity and the reversal as separate images: | ||
+ | [http://forums.getpaint.net/index.php?showtopic=23936 Paint.Net The Normal Tools plugin] | ||
+ | |||
+ | Other graphics editing programs may have similar features, either built-in or available as a plugin. | ||
[[Category:Normal mapping]] | [[Category:Normal mapping]] |
Revision as of 16:15, 29 July 2013
The normal map is an additional texture file used simulaneously with the diffuse map to allow per-pixel lighting control. An overview of the normal mapping technique can be found on Wikipedia here.
The color channels (red, green, blue) of the normal map determine the X, Y, and Z value for the pixel normal in tangent space. This information is not considered human-editable, and you should not attempt to manipulate these channels directly. Specifically, do not adjust the dimensions or contrast of an existing normal map. If you need to adjust the size of a normal map, you will need to rebuild the normal map using the original tools. If you need to adjust the bump height in a normal map, you will need to adjust the source geometry and rebuild the normal map using the original tools.
Editing the normal map in photoshop or similar will cause undefined behavior in-game. Additionally, any form of lossy compression (such as .JPG format) will destroy a significant amount of the information contained in a normal map. Do not use lossy formats for storing normal maps even as an intermediate step.
The alpha channel of the normal map is typically used to provide per-pixel control of the specular highlight. White gives a strong specular, suitable for metals and water. Black gives no specular, more suitable for dark earth. Grays are a mid-strength specular. It is safe to edit the alpha channel in a tool such as photoshop, provided that the color channels are not modified in any way.
If no alpha channel is specified, the normal map will default to a full white alpha channel. Since a white alpha channel indicates a strong specular, which will look strongly metallic or plastic on most textures, it is not usually suitable to provide a normal map with no alpha channel. For this reason, it is recommended that the .TGA file format is used for alpha channels.
Contents |
How a Normal Map works
Normal maps work by modifying the normal of the pixel. Typically a normal will stick straight up from the surface; a normal map will rotate that normal on either the Y or X axis.
In the following example we look strictly at the red channel; which controls the X axis of the normal. The arrows represent the normals. In example A there would be no normal map applied so all the normals would point straight away from the surface. In example B a normal map would be applied, modifying the normals in the appropriate areas.
There are a couple important things to note about this example. Let’s take a look at the red channel of the above example. On a given axis a normal can be rotated 90 degrees in either direction. The grayscale values in the normal map represent which way the normal is rotated. In our example a value of 0 would rotate the normal -90 degrees, for a value of 128 the normal would be rotated 0 degrees, and for a value of 255, the normal would be rotated +90 degrees. The green channel works in the same way.
Examples
A typical normal map will look similar to the following image.
Note that this image is for illustration purposes only - jpg format is not appropriate for normal maps.
Displaying Normal maps in 3D Studio Max
Displaying normal maps in 3D Studio Max
The appropriate way to display a normal map in 3D Studio Max is to use a “Normal Bump” map in the bump slot of the material. If you load a map directly into this slot it will display/render, but is viewing the map as a bump map and will not display correctly.
To display Trainz normal maps from within max we need to flip the Green channel to display the map correctly. This can be done within the material editor without having to actually modify the map.
In the properties for the Normal Bump under Channel Direction you need to check “Flip Green(Y)”. Lastly, load your normal map into the “Normal:” Slot.
There’s one last step to displaying your normal maps within Max. There is a different way of previewing the normal map depending on which version of max you are using.
3D Studio Max 9 and below:
In the material editor for the material you want to display under the DirectX Manager rollout make sure to check “DX Display of Standard Material” In the upper right hand of the material editor there is a blue checkered box which will turn pink, indicating that you are using DX display of the material. Click that button to show the maps in the viewport.
3D Studio Max 2008 and Above:
Click and hold on the blue and white checked box in the material editor. A popup will open with two options, a blue and white checked box and a pink and white checked box. Select the pink and white checked box to display the material as a DirectX shader in the viewport.
Getting Started with Normal Mapping
Refer to this page for notes on setting up an asset to illustrate these techniques.
Baking Normal Maps Using Max
Baking Normal Maps in 3D Studio Max
Note that normal maps produced by Max typically have a reversed green (Y) channel. At the current time, this must be fixed after export by manually opening the resultant normal map in photoshop, selecting only the Green channel, and using the Invert (ctrl-I) tool. Failure to correct the green channel results in incorrect lighting effects within the game environment, destroying the effectiveness of the normal map.
Note: The ModifyMap token, with a setting of flipgreen, can be used in the texture file to flip the green (Y) channel for a normal map.
Creating a Normal Map for a Ground Texture
A normal map used for a 3D model is created in a 3D editing program such as Blender or 3D Studio Max using the 3D information in the mesh. This is known as Baking. Ground textures do not use a 3D mesh, so if you want to use a normal map with a ground text you need to create it for yourself. This can be done using software that interprets the 3D information in a texture image using colors or brightness, or it can be done using a drawing program where you actually edit the images that make up the normal map.
NVidia provides a plugin for Photoshop the can create a normal map from an image: NVidia Texture Tools for Adobe Photoshop
GIMP has a similar plugin available: normalmap
Paint.Net has several plugins. There is one that creates the map from an image: Paint.Net Normal Map Renderer plugin
and another that allows you to edit the bump map, the specularity, the reflectivity and the reversal as separate images: Paint.Net The Normal Tools plugin
Other graphics editing programs may have similar features, either built-in or available as a plugin.