Changes between Initial Version and Version 1 of NormalMaps


Ignore:
Timestamp:
Dec 26, 2019, 1:40:35 PM (4 years ago)
Author:
Stan
Comment:

Initial version.

Legend:

Unmodified
Added
Removed
Modified
  • NormalMaps

    v1 v1  
     1[[TOC]]
     2
     3= Normal maps =
     4== Introduction ==
     5
     6Since r12300 0ad supports the usage of special textures called normal maps. From [https://en.wikipedia.org/wiki/Normal_mapping Wikipedia]:
     7
     8
     9> 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.
     10
     11
     12**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.
     13
     14[[Image(DirectXvsOpenGL.png,200)]]
     15
     16
     17== Usage ==
     18
     19To 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.
     20
     21Here is an example of an actor with a normal map. Notice it's using the `player_trans_parallax.xml` material.
     22
     23{{{#!xml
     24<?xml version="1.0" encoding="utf-8"?>
     25<actor version="1">
     26  <castshadow/>
     27  <group>
     28    <variant frequency="100" name="Object Name">
     29      <mesh>structural/object.dae</mesh>
     30      <textures>
     31        <texture file="structural/object_diffuse.png" name="baseTex"/>
     32        <texture file="structural/object_normal.png" name="normTex"/>
     33      </textures>
     34    </variant>
     35  </group>
     36  <material>player_trans_parallax.xml</material>
     37</actor>
     38}}}
     39
     40If you forget the line
     41
     42{{{#!xml
     43<texture file="structural/object_normal.png" name="normTex"/>
     44}}}
     45
     46The engine will print an error:
     47
     48{{{
     49ERROR: Actor object: required texture sampler normTex not found (material art/materials/player_trans_parallax.xml)
     50}}}
     51
     52== Additional links ==
     53
     54Normal 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.
     55