Skip to content

Commit

Permalink
Restore original mx_environment_radiance
Browse files Browse the repository at this point in the history
This changelist restores the original implementation of mx_environment_radiance in the prefiltered path, as there does not appear to be any visual difference when switching between the original and new implementations.
  • Loading branch information
jstone-lucasfilm committed Dec 23, 2023
1 parent bfd659d commit 6de22f3
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions libraries/pbrlib/genglsl/lib/mx_environment_prefilter.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,12 @@ vec3 mx_environment_radiance(vec3 N, vec3 V, vec3 X, vec2 alpha, int distributio
float NdotV = clamp(dot(N, V), M_FLOAT_EPS, 1.0);

float avgAlpha = mx_average_alpha(alpha);
// Convert n and k to f0. f90 will be equal to 1.
// Source: Section 2.2: https://jcgt.org/published/0003/04/03/paper.pdf
vec3 k2 = fd.extinction * fd.extinction;
vec3 F0 = ((fd.ior - 1)*(fd.ior - 1) + k2) / ((fd.ior + 1)*(fd.ior + 1) + k2);
vec3 FGD = mx_ggx_dir_albedo(NdotV, avgAlpha, F0, vec3(1.0));
if (fd.refraction) {
FGD = 1.0 - FGD;
}

vec3 F = mx_compute_fresnel(NdotV, fd);
float G = mx_ggx_smith_G2(NdotV, NdotV, avgAlpha);
vec3 FG = fd.refraction ? vec3(1.0) - (F * G) : F * G;

vec3 Li = mx_latlong_map_lookup(L, $envMatrix, mx_latlong_compute_lod(avgAlpha), $envRadiance);
return Li * FGD;
return Li * FG;
}

vec3 mx_environment_irradiance(vec3 N)
Expand Down

0 comments on commit 6de22f3

Please sign in to comment.