This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
gamedev:textureproperties:normal [2012/12/03 23:27] – dragonlord | gamedev:textureproperties:normal [2019/05/09 08:32] – created dragonlord | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | {{tag> | ||
<WRAP youarehere> | <WRAP youarehere> | ||
[[: | [[: | ||
</ | </ | ||
- | <WRAP boxheader> | + | ====== |
- | ====== | + | |
- | </ | + | Defines the surface normal in tangent space. |
- | <WRAP boxcontent> | + | |
- | |Texture Property Name|normal| | + | |
- | |Description|Defines the surface normal in tangent space| | + | |
|Excepted Data Source|3 component image| | |Excepted Data Source|3 component image| | ||
|Data Range|0 to 1 for all image components| | |Data Range|0 to 1 for all image components| | ||
Line 14: | Line 13: | ||
|Affected Modules|Graphic, | |Affected Modules|Graphic, | ||
|Linked Properties|[[gamedev: | |Linked Properties|[[gamedev: | ||
- | </ | ||
====== Description ====== | ====== Description ====== | ||
+ | |||
The **normal** texture property is used to add high resolution light rendering to objects that can not be represented with a low resolution game model. Normal based lighting is a standard in game development since a long time. The basic idea is to use textures to store high resolution surface normals not found on a low resolution model. Such normal map textures are no ordinary color textures. They store normal vectors packed into an 8-bit color. Such a normal map can be produced with various tools but typically two main ways exist. | The **normal** texture property is used to add high resolution light rendering to objects that can not be represented with a low resolution game model. Normal based lighting is a standard in game development since a long time. The basic idea is to use textures to store high resolution surface normals not found on a low resolution model. Such normal map textures are no ordinary color textures. They store normal vectors packed into an 8-bit color. Such a normal map can be produced with various tools but typically two main ways exist. | ||
Line 26: | Line 25: | ||
===== History ===== | ===== History ===== | ||
+ | |||
Normal based lighting is a standard in game development and cinema since a long time. A game without normal mapping tends to look flat because objects lack the dynamic change of light and shadows as we know it from the real world. To deal with this problem some tricks had been created along the years. | Normal based lighting is a standard in game development and cinema since a long time. A game without normal mapping tends to look flat because objects lack the dynamic change of light and shadows as we know it from the real world. To deal with this problem some tricks had been created along the years. | ||
Line 35: | Line 35: | ||
===== Normal Maps from Images ===== | ===== Normal Maps from Images ===== | ||
+ | |||
The quick and often dirty way is to use a normal map plugin for GIMP or other paint applications. These plugins take a color or grayscale image and convert it to a normal map. There exist different operators that can be used to calculate the resulting normal map. They vary in crispness, strength and broadness of pixels covered (in the sense of how much details of neighbors flows into the result). Results obtained with a normal map plugin can vary drastically. There exist tricks to improve the results for example using Photo Normal Reconstruction or using applications specialized in generating normal maps from images. This technique is well suited for Detail Normal Maps hence bumpy surface details of small scale and depth like scratches, leather patterns or embossed text. It is also often used to create normal maps from real world images. For the later though using Photo Normal Reconstruction is recommended but the results vary. For Geometry Normals as required for complex organic models this technique is not well suited at all. Here the second way to create normals maps is better used. | The quick and often dirty way is to use a normal map plugin for GIMP or other paint applications. These plugins take a color or grayscale image and convert it to a normal map. There exist different operators that can be used to calculate the resulting normal map. They vary in crispness, strength and broadness of pixels covered (in the sense of how much details of neighbors flows into the result). Results obtained with a normal map plugin can vary drastically. There exist tricks to improve the results for example using Photo Normal Reconstruction or using applications specialized in generating normal maps from images. This technique is well suited for Detail Normal Maps hence bumpy surface details of small scale and depth like scratches, leather patterns or embossed text. It is also often used to create normal maps from real world images. For the later though using Photo Normal Reconstruction is recommended but the results vary. For Geometry Normals as required for complex organic models this technique is not well suited at all. Here the second way to create normals maps is better used. | ||
===== Normal Maps from High Resolution Model ===== | ===== Normal Maps from High Resolution Model ===== | ||
+ | |||
The second way uses a normal map generation too and a set of models. With this technique a high resolution model is used as the source of normal information and mapped onto the texture of a low resolution model. This process is called " | The second way uses a normal map generation too and a set of models. With this technique a high resolution model is used as the source of normal information and mapped onto the texture of a low resolution model. This process is called " | ||
Line 43: | Line 45: | ||
===== Tangent Space Problem ===== | ===== Tangent Space Problem ===== | ||
+ | |||
A main problem is the splitting of normals and especially tangents along the low resolution model. The normals have to be transformed relative to a coordinate system located at the point of interest on the low resolution model. This coordinate system is typically called the " | A main problem is the splitting of normals and especially tangents along the low resolution model. The normals have to be transformed relative to a coordinate system located at the point of interest on the low resolution model. This coordinate system is typically called the " | ||
===== Normal Map Encoding ===== | ===== Normal Map Encoding ===== | ||
+ | |||
Another problem is the encoding of normal maps. The components of normals are in the range from -1 to 1 while those of colors are in the range from 0 to 1. The most common solution is to map all normal components directory from -1..1 to 0..1 using one color component for each normal component. For the choice of mapping between the components as well as flipping or not flipping the result there are tons of different ways normals can be mapped. The Drag[en]gine requires the normals to be encoded in the following way to work properly. | Another problem is the encoding of normal maps. The components of normals are in the range from -1 to 1 while those of colors are in the range from 0 to 1. The most common solution is to map all normal components directory from -1..1 to 0..1 using one color component for each normal component. For the choice of mapping between the components as well as flipping or not flipping the result there are tons of different ways normals can be mapped. The Drag[en]gine requires the normals to be encoded in the following way to work properly. | ||
|Normal Component|-1 Normal|0 Normal|1 Normal|Color Component| | |Normal Component|-1 Normal|0 Normal|1 Normal|Color Component| | ||
Line 56: | Line 60: | ||
|All Colors Enabled|Image has a blueish look| | |All Colors Enabled|Image has a blueish look| | ||
If this holds true chances are good your normal map is usable from the encoding point of view. Make sure your watch the Tangent Space Problem too. | If this holds true chances are good your normal map is usable from the encoding point of view. Make sure your watch the Tangent Space Problem too. | ||
+ | |||
+ | ===== Blender3D GBuffer NormGen Script ===== | ||
+ | |||
+ | The Blender3D export scripts contain a GBuffer based normal normal generator script. This script converts normals generated by the blender backing process into normals working with the Drag[en]gine. Normal map generators in general have a problem with the middle value. A (0, 0, 1) normal converts to 127.5 . Slight irregularities result in tiny different color values chosen for nearly the same encoded normal. Not visible from the naked eye they turn into artifacts while rendering. Especially texture compression reacts badly to such small irregularities in the normal maps. | ||
+ | |||
+ | The export scripts contain a **squish correction** to ensure the (0, 0, 1) and similar normals always map properly to (127, 127, 255). The image below shows what to avoid. | ||
+ | <WRAP center 100%> | ||
+ | <WRAP center box 550px> | ||
+ | {{ : | ||
+ | <WRAP centeralign> | ||
+ | </ | ||
+ | </ | ||
====== Physics Module ====== | ====== Physics Module ====== | ||
+ | |||
The **normal** texture property can be used for **[[gamedev: | The **normal** texture property can be used for **[[gamedev: | ||
Line 63: | Line 80: | ||
====== Examples ====== | ====== Examples ====== | ||
+ | |||
<WRAP column 45%> | <WRAP column 45%> | ||
<WRAP center box 450px> | <WRAP center box 450px> | ||
- | {{ :gamedev:material_normal.png |Manhole cover with and without normal map}} | + | {{ :gamedev:textureproperties: |
<WRAP centeralign> | <WRAP centeralign> | ||
</ | </ | ||
Line 72: | Line 90: | ||
<WRAP column 45%> | <WRAP column 45%> | ||
<WRAP center box 550px> | <WRAP center box 550px> | ||
- | {{ :gamedev:material_normal2.png |Sample normal map image of a storm drain inlet}} | + | {{ :gamedev:textureproperties: |
<WRAP centeralign> | <WRAP centeralign> | ||
</ | </ |