INNER CODE UNIT · Python
xi1_all
SedulousWorks/SedulousEngine · Scripts/generate_brdf_lut.py:63
xi1_all = sample_indices.astype(np.float64) / NUM_SAMPLES
xi2_all = radical_inverse_vdc(sample_indices)
result_scale = np.zeros((SIZE, SIZE), dtype=np.float64)
result_bias = np.zeros((SIZE, SIZE), dtype=np.float64)
for y in range(SIZE):
if y % 32 == 0:
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))