瀏覽代碼

get gl side HDR compiling, attempt clamp to keep bloom in range

AzaezelX 4 年之前
父節點
當前提交
5be1b77791

+ 1 - 1
Templates/BaseGame/game/core/postFX/scripts/HDR/downScale4x4P.glsl

@@ -22,7 +22,7 @@
 
 #define IN_GLSL
 #include "core/rendering/shaders/shdrConsts.h"
-#include ".core/rendering/shaders/gl/hlslCompat.glsl"
+#include "core/rendering/shaders/gl/hlslCompat.glsl"
 #include "shadergen:/autogenConditioners.h"
 
 in vec4 texCoords[8];

+ 8 - 11
Templates/BaseGame/game/core/postFX/scripts/HDR/finalPassCombineP.glsl

@@ -69,28 +69,25 @@ float3 ACESFilm( float3 x )
     const float c = 2.43;
     const float d = 0.59;
     const float e = 0.14;
-    return sat((x*(a*x+b))/(x*(c*x+d)+e));
+    return saturate((x*(a*x+b))/(x*(c*x+d)+e));
 }
 
 vec3 tonemap(vec3 c)
 {
    vec3 colorOut = c;
-
+    
    if(g_fTonemapMode == 1.0)
    {
       const float W = 11.2;
       float ExposureBias = 2.0f;
-      float ExposureAdjust = 1.5f;
-      c *= ExposureAdjust;
-      vec3 curr = Uncharted2Tonemap(ExposureBias*c);
-      vec3 whiteScale = 1.0f / Uncharted2Tonemap(vec3(W,W,W));
-
-      colorOut = curr*whiteScale;
-   }
+      //float ExposureAdjust = 1.5f;
+      //c *= ExposureAdjust;
+      colorOut = Uncharted2Tonemap(ExposureBias*colorOut);
+      colorOut = colorOut * (1.0f / Uncharted2Tonemap(vec3(W,W,W)));
    }
    else if(g_fTonemapMode == 2.0)
    {
-      colorOut = ACESFilm(c);
+      colorOut = ACESFilm(colorOut);
    }
 
    return colorOut;
@@ -123,7 +120,7 @@ void main()
    }
 
    // Add the bloom effect.
-   _sample += g_fBloomScale * bloom;
+   _sample.rgb += clamp(vec3(g_fBloomScale,g_fBloomScale,g_fBloomScale) * bloom.rgb, vec3(0,0,0), vec3(1.0,1.0,1.0));
 
    // Apply contrast
    _sample.rgb = ((_sample.rgb - 0.5f) * Contrast) + 0.5f;

+ 1 - 1
Templates/BaseGame/game/core/postFX/scripts/HDR/finalPassCombineP.hlsl

@@ -113,7 +113,7 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
    }
 
    // Add the bloom effect.
-   sample += g_fBloomScale * bloom;
+   sample += saturate(g_fBloomScale * bloom);
 
    // Apply contrast
    sample.rgb = ((sample.rgb - 0.5f) * Contrast) + 0.5f;