[[TOC]]
= Normal maps =
== Introduction ==
Since r12300 0ad supports the usage of special textures called normal maps. From [https://en.wikipedia.org/wiki/Normal_mapping Wikipedia]:
> In 3D computer graphics, normal mapping, or Dot3 bump mapping, is a technique used for faking the lighting of bumps and dents – an implementation of bump mapping. It is used to add details without using more polygons.
**Note**: Pyrogenesis uses DirectX normal maps even though it is an OpenGL engine. This means if you bake a normal map from for example [https://www.blender.org/ Blender] you will need to invert the Y coordinates of the normal map.
[[Image(DirectXvsOpenGL.png,200)]]
== Usage ==
To enable normal maps, you need to use specific materials in your actor file. You can find the list of the current materials in the SVN version [https://trac.wildfiregames.com/browser/ps/trunk/binaries/data/mods/public/art/materials here]. Materials having normal map support usually have by convention, either `norm` or `parallax`. [wiki:ParallaxNormalMaps Parallax normal maps] are a special kind of normal map.
Here is an example of an actor with a normal map. Notice it's using the `player_trans_parallax.xml` material.
{{{#!xml
structural/object.dae
player_trans_parallax.xml
}}}
If you forget the line
{{{#!xml
}}}
The engine will print an error:
{{{
ERROR: Actor object: required texture sampler normTex not found (material art/materials/player_trans_parallax.xml)
}}}
== Additional links ==
Normal map tutorial on the Taleworlds [https://forums.taleworlds.com/index.php?topic=216257.0 forum] especially the James O'Hare [http://i.imgur.com/lpC4V6B.jpg tutorial] part.