mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-14 22:50:45 +00:00
Fixed too bright fog in HDR mode
This commit is contained in:
parent
558afdd093
commit
3b28f7ff98
4 changed files with 43 additions and 14 deletions
|
@ -45,5 +45,5 @@ struct PS_OUT {
|
|||
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
result.color = idtex2Dproj( samp0, fragment.texcoord0 ) * tex2D( samp1, fragment.texcoord1 ) * rpColor;
|
||||
result.color = sRGBAToLinearRGBA( idtex2Dproj( samp0, fragment.texcoord0 ) * tex2D( samp1, fragment.texcoord1 ) * rpColor );
|
||||
}
|
||||
|
|
|
@ -45,6 +45,6 @@ struct PS_OUT {
|
|||
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
result.color = tex2D( samp0, fragment.texcoord0 ) * tex2D( samp1, fragment.texcoord1 ) * sRGBAToLinearRGBA( rpColor );
|
||||
result.color = sRGBAToLinearRGBA( tex2D( samp0, fragment.texcoord0 ) * tex2D( samp1, fragment.texcoord1 ) * rpColor );
|
||||
}
|
||||
|
||||
|
|
|
@ -324,7 +324,7 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
float shadow = 0.0;
|
||||
|
||||
// RB: casting a float to int and using it as index can really kill the performance ...
|
||||
float numSamples = 12.0;
|
||||
float numSamples = 6.0;
|
||||
float stepSize = 1.0 / numSamples;
|
||||
|
||||
float random = BlueNoise( fragment.position.xy, 1.0 );
|
||||
|
@ -337,7 +337,7 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
rot.y = sin( random );
|
||||
|
||||
float shadowTexelSize = rpScreenCorrectionFactor.z * rpJitterTexScale.x;
|
||||
for( int i = 0; i < 12; i++ )
|
||||
for( int i = 0; i < 6; i++ )
|
||||
{
|
||||
float2 jitter = poissonDisk[i];
|
||||
float2 jitterRotated;
|
||||
|
@ -351,6 +351,7 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
|
||||
shadow *= stepSize;
|
||||
|
||||
|
||||
#else
|
||||
|
||||
// Vogel Disk Sampling
|
||||
|
|
|
@ -47,7 +47,7 @@ struct PS_OUT
|
|||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
#define USE_CHROMATIC_ABERRATION 1
|
||||
#define USE_CHROMATIC_ABERRATION 0
|
||||
#define Chromatic_Amount 0.075
|
||||
|
||||
#define USE_TECHNICOLOR 0 // [0 or 1]
|
||||
|
@ -175,10 +175,37 @@ void ChromaticAberrationPass( inout float4 color )
|
|||
sumColor += so * tex2D( samp0, BarrelDistortion( fragment.texcoord0, ( 0.5 * amount * t ) ) ).rgb;
|
||||
}
|
||||
|
||||
color.rgb = ( sumColor / sum );
|
||||
//color.rgb = lerp(color.rgb, (sumColor / sum), Technicolor_Amount);
|
||||
float3 outColor = ( sumColor / sum );
|
||||
color.rgb = lerp( color.rgb, outColor, Technicolor_Amount );
|
||||
}
|
||||
|
||||
void ChromaticAberrationPass2( inout float4 color )
|
||||
{
|
||||
float amount = 6.0;
|
||||
|
||||
float2 uv = fragment.texcoord0;
|
||||
|
||||
//float2 texel = 1.0 / rpWindowCoord.zw;
|
||||
float2 texel = 1.0 / float2( 1920.0, 1080.0 );
|
||||
|
||||
float2 coords = ( uv - 0.5 ) * 2.0;
|
||||
float coordDot = dot( coords, coords );
|
||||
|
||||
float2 precompute = amount * coordDot * coords;
|
||||
float2 uvR = uv - texel.xy * precompute;
|
||||
float2 uvB = uv + texel.xy * precompute;
|
||||
|
||||
float3 outColor;
|
||||
outColor.r = tex2D( samp0, uvR ).r;
|
||||
outColor.g = tex2D( samp0, uv ).g;
|
||||
outColor.b = tex2D( samp0, uvB ).b;
|
||||
|
||||
color.rgb = lerp( color.rgb, outColor, Technicolor_Amount );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// https://gpuopen.com/vdr-follow-up-fine-art-of-film-grain/
|
||||
|
@ -479,7 +506,7 @@ float rcp( float v )
|
|||
return 1.0 / v;
|
||||
}
|
||||
|
||||
void ContrastAdaptiveSharpeningPass( inout float4 fragColor )
|
||||
void ContrastAdaptiveSharpeningPass( inout float4 color )
|
||||
{
|
||||
float2 texcoord = fragment.texcoord0;
|
||||
float Sharpness = 1;
|
||||
|
@ -561,7 +588,8 @@ void ContrastAdaptiveSharpeningPass( inout float4 fragColor )
|
|||
saturate( ( b.g * wG + d.g * wG + f.g * wG + h.g * wG + e.g ) * rcpWeightG ),
|
||||
saturate( ( b.b * wB + d.b * wB + f.b * wB + h.b * wB + e.b ) * rcpWeightB ) );
|
||||
|
||||
fragColor.rgb = outColor;
|
||||
color.rgb = outColor;
|
||||
//color.rgb = lerp( color.rgb, outColor, Technicolor_Amount );
|
||||
}
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
|
@ -571,8 +599,12 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
// base color with tone mapping and other post processing applied
|
||||
float4 color = tex2D( samp0, tCoords );
|
||||
|
||||
#if USE_CAS
|
||||
ContrastAdaptiveSharpeningPass( color );
|
||||
#endif
|
||||
|
||||
#if USE_CHROMATIC_ABERRATION
|
||||
ChromaticAberrationPass( color );
|
||||
ChromaticAberrationPass2( color );
|
||||
#endif
|
||||
|
||||
#if USE_TECHNICOLOR
|
||||
|
@ -583,10 +615,6 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
VibrancePass( color );
|
||||
#endif
|
||||
|
||||
#if USE_CAS
|
||||
ContrastAdaptiveSharpeningPass( color );
|
||||
#endif
|
||||
|
||||
#if USE_DITHERING
|
||||
DitheringPass( color );
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue