mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2024-12-03 01:12:20 +00:00
Made interactionSM shader sampler loop to use r_shadowMapSamples many iterations
This commit is contained in:
parent
a66859f09c
commit
75d6e89876
1 changed files with 7 additions and 34 deletions
|
@ -202,46 +202,19 @@ void main( PS_IN fragment, out PS_OUT result )
|
||||||
|
|
||||||
// multiple taps
|
// multiple taps
|
||||||
|
|
||||||
#if 0
|
#if 1
|
||||||
const float2 poissonDisk2[12] = float2[](
|
|
||||||
float2(-0.326,-0.406),
|
|
||||||
float2(-0.840,-0.074),
|
|
||||||
float2(-0.696, 0.457),
|
|
||||||
float2(-0.203, 0.621),
|
|
||||||
float2( 0.962,-0.195),
|
|
||||||
float2( 0.473,-0.480),
|
|
||||||
float2( 0.519, 0.767),
|
|
||||||
float2( 0.185,-0.893),
|
|
||||||
float2( 0.507, 0.064),
|
|
||||||
float2( 0.896, 0.412),
|
|
||||||
float2(-0.322,-0.933),
|
|
||||||
float2(-0.792,-0.598)
|
|
||||||
);
|
|
||||||
float shadow = 0.0;
|
|
||||||
|
|
||||||
float shadowTexelSize = ( 1.0 / 1024.0 ) * 0.5;
|
|
||||||
for( int i = 0; i < 12; i++ )
|
|
||||||
{
|
|
||||||
int index = int( rand( shadowTexcoord.xy * 1.0 ) * 12 );
|
|
||||||
|
|
||||||
float4 shadowTexcoordOffset = float4( shadowTexcoord.xy + poissonDisk2[index] * shadowTexelSize, shadowTexcoord.z, shadowTexcoord.w );
|
|
||||||
|
|
||||||
shadow += texture( samp5, shadowTexcoordOffset.xywz);
|
|
||||||
}
|
|
||||||
|
|
||||||
shadow *= ( 1.0 / 12.0 );
|
|
||||||
|
|
||||||
#elif 1
|
|
||||||
float4 base = shadowTexcoord;
|
float4 base = shadowTexcoord;
|
||||||
|
|
||||||
base.xy += rpJitterTexScale.xy * -0.5;
|
base.xy += rpJitterTexScale.xy * -0.5;
|
||||||
|
|
||||||
float shadow = 0.0;
|
float shadow = 0.0;
|
||||||
|
|
||||||
float stepSize = 1.0 / 16.0;
|
//float stepSize = 1.0 / 16.0;
|
||||||
|
float numSamples = rpScreenCorrectionFactor.w;
|
||||||
|
float stepSize = 1.0 / numSamples;
|
||||||
|
|
||||||
float4 jitterTC = ( fragment.position * rpScreenCorrectionFactor ) + rpJitterTexOffset;
|
float4 jitterTC = ( fragment.position * rpScreenCorrectionFactor ) + rpJitterTexOffset;
|
||||||
for( int i = 0; i < 16; i++ )
|
for( float i = 0.0; i < numSamples; i += 1.0 )
|
||||||
{
|
{
|
||||||
float4 jitter = base + tex2D( samp6, jitterTC.xy ) * rpJitterTexScale;
|
float4 jitter = base + tex2D( samp6, jitterTC.xy ) * rpJitterTexScale;
|
||||||
jitter.zw = shadowTexcoord.zw;
|
jitter.zw = shadowTexcoord.zw;
|
||||||
|
@ -250,8 +223,8 @@ void main( PS_IN fragment, out PS_OUT result )
|
||||||
jitterTC.x += stepSize;
|
jitterTC.x += stepSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
shadow *= ( 1.0 / 16.0 );
|
shadow *= stepSize;
|
||||||
#else
|
#else
|
||||||
float shadow = texture( samp5, shadowTexcoord.xywz );
|
float shadow = texture( samp5, shadowTexcoord.xywz );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue