瀏覽代碼

undefined preprocessors on some machines eval to true. given this is purely a bool anyway, might as well stick to ifdef

AzaezelX 4 年之前
父節點
當前提交
c0b6007b9f

+ 3 - 3
Templates/BaseGame/game/core/rendering/shaders/gl/lighting.glsl

@@ -219,10 +219,10 @@ vec3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight)
    float D = D_GGX(surfaceToLight.NdotH, surface.linearRoughnessSq);
    vec3 Fr = D * F * Vis;
 
-#if CAPTURING == true
-   return mix(Fd + Fr,surface.f0,surface.metalness);
+#ifdef CAPTURING
+   return saturate(mix(Fd + Fr,surface.f0,surface.metalness));
 #else
-   return Fd + Fr;
+   return saturate(Fd + Fr);
 #endif
 
 }

+ 3 - 3
Templates/BaseGame/game/core/rendering/shaders/lighting.hlsl

@@ -220,10 +220,10 @@ float3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight)
    float D = D_GGX(surfaceToLight.NdotH, surface.linearRoughnessSq);
    float3 Fr = D * F * Vis;
    
-#if CAPTURING == true
-    return lerp(Fd + Fr,surface.f0,surface.metalness);
+#ifdef CAPTURING
+    return saturate(lerp(Fd + Fr,surface.f0,surface.metalness));
 #else
-   return Fd + Fr;
+   return saturate(Fd + Fr);
 #endif
 
 }