INNER CODE UNIT · Python

ndot_v

SedulousWorks/SedulousEngine · Scripts/generate_brdf_lut.py:92

        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)

        # L = 2 * VdotH * H - V; only need L.z for NdotL since N = (0,0,1).
        Lz = 2.0 * VdotH * Hz[None, :] - Vz[:, None]
        NdotL = np.maximum(Lz, 0.0)
        NdotH = np.maximum(Hz[None, :] * np.ones((SIZE, 1)), 0.0)

        # Only contributing samples (NdotL > 0) accumulate.
        mask = NdotL > 0.0

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…