diff options
| -rw-r--r-- | Shaders/parallax/parallax_lighting.cginc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Shaders/parallax/parallax_lighting.cginc b/Shaders/parallax/parallax_lighting.cginc index 2d7386f..a3a7eb1 100644 --- a/Shaders/parallax/parallax_lighting.cginc +++ b/Shaders/parallax/parallax_lighting.cginc @@ -302,8 +302,16 @@ float4 effect(inout v2f i, out float depth) const float metallic = getLayerMetallic(uv, (int) layer); const float smoothness = 1.0 - getLayerRoughness(uv, (int) layer); - bool custom_cubemap = (layer == 1); - float4 lit_color = getLitColor(i, color, pp, normal, metallic, smoothness, custom_cubemap); + bool custom_cubemap = true; + float4 lit_color; + + // Hack: Bright cubemaps cause glare on rough surfaces. To prevent this, + // switch to unlit shading when shading a perfectly rough material. + if (smoothness == 0.0) { + lit_color = color; + } else { + lit_color = getLitColor(i, color, pp, normal, metallic, smoothness, custom_cubemap); + } lit_color.rgb += color.rgb * getLayerEmission(layer); @@ -315,7 +323,6 @@ float4 effect(inout v2f i, out float depth) } } - // No ray hit: return default material float base_depth = depth; float metallic = 1.0; |
