another attempt fixing the artifacts

This commit is contained in:
mnaumov
2021-05-10 17:58:12 -07:00
parent 63b3dbefa8
commit 43f87d1541
5 changed files with 11 additions and 8 deletions
@@ -163,6 +163,7 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
{
DirectionalLightShadow::GetShadowCoords(shadowIndex, IN.m_worldPosition, IN.m_shadowCoords);
}
IN.m_position.w = mul(ViewSrg::m_viewProjectionMatrix, IN.m_worldPosition).z;
}
}
@@ -268,7 +269,7 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
LightingData lightingData;
// Light iterator
lightingData.tileIterator.Init(IN.m_position.xy, IN.m_position.z, PassSrg::m_lightListRemapped, PassSrg::m_tileLightData);
lightingData.tileIterator.Init(IN.m_position, PassSrg::m_lightListRemapped, PassSrg::m_tileLightData);
lightingData.Init(surface.position, surface.normal, surface.roughnessLinear);
// Directional light shadow coordinates
@@ -324,7 +324,7 @@ PbrLightingOutput SkinPS_Common(VSOutput IN)
LightingData lightingData;
// Light iterator
lightingData.tileIterator.Init(IN.m_position.xy, IN.m_position.z, PassSrg::m_lightListRemapped, PassSrg::m_tileLightData);
lightingData.tileIterator.Init(IN.m_position, PassSrg::m_lightListRemapped, PassSrg::m_tileLightData);
lightingData.Init(surface.position, surface.normal, surface.roughnessLinear);
// Directional light shadow coordinates
@@ -195,6 +195,7 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
{
DirectionalLightShadow::GetShadowCoords(shadowIndex, IN.m_worldPosition, IN.m_shadowCoords);
}
IN.m_position.w = mul(ViewSrg::m_viewProjectionMatrix, IN.m_worldPosition).z;
}
}
@@ -303,7 +304,7 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
LightingData lightingData;
// Light iterator
lightingData.tileIterator.Init(IN.m_position.xy, IN.m_position.z, PassSrg::m_lightListRemapped, PassSrg::m_tileLightData);
lightingData.tileIterator.Init(IN.m_position, PassSrg::m_lightListRemapped, PassSrg::m_tileLightData);
lightingData.Init(surface.position, surface.normal, surface.roughnessLinear);
// Directional light shadow coordinates
@@ -125,7 +125,7 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
// ------- Depth & Parallax -------
depth = IN.m_position.w;
depth = IN.m_position.z;
bool displacementIsClipped = false;
@@ -147,6 +147,7 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
{
DirectionalLightShadow::GetShadowCoords(shadowIndex, IN.m_worldPosition, IN.m_shadowCoords);
}
IN.m_position.w = mul(ViewSrg::m_viewProjectionMatrix, IN.m_worldPosition).z;
}
}
@@ -210,7 +211,7 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
LightingData lightingData;
// Light iterator
lightingData.tileIterator.Init(IN.m_position.xy, IN.m_position.z, PassSrg::m_lightListRemapped, PassSrg::m_tileLightData);
lightingData.tileIterator.Init(IN.m_position, PassSrg::m_lightListRemapped, PassSrg::m_tileLightData);
lightingData.Init(surface.position, surface.normal, surface.roughnessLinear);
// Directional light shadow coordinates
@@ -17,13 +17,13 @@
// This class is used by forward shaders to iterate through lights (and decals) that are visible at this pixel position
class LightCullingTileIterator
{
void Init(float2 screenPos, float depth, StructuredBuffer<uint> lightListRemapped, Texture2D<uint4> tileLightDataTex)
void Init(float4 svPosition, StructuredBuffer<uint> lightListRemapped, Texture2D<uint4> tileLightDataTex)
{
m_lightListRemapped = lightListRemapped;
uint2 tileId = ComputeTileId(screenPos);
uint2 tileId = ComputeTileId(svPosition.xy);
float viewz = abs(depth);
float viewz = abs(svPosition.w);
// https://jira.agscollab.com/browse/ATOM-4198
// Replace GetDimensions() with a cbuffer uint read. Reading it from a cbuffer should be faster