Shadowmap atlas is working if there are not too many lights

This commit is contained in:
Robert Beckebans 2022-03-31 22:45:29 +02:00
parent c0e4082651
commit 98368669fa
2 changed files with 4 additions and 6 deletions

View file

@ -1554,8 +1554,8 @@ void idRenderBackend::RenderInteractions( const drawSurf_t* surfList, const view
for( int i = 0; i < 6; i++ )
{
shadowOffsets[ i ].x = vLight->imageAtlasOffset[ i ].x;
shadowOffsets[ i ].y = vLight->imageAtlasOffset[ i ].y;
shadowOffsets[ i ].x = vLight->imageAtlasOffset[ i ].x * ( 1.0f / r_shadowMapAtlasSize.GetInteger() );
shadowOffsets[ i ].y = vLight->imageAtlasOffset[ i ].y * ( 1.0f / r_shadowMapAtlasSize.GetInteger() );
}
SetVertexParms( RENDERPARM_SHADOW_ATLAS_OFFSET_0, &shadowOffsets[0][0], 6 );

View file

@ -393,13 +393,11 @@ void main( PS_IN fragment, out PS_OUT result )
uvShadow.y = shadowTexcoord.y;
// [0 .. 1] -> rectangle in atlas transform
uvShadow = uvShadow * rpJitterTexScale.y; // + rpShadowAtlasOffsets[ shadowIndex ].xy
uvShadow.x += rpShadowAtlasOffsets[ shadowIndex ].x;
uvShadow.y -= rpShadowAtlasOffsets[ shadowIndex ].y;
uvShadow = uvShadow * rpJitterTexScale.y + rpShadowAtlasOffsets[ shadowIndex ].xy;
float shadow = t_ShadowAtlas.SampleCmpLevelZero( s_Shadow, uvShadow.xy, shadowTexcoord.z );
#if 1
#if 0
if( shadowIndex == 0 )
{
result.color = float4( 1.0, 0.0, 0.0, 1.0 );