Merge pull request #69985 from clayjohn/mobile-rim
Ensure that rim lighting uses an exponent base greater than zero
This commit is contained in:
commit
83281e7a42
1 changed files with 2 additions and 1 deletions
|
@ -134,7 +134,8 @@ void light_compute(vec3 N, vec3 L, vec3 V, float A, vec3 light_color, float atte
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(LIGHT_RIM_USED)
|
#if defined(LIGHT_RIM_USED)
|
||||||
float rim_light = pow(max(0.0, 1.0 - cNdotV), max(0.0, (1.0 - roughness) * 16.0));
|
// Epsilon min to prevent pow(0, 0) singularity which results in undefined behavior.
|
||||||
|
float rim_light = pow(max(1e-4, 1.0 - cNdotV), max(0.0, (1.0 - roughness) * 16.0));
|
||||||
diffuse_light += rim_light * rim * mix(vec3(1.0), albedo, rim_tint) * light_color;
|
diffuse_light += rim_light * rim * mix(vec3(1.0), albedo, rim_tint) * light_color;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue