EncodeNormals

Description

Name

class Tinman.Image.EncodeNormals

Derived from

Image

Encodes a normal map image, assuming that all tangent-space normal vectors point upwards (i.e. the minimum blue channel value is 0.5).

The pixels of the given normal map are interpreted as follows:

red  :[0..1] => X:[-1 .. +1]
green:[0..1] => Y:[-1 .. +1]
blue :[0..1] => Z:[-1 .. +1]

The vector (X,Y,Z) is then normalized to unit-length. The grayscale intensity I is computed from the pixel in map (if not null). The pixel P of the resulting image is then computed like this:

map == null :
  P.red   = X * 0.5 - 0.5
  P.green = Y * 0.5 - 0.5

map != null :
  P.red   = X * 0.5 - 0.5
  P.green = I
  P.blue  = Y * 0.5 - 0.5

Fields / Required

normal

Type

Image

Constraint

# != null

The normal map image.

Fields / Optional

map

Type

Image

Default

null

Optional grayscale map to encode.

Fields / External

info

Type

Image.Info

Contains information about the image data source, including image format and embedded geo-referencing information.