Normal Mapping in Blitz3D


Tweet blitz3d materials shaders tutorials
BlitzCoder

After some deep diving into this workflow along with existing demos, methods and snippets, here is the definitive guide with demo and sources in using normal maps in Blitz3D plus a few notes.

To be updated

Athene Demo

  • Basic normal mapping, works particularly on static meshes and models, etc. EntityColor is used and changed in the computation.
  • Demo uses Object Space normal map, but the calculation also seem to work on Tangent Space maps.
  • Fast and simple, but not that accurate on per surface normals. To fix this, Object Space maps can be used for accuracy as per demo texture, but with some limitations (see notes below).

DotMyBot Demo

  • Per surface/vertex calculations so this is more accurate. The computation result is applied to VertexColor.
  • The direct lighting method is broken, but the effect seems to apply or work on this as well (needs more testing and confirmation)*.
  • More calculations and a bit extensive, depending on your models or scene.
  • Works best with Tangent Space maps as per sampled texture in this demo.

Notes:

  • Blitz3D's ambient, light type* and color are now ignored so you need to recreate this again in some way or form (light probes, environment maps, etc), see also BSM Renderer library ambient example and other demos.
  • Object Space maps for static meshes (no scaling/deformation) and non-tiled textured models. Unique normal map textures for different mesh shapes.
  • Tangent space maps works best for animated meshes, but there could be some issues on seams/low poly meshes depending on your model. Modern shaders already fixes this problem.

Object Space Normal Map sample
Image

Tangent Space Normal Map sample
Image

More References:
http://wiki.polycount.com/wiki/Normal_Map_Technical_Details

Tools:
NVIDIA Melody - Normal Map Creation Tool generated from high poly meshes.

BlitzCoder commented:

DotMyBot's per vertex color for dot3 blending calculation..

Image

BlitzCoder commented:

Another implementation by NightPhoenix at blitzforum.de with light color and intensity.

Download

Image

Reply To Topic (minimum 10 characters)

Please log in to reply