Expand description
The linearly-transformed-cosine lookup tables the rectangular area-light
shading path samples, generated at build time by the fitter in fit.rs.
Two tables, both LTC_LUT_SIZE square and indexed the same way:
u = roughness in [0, 1]
v = sqrt(1 - cos(theta_view)), which spends more of the axis on the grazing
angles where the lobe changes fastest
matrix_texels holds 4 floats per cell: the non-trivial entries of the inverse
transform, normalised so the middle entry is 1. The shader rebuilds
[[x, 0, z], [0, 1, 0], [y, 0, w]], transforms the light quad’s corners by it,
and evaluates the closed-form clamped-cosine polygon integral.
magnitude_texels holds 2 floats per cell: the lobe’s directional albedo and
its Fresnel weight, recombined by the shader as
f0 * albedo + (1 - f0) * fresnel.
Constants§
- LTC_
LUT_ SIZE - Edge of the square lookup table. 64 matches the resolution the parameterisation
was chosen for: finer buys little once
sqrt(1 - cos)has spread the grazing angles out, and the fit cost grows with the square.
Functions§
- magnitude_
texels - RG32Float texels,
LTC_LUT_SIZEsquare. - matrix_
texels - RGBA32Float texels,
LTC_LUT_SIZEsquare. The backend uploads these once.