INNER CODE UNIT · Python

gl

SedulousWorks/SedulousEngine · Scripts/generate_brdf_lut.py:112

        gl = NdotL / (NdotL * (1.0 - k) + k + 1e-10)
        G = gv * gl

        # G_Vis = G * VdotH / (NdotH * NdotV + epsilon).
        G_Vis = (G * VdotH) / (NdotH * ndot_v[:, None] + 0.0001)

        # Schlick Fresnel split: Fc = (1 - VdotH)^5.
        Fc = np.power(np.maximum(1.0 - VdotH, 0.0), 5.0)

        scale_contrib = np.where(mask, (1.0 - Fc) * G_Vis, 0.0)
        bias_contrib = np.where(mask, Fc * G_Vis, 0.0)

        result_scale[y, :] = np.sum(scale_contrib, axis=1) / NUM_SAMPLES
        result_bias[y, :] = np.sum(bias_contrib, axis=1) / NUM_SAMPLES

    elapsed = time.time() - start
    print(f"  Computation done in {elapsed:.1f}s", file=sys.stderr)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…