浏览代码

Bloom Fix & Tweaks

Samuel Skiff 3 年之前
父节点
当前提交
54ac395c1b

+ 5 - 4
Templates/BaseGame/game/core/postFX/scripts/HDR/HDRPostFX.tscript

@@ -60,8 +60,8 @@ $PostFX::HDRPostFX::adaptRate = 0.85;
 // http://www.iryoku.com/next-generation-post-processing-in-call-of-duty-advanced-warfare
 
 $PostFX::HDRPostFX::enableBloom = true;
-$PostFX::HDRPostFX::threshold = 0.0;
-$PostFX::HDRPostFX::intensity = 1.0;
+$PostFX::HDRPostFX::threshold = 1.25;
+$PostFX::HDRPostFX::intensity = 0.25;
 $PostFX::HDRPostFX::radius = 4.0;
 
 $PostFX::HDRPostFX::enableDirt = true;
@@ -85,6 +85,7 @@ singleton ShaderData( HDR_BloomInitShader )
    OGLPixelShaderFile = "./HDR_Bloom/bloomInitSample.glsl";
    
    samplerNames[0] = "$inputTex";
+   samplerNames[1] = "$luminanceTex";
    
    pixVersion = 3.0;
 };
@@ -444,7 +445,7 @@ function HDRPostFX::populatePostFXSettings(%this)
    // /----- BLOOM SETTINGS -----/
    PostEffectEditorInspector.startGroup("HDR - Bloom");
    PostEffectEditorInspector.addField("$PostFX::HDRPostFX::enableBloom", "Enable Bloom", "bool", "", $PostFX::HDRPostFX::enableBloom, "");
-   PostEffectEditorInspector.addField("$PostFX::HDRPostFX::threshold", "Threshold", "range", "", $PostFX::HDRPostFX::threshold, "0 1 10");
+   PostEffectEditorInspector.addField("$PostFX::HDRPostFX::threshold", "Threshold", "range", "", $PostFX::HDRPostFX::threshold, "0 2 10");
    PostEffectEditorInspector.addField("$PostFX::HDRPostFX::intensity", "Intensity", "range", "", $PostFX::HDRPostFX::intensity, "0 10 10");
    PostEffectEditorInspector.addField("$PostFX::HDRPostFX::radius", "Radius", "float", "", $PostFX::HDRPostFX::radius, "");
    PostEffectEditorInspector.endGroup();
@@ -582,9 +583,9 @@ function HDRPostFX::SetupBloomFX( %this )
      target = "#hdrbloom_end";
      targetFormat = %this.mipTexFormat;
    };
-   %this.add(%finalFX);
 
    %this.add(%bloomFX);
+   %this.add(%finalFX);
 }
 
 singleton PostEffect( HDRPostFX )

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

@@ -54,5 +54,5 @@ void main()
     upSample.rgb += upSample.rgb * dirt;
   #endif
   
-  OUT_col = max(upSample * M_1OVER_PI_F, 0.0);
+  OUT_col = max(upSample, 0.0);
 }

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

@@ -48,5 +48,5 @@ float4 main(PFXVertToPix IN) : TORQUE_TARGET0
     upSample.rgb += upSample.rgb * dirt;
   #endif
   
-  return max(upSample * M_1OVER_PI_F, 0.0f);
+  return max(upSample, 0.0f);
 }

+ 1 - 3
Templates/BaseGame/game/core/postFX/scripts/HDR/HDR_Bloom/bloomThresholdP.glsl

@@ -35,11 +35,9 @@ out vec4 OUT_col;
 void main()
 {
   vec4 screenColor = texture(inputTex, IN_uv0);
-  float lum = hdrLuminance(screenColor.rgb);
   
   float brightness = max(screenColor.r, max(screenColor.g, screenColor.b));
   float contribution = clamp(brightness - threshold, 0.0, 1.0) / max(brightness, 0.0001);
-  contribution = sqr(lum * contribution);
   
-  OUT_col = max(screenColor * sqr(contribution), 0.0001);
+  OUT_col = max(screenColor * contribution, 0.0001);
 }

+ 1 - 3
Templates/BaseGame/game/core/postFX/scripts/HDR/HDR_Bloom/bloomThresholdP.hlsl

@@ -29,11 +29,9 @@ uniform float threshold;
 float4 main(PFXVertToPix IN) : TORQUE_TARGET0
 {
   float4 screenColor = TORQUE_TEX2D(inputTex, IN.uv0);
-  float lum = hdrLuminance(screenColor.rgb);
   
   float brightness = max(screenColor.r, max(screenColor.g, screenColor.b));
   float contribution = saturate(brightness - threshold) / max(brightness, 0.0001f);
-  contribution = sqr(lum * contribution);
   
-  return max(screenColor * sqr(contribution), 0.0001f);
+  return max(screenColor * contribution, 0.0001f);
 }