Merge pull request #1558 from aws-lumberyard-dev/banding
Adjust Pdo shadow map bias
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include <Atom/Features/PBR/DefaultObjectSrg.azsli>
|
||||
#include <Atom/Features/ParallaxMapping.azsli>
|
||||
#include <Atom/Features/MatrixUtility.azsli>
|
||||
#include <Atom/Features/Shadow/Shadow.azsli>
|
||||
|
||||
#include "MaterialInputs/AlphaInput.azsli"
|
||||
#include "MaterialInputs/ParallaxInput.azsli"
|
||||
@@ -73,8 +74,6 @@ PSDepthOutput MainPS(VertexOutput IN, bool isFrontFace : SV_IsFrontFace)
|
||||
|
||||
if(ShouldHandleParallaxInDepthShaders())
|
||||
{
|
||||
static const float ShadowMapDepthBias = 0.000001;
|
||||
|
||||
float3 tangents[UvSetCount] = { IN.m_tangent.xyz, IN.m_tangent.xyz };
|
||||
float3 bitangents[UvSetCount] = { IN.m_bitangent.xyz, IN.m_bitangent.xyz };
|
||||
|
||||
@@ -87,7 +86,7 @@ PSDepthOutput MainPS(VertexOutput IN, bool isFrontFace : SV_IsFrontFace)
|
||||
ObjectSrg::GetWorldMatrix(), uvMatrix, uvMatrixInverse,
|
||||
IN.m_uv[MaterialSrg::m_parallaxUvIndex], IN.m_worldPosition, OUT.m_depth);
|
||||
|
||||
OUT.m_depth += ShadowMapDepthBias;
|
||||
OUT.m_depth += PdoShadowMapBias;
|
||||
}
|
||||
|
||||
// Clip Alpha
|
||||
|
||||
@@ -121,7 +121,7 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
|
||||
ObjectSrg::GetWorldMatrix(), uvMatrix, uvMatrixInverse,
|
||||
IN.m_uv[MaterialSrg::m_parallaxUvIndex], IN.m_worldPosition, depthNDC, IN.m_position.w, displacementIsClipped);
|
||||
|
||||
// Adjust directional light shadow coorinates for parallax correction
|
||||
// Adjust directional light shadow coordinates for parallax correction
|
||||
if(o_parallax_enablePixelDepthOffset)
|
||||
{
|
||||
const uint shadowIndex = ViewSrg::m_shadowIndexDirectionalLight;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <Atom/Features/PBR/DefaultObjectSrg.azsli>
|
||||
#include <Atom/Features/ParallaxMapping.azsli>
|
||||
#include <Atom/Features/MatrixUtility.azsli>
|
||||
#include <Atom/Features/Shadow/Shadow.azsli>
|
||||
|
||||
#include "MaterialInputs/AlphaInput.azsli"
|
||||
#include "MaterialInputs/ParallaxInput.azsli"
|
||||
@@ -73,9 +74,7 @@ PSDepthOutput MainPS(VertexOutput IN, bool isFrontFace : SV_IsFrontFace)
|
||||
OUT.m_depth = IN.m_position.z;
|
||||
|
||||
if(ShouldHandleParallaxInDepthShaders())
|
||||
{
|
||||
static const float ShadowMapDepthBias = 0.000001;
|
||||
|
||||
{
|
||||
float3 tangents[UvSetCount] = { IN.m_tangent.xyz, IN.m_tangent.xyz };
|
||||
float3 bitangents[UvSetCount] = { IN.m_bitangent.xyz, IN.m_bitangent.xyz };
|
||||
PrepareGeneratedTangent(IN.m_normal, IN.m_worldPosition, isFrontFace, IN.m_uv, UvSetCount, tangents, bitangents);
|
||||
@@ -87,7 +86,7 @@ PSDepthOutput MainPS(VertexOutput IN, bool isFrontFace : SV_IsFrontFace)
|
||||
ObjectSrg::GetWorldMatrix(), uvMatrix, uvMatrixInverse,
|
||||
IN.m_uv[MaterialSrg::m_parallaxUvIndex], IN.m_worldPosition, OUT.m_depth);
|
||||
|
||||
OUT.m_depth += ShadowMapDepthBias;
|
||||
OUT.m_depth += PdoShadowMapBias;
|
||||
}
|
||||
|
||||
// Alpha
|
||||
|
||||
@@ -9,6 +9,11 @@
|
||||
|
||||
static const float EsmExponentialShift = 87.; // slightly smaller value of log(FLT_MAX)
|
||||
|
||||
// Slope-scale depth bias doesn't work with depth writes. Apply a small bias with this value so that bicubic filtering
|
||||
// won't have shadow acne
|
||||
// Longer-term, we should probably try and implement Normal Offset biasing [GFX TODO][ATOM-15846]
|
||||
static const float PdoShadowMapBias = 0.001;
|
||||
|
||||
// Must match the equivalent enumeration in ShadowConstants.h
|
||||
enum PcfFilterMethod { PcfFilterMethod_BoundarySearch = 0, PcfFilterMethod_Bicubic = 1 };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user