R2 Shaders
|
Functions for transforming normal vectors. More...
Go to the source code of this file.
Functions | |
vec2 | R2_normalsCompress (const vec3 n) |
vec3 | R2_normalsDecompress (const vec2 n) |
vec3 | R2_normalsBitangent (const vec3 n, const vec4 t) |
vec3 | R2_normalsUnpack (const sampler2D map, const vec2 uv) |
vec3 | R2_normalsTransform (const vec3 m, const vec3 t, const vec3 b, const vec3 n) |
vec3 | R2_normalsBumpLocal (const sampler2D t_normal, const vec3 n, const vec3 t, const vec3 b, const vec2 uv) |
vec3 | R2_normalsBump (const sampler2D t_normal, const mat3x3 m_normal, const vec3 n, const vec3 t, const vec3 b, const vec2 uv) |
Functions for transforming normal vectors.
Definition in file R2Normals.h.
vec3 R2_normalsBitangent | ( | const vec3 | n, |
const vec4 | t | ||
) |
Compute a bitangent vector given a normal n and tangent vector t, assuming a sign [-1.0, 1.0] stored in t.w.
n | A normal vector |
t | A tangent vector |
Definition at line 58 of file R2Normals.h.
vec3 R2_normalsBump | ( | const sampler2D | t_normal, |
const mat3x3 | m_normal, | ||
const vec3 | n, | ||
const vec3 | t, | ||
const vec3 | b, | ||
const vec2 | uv | ||
) |
Given a texture consisting of normal vectors t_normal, an object-to-eye-space matrix m_normal, object-space normal n, object-space tangent t, object-space bitangent b, and texture coordinates uv, unpack and transform a vector from the texture, and transform it to eye-space.
t_normal | A normal map texture |
m_normal | A object-to-eye-space matrix |
n | A normal vector |
t | A tangent vector |
b | A bitangent vector |
uv | A set of UV coordinates |
Definition at line 144 of file R2Normals.h.
vec3 R2_normalsBumpLocal | ( | const sampler2D | t_normal, |
const vec3 | n, | ||
const vec3 | t, | ||
const vec3 | b, | ||
const vec2 | uv | ||
) |
Given a texture consisting of normal vectors t_normal, object-space normal n, object-space tangent t, object-space bitangent b, and texture coordinates uv, unpack and transform a vector from the texture, resulting in an object-space peturbed normal.
t_normal | A normal map texture |
n | A normal vector |
t | A tangent vector |
b | A bitangent vector |
uv | A set of UV coordinates |
Definition at line 115 of file R2Normals.h.
vec2 R2_normalsCompress | ( | const vec3 | n | ) |
Compress the (normalized) vector n into two elements using a spheremap transform (Lambert Azimuthal Equal-Area).
n | A normal vector |
Definition at line 17 of file R2Normals.h.
vec3 R2_normalsDecompress | ( | const vec2 | n | ) |
Decompress the given vector, assuming it was encoded with a spheremap transform (Lambert Azimuthal Equal-Area).
n | The compressed normal vector |
Definition at line 34 of file R2Normals.h.
vec3 R2_normalsTransform | ( | const vec3 | m, |
const vec3 | t, | ||
const vec3 | b, | ||
const vec3 | n | ||
) |
Transform the tangent-space vector m into the coordinate system given by the orthonormal vectors {t, b, n}.
m | A tangent-space vector |
t | A tangent vector |
b | A bitangent vector |
n | A normal vector |
Definition at line 92 of file R2Normals.h.
vec3 R2_normalsUnpack | ( | const sampler2D | map, |
const vec2 | uv | ||
) |
Unpack a tangent-space normal vector from the texture map.
map | A normal map texture |
uv | The UV coordinates |
Definition at line 74 of file R2Normals.h.