INNER CODE UNIT · Python
elapsed
SedulousWorks/SedulousEngine · Scripts/generate_brdf_lut.py:71
elapsed = time.time() - start
print(f" Row {y}/{SIZE} ({100*y//SIZE}%) [{elapsed:.1f}s]", file=sys.stderr)
roughness = (y + 1) / SIZE
a = roughness * roughness
a2 = a * a
# GGX importance sampling: compute H for all samples.
cos_theta = np.sqrt((1.0 - xi2_all) / (1.0 + (a2 - 1.0) * xi2_all))
sin_theta = np.sqrt(np.maximum(1.0 - cos_theta * cos_theta, 0.0))
phi = 2.0 * np.pi * xi1_all
# H in tangent space (N = Z-up).
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).