Fixing parallax artifacts

This commit is contained in:
mnaumov
2021-05-10 14:24:45 -07:00
parent faf93a93f4
commit 63b3dbefa8
5 changed files with 8 additions and 8 deletions
@@ -268,7 +268,7 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
LightingData lightingData;
// Light iterator
lightingData.tileIterator.Init(IN.m_position, PassSrg::m_lightListRemapped, PassSrg::m_tileLightData);
lightingData.tileIterator.Init(IN.m_position.xy, IN.m_position.z, 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, PassSrg::m_lightListRemapped, PassSrg::m_tileLightData);
lightingData.tileIterator.Init(IN.m_position.xy, IN.m_position.z, PassSrg::m_lightListRemapped, PassSrg::m_tileLightData);
lightingData.Init(surface.position, surface.normal, surface.roughnessLinear);
// Directional light shadow coordinates
@@ -303,7 +303,7 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
LightingData lightingData;
// Light iterator
lightingData.tileIterator.Init(IN.m_position, PassSrg::m_lightListRemapped, PassSrg::m_tileLightData);
lightingData.tileIterator.Init(IN.m_position.xy, IN.m_position.z, 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.z;
depth = IN.m_position.w;
bool displacementIsClipped = false;
@@ -210,7 +210,7 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
LightingData lightingData;
// Light iterator
lightingData.tileIterator.Init(IN.m_position, PassSrg::m_lightListRemapped, PassSrg::m_tileLightData);
lightingData.tileIterator.Init(IN.m_position.xy, IN.m_position.z, 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(float4 svPosition, StructuredBuffer<uint> lightListRemapped, Texture2D<uint4> tileLightDataTex)
void Init(float2 screenPos, float depth, StructuredBuffer<uint> lightListRemapped, Texture2D<uint4> tileLightDataTex)
{
m_lightListRemapped = lightListRemapped;
uint2 tileId = ComputeTileId(svPosition.xy);
uint2 tileId = ComputeTileId(screenPos);
float viewz = abs(svPosition.w);
float viewz = abs(depth);
// https://jira.agscollab.com/browse/ATOM-4198
// Replace GetDimensions() with a cbuffer uint read. Reading it from a cbuffer should be faster