INNER CODE UNIT · Python
Hx
SedulousWorks/SedulousEngine · Scripts/generate_brdf_lut.py:84
Hx = np.cos(phi) * sin_theta
Hy = np.sin(phi) * sin_theta
Hz = cos_theta
# Geometry k for IBL: k = a / 2 (a = roughness^2).
k = a * 0.5
# NdotV values for this row (all x values).
ndot_v = np.maximum(np.arange(1, SIZE + 1, dtype=np.float64) / SIZE, 0.001)
# V in tangent space where N = (0,0,1): V = (sqrt(1 - NdotV^2), 0, NdotV).
Vx = np.sqrt(1.0 - ndot_v * ndot_v)
Vz = ndot_v
# VdotH for all (x, sample) combos.
VdotH = Vx[:, None] * Hx[None, :] + Vz[:, None] * Hz[None, :]
VdotH = np.maximum(VdotH, 0.0)