Normal maps

Introduction

Since r12300 0ad supports the usage of special textures called normal maps. From 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 Blender you will need to invert the Y coordinates of the normal map.

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 here. Materials having normal map support usually have by convention, either norm or parallax. 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 version="1.0" encoding="utf-8"?>
<actor version="1">
  <castshadow/>
  <group>
    <variant frequency="100" name="Object Name">
      <mesh>structural/object.dae</mesh>
      <textures>
        <texture file="structural/object_diffuse.png" name="baseTex"/>
        <texture file="structural/object_normal.png" name="normTex"/>
      </textures>
    </variant>
  </group>
  <material>player_trans_parallax.xml</material>
</actor>

If you forget the line

<texture file="structural/object_normal.png" name="normTex"/>

The engine will print an error:

ERROR: Actor object: required texture sampler normTex not found (material art/materials/player_trans_parallax.xml)

Normal map tutorial on the Taleworlds forum especially the James O'Hare tutorial part.

Last modified 4 years ago Last modified on Dec 26, 2019, 1:40:35 PM

Attachments (1)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.