Skip to content

Commit

Permalink
Fix initialization warning in GLSL
Browse files Browse the repository at this point in the history
This changelist refactors the implementation of mx_surface_transmission in GLSL, addressing an initialization warning when the function is called in WebGL.
  • Loading branch information
jstone-lucasfilm committed Jul 8, 2022
1 parent 6345da4 commit 92dded6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions libraries/pbrlib/genglsl/lib/mx_transmission_refract.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@

vec3 mx_surface_transmission(vec3 N, vec3 V, vec3 X, vec2 alpha, int distribution, FresnelData fd)
{
vec3 transmission;
if ($refractionEnv)
{
// Approximate the appearance of dielectric transmission as glossy
// Approximate the appearance of surface transmission as glossy
// environment map refraction, ignoring any scene geometry that might
// be visible through the surface.
fd.refraction = true;
return mx_environment_radiance(N, V, X, alpha, distribution, fd);
transmission = mx_environment_radiance(N, V, X, alpha, distribution, fd);
}
else
{
transmission = $refractionColor;
}

return $refractionColor;
return transmission;
}

0 comments on commit 92dded6

Please sign in to comment.