mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-31 18:15:24 +00:00
get gl side HDR compiling, attempt clamp to keep bloom in range
This commit is contained in:
parent
1e9df5f415
commit
5be1b77791
3 changed files with 10 additions and 13 deletions
|
|
@ -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];
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue