GLSL Tangent Space Normal Map shader

This shader is used to render a bump mapped surface.

This shader is used to render a bump mapped surface. Surface normals are supplied to the shader in a normal map. The coordinates of the normals are interpreted relative to a coordinate frame that is also passed to the shader. Typically this coordinate frame describes the relationship between the texture coordinates of the normal map and the geometry to which the map is applied.

For example, the coordinate frame will have a basis vector in the direction that the u texture coordinate is increasing fastest and a basis vector in the direction that the v texture coordinate is increasing fastest. The third basis vector is often normal to the surface. Specifying normals in tangent space decouples the normals from the underlying geometry – the coordinate frame defines the relationship between the two. This makes it possible to use a single normal map on multiple surfaces that have different orientations.

The PolyFrame SOP can be used to generate vectors in the direction of increasing u and v texture coordinates. These vectors are computed for each vertex. Often it is desirable to average these vectors to achieve smooth transitions along polygon boundaries. The AttribPromote SOP can be used to average these basis vectors and promote them to point attributes.

Usages in other examples

Example name Example for

Poly Frame surface node

Load | Launch