Skip to main content

Module vec3

Module vec3 

Source
Expand description

Lightweight Vec3 helper functions used throughout the BRDF library.

Functionsยง

cartesian_to_spherical
Cartesian to spherical (theta, phi).
dot_clamp
Dot product, clamped to [0, 1].
dot_clamp_eps
Dot product, clamped to [0 + epsilon, 1] to avoid division by zero.
orthonormal_basis
Construct a local orthonormal basis (tangent t, bitangent b) from surface normal n using the Duff et al. 2017 method.
reflect
Reflect v around n.
refract
Refract v through a surface with relative IOR eta. Returns None on total internal reflection.
saturate
Saturate (clamp to [0, 1]).
schlick_scalar
Schlick Fresnel approximation (scalar version).
spherical_to_cartesian
Spherical direction to cartesian.