This is an old revision of the document!


NormalMap Material (TGorillaNormalMapMaterialSource)

The TGorillaNormalMapMaterialSource is inherited from TGorillaDefaultMaterialSource, supports multiple light sources and enables normal mapping functionality in vertex- and fragmentshader: GORILLA_GLSL_DEFINE_NORMALMAP

Definition

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. A common use of this technique is to greatly enhance the appearance and details of a low polygon model by generating a normal map from a high polygon model or height map.

Normal maps are commonly stored as regular RGB images where the RGB components correspond to the X, Y, and Z coordinates, respectively, of the surface normal.

[source: https://en.wikipedia.org/wiki/Normal_mapping]

The shading model configured by default is the Blinn-Phong algorithm.

Using this material source will provide a new published property called NormalMap. It also supplies the optional DisplacementMap property to apply a vertex manipulation texture.

Normal Maps

Example

uses
  Gorilla.Material.NormalMap;
 
var FNormalMapMaterial : TGorillaNormalMapMaterialSource;
 
FNormalMapMaterial := TGorillaNormalMapMaterialSource.Create(GorillaViewport1);
FNormalMapMaterial.Parent := GorillaViewport1;
FNormalMapMaterial.Texture.LoadFromFile('layingrock-c.jpg');
FNormalMapMaterial.NormalMap.LoadFromFile('layingrock-n.jpg');
 
FNormalMapMaterial.NormalIntensity := 1.0;