Merge branch 'development' into cmake/warn_virtual
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> # Conflicts: # Gems/Atom/Feature/Common/Code/Source/Shadows/ProjectedShadowFeatureProcessor.h
This commit is contained in:
+14
-82
@@ -101,7 +101,6 @@ class DirectionalLightShadow
|
||||
// This outputs visibility ratio (from 0.0 to 1.0) for ESM+PCF.
|
||||
float GetVisibilityFromLightEsmPcf();
|
||||
|
||||
float SamplePcfBicubic();
|
||||
float SamplePcfBicubic(float3 shadowCoord, uint indexOfCascade);
|
||||
|
||||
uint m_lightIndex;
|
||||
@@ -278,70 +277,26 @@ float DirectionalLightShadow::GetVisibilityFromLightNoFilter()
|
||||
}
|
||||
|
||||
float DirectionalLightShadow::GetVisibilityFromLightPcf()
|
||||
{
|
||||
const uint predictionCount = ViewSrg::m_directionalLightShadows[m_lightIndex].m_predictionSampleCount;
|
||||
{
|
||||
static const float DepthMargin = 0.01; // avoiding artifact when near depth bounds.
|
||||
static const float PixelMargin = 1.5; // avoiding artifact between cascade levels.
|
||||
|
||||
if (predictionCount <= 1)
|
||||
const uint size = ViewSrg::m_directionalLightShadows[m_lightIndex].m_shadowmapSize;
|
||||
const uint cascadeCount = ViewSrg::m_directionalLightShadows[m_lightIndex].m_cascadeCount;
|
||||
for (uint indexOfCascade = 0; indexOfCascade < cascadeCount; ++indexOfCascade)
|
||||
{
|
||||
return GetVisibilityFromLightNoFilter();
|
||||
}
|
||||
const float3 shadowCoord = m_shadowCoords[indexOfCascade];
|
||||
|
||||
if (ViewSrg::m_directionalLightShadows[m_lightIndex].m_pcfFilterMethod == PcfFilterMethod_Bicubic)
|
||||
{
|
||||
return SamplePcfBicubic();
|
||||
}
|
||||
|
||||
const float3 lightDirection =
|
||||
normalize(SceneSrg::m_directionalLights[m_lightIndex].m_direction);
|
||||
const float4 jitterUnitVectorDepthDiffBase =
|
||||
Shadow::GetJitterUnitVectorDepthDiffBase(m_normalVector, lightDirection);
|
||||
const float3 jitterUnit = jitterUnitVectorDepthDiffBase.xyz;
|
||||
const float jitterDepthDiffBase = jitterUnitVectorDepthDiffBase.w;
|
||||
|
||||
uint shadowedCount = 0;
|
||||
uint jitterIndex = 0;
|
||||
|
||||
// Predicting
|
||||
for (; jitterIndex < predictionCount; ++jitterIndex)
|
||||
{
|
||||
if (IsShadowedWithJitter(
|
||||
jitterUnit,
|
||||
jitterDepthDiffBase,
|
||||
jitterIndex))
|
||||
if (shadowCoord.x >= 0. && shadowCoord.x * size < size - PixelMargin &&
|
||||
shadowCoord.y >= 0. && shadowCoord.y * size < size - PixelMargin &&
|
||||
shadowCoord.z < 1. - DepthMargin)
|
||||
{
|
||||
++shadowedCount;
|
||||
m_debugInfo.m_cascadeIndex = indexOfCascade;
|
||||
return SamplePcfBicubic(shadowCoord, indexOfCascade);
|
||||
}
|
||||
}
|
||||
if (shadowedCount == 0)
|
||||
{
|
||||
return 1.;
|
||||
}
|
||||
else if (shadowedCount == predictionCount)
|
||||
{
|
||||
return 0.;
|
||||
}
|
||||
|
||||
// Filtering
|
||||
|
||||
// When the prediction detects the point on the boundary of shadow,
|
||||
// i.e., both of a lit point and a a shadowed one exists in the jittering area,
|
||||
// we calculate the more precious lit ratio in the area.
|
||||
const uint filteringCount = max(
|
||||
predictionCount,
|
||||
ViewSrg::m_directionalLightShadows[m_lightIndex].m_filteringSampleCount);
|
||||
|
||||
for (; jitterIndex < filteringCount; ++jitterIndex)
|
||||
{
|
||||
if (IsShadowedWithJitter(
|
||||
jitterUnit,
|
||||
jitterDepthDiffBase,
|
||||
jitterIndex))
|
||||
{
|
||||
++shadowedCount;
|
||||
}
|
||||
}
|
||||
|
||||
return (filteringCount - shadowedCount) * 1. / filteringCount;
|
||||
m_debugInfo.m_cascadeIndex = cascadeCount;
|
||||
return 1.;
|
||||
}
|
||||
|
||||
float DirectionalLightShadow::GetVisibilityFromLightEsm()
|
||||
@@ -415,29 +370,6 @@ float DirectionalLightShadow::GetVisibilityFromLightEsmPcf()
|
||||
return 1.;
|
||||
}
|
||||
|
||||
float DirectionalLightShadow::SamplePcfBicubic()
|
||||
{
|
||||
static const float DepthMargin = 0.01; // avoiding artifact when near depth bounds.
|
||||
static const float PixelMargin = 1.5; // avoiding artifact between cascade levels.
|
||||
|
||||
const uint size = ViewSrg::m_directionalLightShadows[m_lightIndex].m_shadowmapSize;
|
||||
const uint cascadeCount = ViewSrg::m_directionalLightShadows[m_lightIndex].m_cascadeCount;
|
||||
for (uint indexOfCascade = 0; indexOfCascade < cascadeCount; ++indexOfCascade)
|
||||
{
|
||||
const float3 shadowCoord = m_shadowCoords[indexOfCascade];
|
||||
|
||||
if (shadowCoord.x >= 0. && shadowCoord.x * size < size - PixelMargin &&
|
||||
shadowCoord.y >= 0. && shadowCoord.y * size < size - PixelMargin &&
|
||||
shadowCoord.z < 1. - DepthMargin)
|
||||
{
|
||||
m_debugInfo.m_cascadeIndex = indexOfCascade;
|
||||
return SamplePcfBicubic(shadowCoord, indexOfCascade);
|
||||
}
|
||||
}
|
||||
m_debugInfo.m_cascadeIndex = cascadeCount;
|
||||
return 1.;
|
||||
}
|
||||
|
||||
float DirectionalLightShadow::SamplePcfBicubic(float3 shadowCoord, uint indexOfCascade)
|
||||
{
|
||||
const uint filteringSampleCount = ViewSrg::m_directionalLightShadows[m_lightIndex].m_filteringSampleCount;
|
||||
|
||||
+18
-91
@@ -44,8 +44,6 @@ class ProjectedShadow
|
||||
float GetVisibilityEsmPcf();
|
||||
float GetThickness();
|
||||
|
||||
float SamplePcfBicubic();
|
||||
|
||||
bool IsShadowed(float3 shadowPosition);
|
||||
bool IsShadowedWithJitter(
|
||||
float3 jitterUnitX,
|
||||
@@ -87,8 +85,7 @@ float ProjectedShadow::GetVisibility(
|
||||
shadow.SetShadowPosition();
|
||||
|
||||
float visibility = 1.;
|
||||
// Filter method is stored in top 16 bits.
|
||||
uint filterMethod = ViewSrg::m_projectedShadows[shadow.m_shadowIndex].m_shadowFilterMethod & 0x0000FFFF;
|
||||
const uint filterMethod = ViewSrg::m_projectedShadows[shadow.m_shadowIndex].m_shadowFilterMethod;
|
||||
switch (filterMethod)
|
||||
{
|
||||
case ViewSrg::ShadowFilterMethodNone:
|
||||
@@ -145,72 +142,29 @@ float ProjectedShadow::GetVisibilityNoFilter()
|
||||
|
||||
float ProjectedShadow::GetVisibilityPcf()
|
||||
{
|
||||
// PCF filter method is stored in bottom 16 bits.
|
||||
const uint pcfFilterMethod = ViewSrg::m_projectedShadows[m_shadowIndex].m_shadowFilterMethod >> 16;
|
||||
if (pcfFilterMethod == PcfFilterMethod_Bicubic)
|
||||
const uint filteringSampleCount = ViewSrg::m_projectedShadows[m_shadowIndex].m_filteringSampleCount;
|
||||
const float3 atlasPosition = GetAtlasPosition(m_shadowPosition.xy);
|
||||
|
||||
SampleShadowMapBicubicParameters param;
|
||||
param.shadowMap = PassSrg::m_projectedShadowmaps;
|
||||
param.shadowPos = float3(atlasPosition.xy * ViewSrg::m_invShadowmapAtlasSize, atlasPosition.z);
|
||||
param.shadowMapSize = ViewSrg::m_shadowmapAtlasSize;
|
||||
param.invShadowMapSize = ViewSrg::m_invShadowmapAtlasSize;
|
||||
param.comparisonValue = m_shadowPosition.z - m_bias;
|
||||
param.samplerState = SceneSrg::m_hwPcfSampler;
|
||||
|
||||
if (filteringSampleCount <= 4)
|
||||
{
|
||||
return SamplePcfBicubic();
|
||||
return SampleShadowMapBicubic_4Tap(param);
|
||||
}
|
||||
|
||||
const uint predictionCount = ViewSrg::m_projectedShadows[m_shadowIndex].m_predictionSampleCount;
|
||||
|
||||
if (predictionCount <= 1)
|
||||
else if (filteringSampleCount <= 9)
|
||||
{
|
||||
return GetVisibilityNoFilter();
|
||||
return SampleShadowMapBicubic_9Tap(param);
|
||||
}
|
||||
|
||||
const float4 jitterUnitVectorDepthDiffBase =
|
||||
Shadow::GetJitterUnitVectorDepthDiffBase(m_normalVector, m_lightDirection);
|
||||
const float3 jitterUnitY = jitterUnitVectorDepthDiffBase.xyz;
|
||||
const float3 jitterUnitX = cross(jitterUnitY, m_lightDirection);
|
||||
const float jitterDepthDiffBase = jitterUnitVectorDepthDiffBase.w;
|
||||
|
||||
uint shadowedCount = 0;
|
||||
uint jitterIndex = 0;
|
||||
|
||||
// Predicting
|
||||
for (; jitterIndex < predictionCount; ++jitterIndex)
|
||||
else
|
||||
{
|
||||
if (IsShadowedWithJitter(
|
||||
jitterUnitX,
|
||||
jitterUnitY,
|
||||
jitterDepthDiffBase,
|
||||
jitterIndex))
|
||||
{
|
||||
++shadowedCount;
|
||||
}
|
||||
return SampleShadowMapBicubic_16Tap(param);
|
||||
}
|
||||
if (shadowedCount == 0)
|
||||
{
|
||||
return 1.;
|
||||
}
|
||||
else if (shadowedCount == predictionCount)
|
||||
{
|
||||
return 0.;
|
||||
}
|
||||
|
||||
// Filtering
|
||||
|
||||
// When the prediction detects the point on the boundary of shadow,
|
||||
// i.e., both of a lit point and a a shadowed one exists in the jittering area,
|
||||
// we calculate the more precious lit ratio in the area.
|
||||
const uint filteringCount = max(
|
||||
predictionCount,
|
||||
ViewSrg::m_projectedShadows[m_shadowIndex].m_filteringSampleCount);
|
||||
|
||||
for (; jitterIndex < filteringCount; ++jitterIndex)
|
||||
{
|
||||
if (IsShadowedWithJitter(
|
||||
jitterUnitX,
|
||||
jitterUnitY,
|
||||
jitterDepthDiffBase,
|
||||
jitterIndex))
|
||||
{
|
||||
++shadowedCount;
|
||||
}
|
||||
}
|
||||
|
||||
return (filteringCount - shadowedCount) * 1. / filteringCount;
|
||||
}
|
||||
|
||||
float ProjectedShadow::GetVisibilityEsm()
|
||||
@@ -337,33 +291,6 @@ float ProjectedShadow::GetThickness()
|
||||
return 0.;
|
||||
}
|
||||
|
||||
float ProjectedShadow::SamplePcfBicubic()
|
||||
{
|
||||
const uint filteringSampleCount = ViewSrg::m_projectedShadows[m_shadowIndex].m_filteringSampleCount;
|
||||
const float3 atlasPosition = GetAtlasPosition(m_shadowPosition.xy);
|
||||
|
||||
SampleShadowMapBicubicParameters param;
|
||||
param.shadowMap = PassSrg::m_projectedShadowmaps;
|
||||
param.shadowPos = float3(atlasPosition.xy * ViewSrg::m_invShadowmapAtlasSize, atlasPosition.z);
|
||||
param.shadowMapSize = ViewSrg::m_shadowmapAtlasSize;
|
||||
param.invShadowMapSize = ViewSrg::m_invShadowmapAtlasSize;
|
||||
param.comparisonValue = m_shadowPosition.z - m_bias;
|
||||
param.samplerState = SceneSrg::m_hwPcfSampler;
|
||||
|
||||
if (filteringSampleCount <= 4)
|
||||
{
|
||||
return SampleShadowMapBicubic_4Tap(param);
|
||||
}
|
||||
else if (filteringSampleCount <= 9)
|
||||
{
|
||||
return SampleShadowMapBicubic_9Tap(param);
|
||||
}
|
||||
else
|
||||
{
|
||||
return SampleShadowMapBicubic_16Tap(param);
|
||||
}
|
||||
}
|
||||
|
||||
bool ProjectedShadow::IsShadowed(float3 shadowPosition)
|
||||
{
|
||||
static const float PixelMargin = 1.5; // avoiding artifact between cascade levels.
|
||||
|
||||
@@ -82,7 +82,7 @@ partial ShaderResourceGroup ViewSrg
|
||||
{
|
||||
float4x4 m_depthBiasMatrix;
|
||||
uint m_shadowmapArraySlice; // array slice who has shadowmap in the atlas.
|
||||
uint m_shadowFilterMethod; // Includes overall filter method in top 16 bits and pcf method in bottom 16 bits.
|
||||
uint m_shadowFilterMethod;
|
||||
float m_boundaryScale;
|
||||
uint m_predictionSampleCount;
|
||||
uint m_filteringSampleCount;
|
||||
@@ -117,8 +117,6 @@ partial ShaderResourceGroup ViewSrg
|
||||
uint m_debugFlags;
|
||||
uint m_shadowFilterMethod;
|
||||
float m_far_minus_near;
|
||||
uint m_pcfFilterMethod; // Matches with PcfFilterMethod in ShadowConstants.h
|
||||
uint m_padding[3];
|
||||
};
|
||||
|
||||
enum ShadowFilterMethod
|
||||
|
||||
-9
@@ -149,12 +149,6 @@ namespace AZ
|
||||
//! @param method filter method.
|
||||
virtual void SetShadowFilterMethod(LightHandle handle, ShadowFilterMethod method) = 0;
|
||||
|
||||
//! This sets sample count to predict boundary of shadow.
|
||||
//! @param handle the light handle.
|
||||
//! @param count Sample Count for prediction of whether the pixel is on the boundary (up to 16)
|
||||
//! The value should be less than or equal to m_filteringSampleCount.
|
||||
virtual void SetPredictionSampleCount(LightHandle handle, uint16_t count) = 0;
|
||||
|
||||
//! This sets sample count for filtering of shadow boundary.
|
||||
//! @param handle the light handle.
|
||||
//! @param count Sample Count for filtering (up to 64)
|
||||
@@ -166,9 +160,6 @@ namespace AZ
|
||||
//! If width == 0, softening edge is disabled. Units are in meters.
|
||||
virtual void SetShadowBoundaryWidth(LightHandle handle, float boundaryWidth) = 0;
|
||||
|
||||
//! Sets the shadowmap Pcf method.
|
||||
virtual void SetPcfMethod(LightHandle handle, PcfMethod method) = 0;
|
||||
|
||||
//! Sets whether the directional shadowmap should use receiver plane bias.
|
||||
//! This attempts to reduce shadow acne when using large pcf filters.
|
||||
virtual void SetShadowReceiverPlaneBiasEnabled(LightHandle handle, bool enable) = 0;
|
||||
|
||||
-4
@@ -92,12 +92,8 @@ namespace AZ
|
||||
virtual void SetShadowFilterMethod(LightHandle handle, ShadowFilterMethod method) = 0;
|
||||
//! Specifies the width of boundary between shadowed area and lit area in radians. The degree ofshadowed gradually changes on the boundary. 0 disables softening.
|
||||
virtual void SetSofteningBoundaryWidthAngle(LightHandle handle, float boundaryWidthRadians) = 0;
|
||||
//! Sets sample count to predict boundary of shadow (up to 16). It will be clamped to be less than or equal to the filtering sample count.
|
||||
virtual void SetPredictionSampleCount(LightHandle handle, uint16_t count) = 0;
|
||||
//! Sets sample count for filtering of shadow boundary (up to 64)
|
||||
virtual void SetFilteringSampleCount(LightHandle handle, uint16_t count) = 0;
|
||||
//! Sets the shadowmap Pcf (percentage closer filtering) method.
|
||||
virtual void SetPcfMethod(LightHandle handle, PcfMethod method) = 0;
|
||||
//! Sets the Esm exponent to use. Higher values produce a steeper falloff in the border areas between light and shadow.
|
||||
virtual void SetEsmExponent(LightHandle handle, float exponent) = 0;
|
||||
|
||||
|
||||
-5
@@ -73,13 +73,8 @@ namespace AZ
|
||||
//! Specifies the width of boundary between shadowed area and lit area in radians. The degree ofshadowed gradually changes on
|
||||
//! the boundary. 0 disables softening.
|
||||
virtual void SetSofteningBoundaryWidthAngle(LightHandle handle, float boundaryWidthRadians) = 0;
|
||||
//! Sets sample count to predict boundary of shadow (up to 16). It will be clamped to be less than or equal to the filtering
|
||||
//! sample count.
|
||||
virtual void SetPredictionSampleCount(LightHandle handle, uint16_t count) = 0;
|
||||
//! Sets sample count for filtering of shadow boundary (up to 64)
|
||||
virtual void SetFilteringSampleCount(LightHandle handle, uint16_t count) = 0;
|
||||
//! Sets the shadowmap Pcf (percentage closer filtering) method.
|
||||
virtual void SetPcfMethod(LightHandle handle, PcfMethod method) = 0;
|
||||
//! Sets the Esm exponent to use. Higher values produce a steeper falloff in the border areas between light and shadow.
|
||||
virtual void SetEsmExponent(LightHandle handle, float exponent) = 0;
|
||||
//! Sets all of the the point data for the provided LightHandle.
|
||||
|
||||
@@ -37,14 +37,6 @@ namespace AZ
|
||||
Count
|
||||
};
|
||||
|
||||
enum class PcfMethod : uint16_t
|
||||
{
|
||||
BoundarySearch = 0, // Performs a variable number of taps, first to determine if we are on a shadow boundary, then the remaining taps are to find the occlusion amount
|
||||
Bicubic, // Uses a fixed size Pcf kernel with kernel weights set to approximate bicubic filtering
|
||||
|
||||
Count
|
||||
};
|
||||
|
||||
namespace Shadow
|
||||
{
|
||||
// [GFX TODO][ATOM-2408] Make the max number of cascade modifiable at runtime.
|
||||
|
||||
-4
@@ -52,14 +52,10 @@ namespace AZ::Render
|
||||
virtual void SetShadowmapMaxResolution(ShadowId id, ShadowmapSize size) = 0;
|
||||
//! Sets the shadow bias
|
||||
virtual void SetShadowBias(ShadowId id, float bias) = 0;
|
||||
//! Sets the shadowmap Pcf method.
|
||||
virtual void SetPcfMethod(ShadowId id, PcfMethod method) = 0;
|
||||
//! Sets the shadow filter method
|
||||
virtual void SetShadowFilterMethod(ShadowId id, ShadowFilterMethod method) = 0;
|
||||
//! Sets the width of boundary between shadowed area and lit area.
|
||||
virtual void SetSofteningBoundaryWidthAngle(ShadowId id, float boundaryWidthRadians) = 0;
|
||||
//! Sets the sample count to predict the boundary of the shadow. Max 16, should be less than filtering sample count.
|
||||
virtual void SetPredictionSampleCount(ShadowId id, uint16_t count) = 0;
|
||||
//! Sets the sample count for filtering of the shadow boundary, max 64.
|
||||
virtual void SetFilteringSampleCount(ShadowId id, uint16_t count) = 0;
|
||||
//! Sets all of the shadow properites in one call
|
||||
|
||||
@@ -571,20 +571,6 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
void DirectionalLightFeatureProcessor::SetPredictionSampleCount(LightHandle handle, uint16_t count)
|
||||
{
|
||||
if (count > Shadow::MaxPcfSamplingCount)
|
||||
{
|
||||
AZ_Warning(FeatureProcessorName, false, "Sampling count exceed the limit.");
|
||||
count = Shadow::MaxPcfSamplingCount;
|
||||
}
|
||||
for (auto& it : m_shadowData)
|
||||
{
|
||||
it.second.GetData(handle.GetIndex()).m_predictionSampleCount = count;
|
||||
}
|
||||
m_shadowBufferNeedsUpdate = true;
|
||||
}
|
||||
|
||||
void DirectionalLightFeatureProcessor::SetFilteringSampleCount(LightHandle handle, uint16_t count)
|
||||
{
|
||||
if (count > Shadow::MaxPcfSamplingCount)
|
||||
@@ -608,15 +594,6 @@ namespace AZ
|
||||
m_shadowBufferNeedsUpdate = true;
|
||||
}
|
||||
|
||||
void DirectionalLightFeatureProcessor::SetPcfMethod(LightHandle handle, PcfMethod method)
|
||||
{
|
||||
for (auto& it : m_shadowData)
|
||||
{
|
||||
it.second.GetData(handle.GetIndex()).m_pcfMethod = method;
|
||||
}
|
||||
m_shadowBufferNeedsUpdate = true;
|
||||
}
|
||||
|
||||
void DirectionalLightFeatureProcessor::SetShadowReceiverPlaneBiasEnabled(LightHandle handle, bool enable)
|
||||
{
|
||||
m_shadowProperties.GetData(handle.GetIndex()).m_isReceiverPlaneBiasEnabled = enable;
|
||||
|
||||
@@ -102,8 +102,6 @@ namespace AZ
|
||||
uint32_t m_debugFlags = 0;
|
||||
uint32_t m_shadowFilterMethod = 0;
|
||||
float m_far_minus_near = 0;
|
||||
PcfMethod m_pcfMethod = PcfMethod::BoundarySearch;
|
||||
uint32_t m_padding[3];
|
||||
};
|
||||
|
||||
class DirectionalLightFeatureProcessor final
|
||||
@@ -218,10 +216,8 @@ namespace AZ
|
||||
void SetViewFrustumCorrectionEnabled(LightHandle handle, bool enabled) override;
|
||||
void SetDebugFlags(LightHandle handle, DebugDrawFlags flags) override;
|
||||
void SetShadowFilterMethod(LightHandle handle, ShadowFilterMethod method) override;
|
||||
void SetPredictionSampleCount(LightHandle handle, uint16_t count) override;
|
||||
void SetFilteringSampleCount(LightHandle handle, uint16_t count) override;
|
||||
void SetShadowBoundaryWidth(LightHandle handle, float boundaryWidth) override;
|
||||
void SetPcfMethod(LightHandle handle, PcfMethod method) override;
|
||||
void SetShadowReceiverPlaneBiasEnabled(LightHandle handle, bool enable) override;
|
||||
|
||||
const Data::Instance<RPI::Buffer> GetLightBuffer() const;
|
||||
|
||||
@@ -329,21 +329,11 @@ namespace AZ
|
||||
SetShadowSetting(handle, &ProjectedShadowFeatureProcessor::SetSofteningBoundaryWidthAngle, boundaryWidthRadians);
|
||||
}
|
||||
|
||||
void DiskLightFeatureProcessor::SetPredictionSampleCount(LightHandle handle, uint16_t count)
|
||||
{
|
||||
SetShadowSetting(handle, &ProjectedShadowFeatureProcessor::SetPredictionSampleCount, count);
|
||||
}
|
||||
|
||||
void DiskLightFeatureProcessor::SetFilteringSampleCount(LightHandle handle, uint16_t count)
|
||||
{
|
||||
SetShadowSetting(handle, &ProjectedShadowFeatureProcessor::SetFilteringSampleCount, count);
|
||||
}
|
||||
|
||||
void DiskLightFeatureProcessor::SetPcfMethod(LightHandle handle, PcfMethod method)
|
||||
{
|
||||
SetShadowSetting(handle, &ProjectedShadowFeatureProcessor::SetPcfMethod, method);
|
||||
}
|
||||
|
||||
void DiskLightFeatureProcessor::SetEsmExponent(LightHandle handle, float exponent)
|
||||
{
|
||||
SetShadowSetting(handle, &ProjectedShadowFeatureProcessor::SetEsmExponent, exponent);
|
||||
|
||||
@@ -54,9 +54,7 @@ namespace AZ
|
||||
void SetShadowmapMaxResolution(LightHandle handle, ShadowmapSize shadowmapSize) override;
|
||||
void SetShadowFilterMethod(LightHandle handle, ShadowFilterMethod method) override;
|
||||
void SetSofteningBoundaryWidthAngle(LightHandle handle, float boundaryWidthRadians) override;
|
||||
void SetPredictionSampleCount(LightHandle handle, uint16_t count) override;
|
||||
void SetFilteringSampleCount(LightHandle handle, uint16_t count) override;
|
||||
void SetPcfMethod(LightHandle handle, PcfMethod method) override;
|
||||
void SetEsmExponent(LightHandle handle, float esmExponent) override;
|
||||
|
||||
void SetDiskData(LightHandle handle, const DiskLightData& data) override;
|
||||
|
||||
@@ -298,21 +298,11 @@ namespace AZ
|
||||
SetShadowSetting(handle, &ProjectedShadowFeatureProcessor::SetSofteningBoundaryWidthAngle, boundaryWidthRadians);
|
||||
}
|
||||
|
||||
void PointLightFeatureProcessor::SetPredictionSampleCount(LightHandle handle, uint16_t count)
|
||||
{
|
||||
SetShadowSetting(handle, &ProjectedShadowFeatureProcessor::SetPredictionSampleCount, count);
|
||||
}
|
||||
|
||||
void PointLightFeatureProcessor::SetFilteringSampleCount(LightHandle handle, uint16_t count)
|
||||
{
|
||||
SetShadowSetting(handle, &ProjectedShadowFeatureProcessor::SetFilteringSampleCount, count);
|
||||
}
|
||||
|
||||
void PointLightFeatureProcessor::SetPcfMethod(LightHandle handle, PcfMethod method)
|
||||
{
|
||||
SetShadowSetting(handle, &ProjectedShadowFeatureProcessor::SetPcfMethod, method);
|
||||
}
|
||||
|
||||
void PointLightFeatureProcessor::SetEsmExponent(LightHandle handle, float esmExponent)
|
||||
{
|
||||
SetShadowSetting(handle, &ProjectedShadowFeatureProcessor::SetEsmExponent, esmExponent);
|
||||
|
||||
@@ -51,9 +51,7 @@ namespace AZ
|
||||
void SetShadowmapMaxResolution(LightHandle handle, ShadowmapSize shadowmapSize) override;
|
||||
void SetShadowFilterMethod(LightHandle handle, ShadowFilterMethod method) override;
|
||||
void SetSofteningBoundaryWidthAngle(LightHandle handle, float boundaryWidthRadians) override;
|
||||
void SetPredictionSampleCount(LightHandle handle, uint16_t count) override;
|
||||
void SetFilteringSampleCount(LightHandle handle, uint16_t count) override;
|
||||
void SetPcfMethod(LightHandle handle, PcfMethod method) override;
|
||||
void SetEsmExponent(LightHandle handle, float esmExponent) override;
|
||||
void SetPointData(LightHandle handle, const PointLightData& data) override;
|
||||
|
||||
|
||||
@@ -165,15 +165,6 @@ namespace AZ::Render
|
||||
m_filterParameterNeedsUpdate = true;
|
||||
}
|
||||
|
||||
void ProjectedShadowFeatureProcessor::SetPcfMethod(ShadowId id, PcfMethod method)
|
||||
{
|
||||
AZ_Assert(id.IsValid(), "Invalid ShadowId passed to ProjectedShadowFeatureProcessor::SetPcfMethod().");
|
||||
ShadowData& shadowData = m_shadowData.GetElement<ShadowDataIndex>(id.GetIndex());
|
||||
shadowData.m_pcfMethod = method;
|
||||
|
||||
m_deviceBufferNeedsUpdate = true;
|
||||
}
|
||||
|
||||
void ProjectedShadowFeatureProcessor::SetEsmExponent(ShadowId id, float exponent)
|
||||
{
|
||||
AZ_Assert(id.IsValid(), "Invalid ShadowId passed to ProjectedShadowFeatureProcessor::SetEsmExponent().");
|
||||
@@ -188,7 +179,7 @@ namespace AZ::Render
|
||||
|
||||
ShadowProperty& shadowProperty = GetShadowPropertyFromShadowId(id);
|
||||
ShadowData& shadowData = m_shadowData.GetElement<ShadowDataIndex>(id.GetIndex());
|
||||
shadowData.m_shadowFilterMethod = aznumeric_cast<uint16_t>(method);
|
||||
shadowData.m_shadowFilterMethod = aznumeric_cast<uint32_t>(method);
|
||||
|
||||
UpdateShadowView(shadowProperty);
|
||||
|
||||
@@ -207,19 +198,6 @@ namespace AZ::Render
|
||||
m_filterParameterNeedsUpdate = true;
|
||||
}
|
||||
|
||||
void ProjectedShadowFeatureProcessor::SetPredictionSampleCount(ShadowId id, uint16_t count)
|
||||
{
|
||||
AZ_Assert(id.IsValid(), "Invalid ShadowId passed to ProjectedShadowFeatureProcessor::SetPredictionSampleCount().");
|
||||
|
||||
AZ_Warning("ProjectedShadowFeatureProcessor", count <= Shadow::MaxPcfSamplingCount, "Sampling count exceed the limit.");
|
||||
count = GetMin(count, Shadow::MaxPcfSamplingCount);
|
||||
|
||||
ShadowData& shadowData = m_shadowData.GetElement<ShadowDataIndex>(id.GetIndex());
|
||||
shadowData.m_predictionSampleCount = count;
|
||||
|
||||
m_deviceBufferNeedsUpdate = true;
|
||||
}
|
||||
|
||||
void ProjectedShadowFeatureProcessor::SetFilteringSampleCount(ShadowId id, uint16_t count)
|
||||
{
|
||||
AZ_Assert(id.IsValid(), "Invalid ShadowId passed to ProjectedShadowFeatureProcessor::SetFilteringSampleCount().");
|
||||
|
||||
@@ -48,10 +48,8 @@ namespace AZ::Render
|
||||
void SetFieldOfViewY(ShadowId id, float fieldOfViewYRadians) override;
|
||||
void SetShadowmapMaxResolution(ShadowId id, ShadowmapSize size) override;
|
||||
void SetShadowBias(ShadowId id, float bias) override;
|
||||
void SetPcfMethod(ShadowId id, PcfMethod method) override;
|
||||
void SetShadowFilterMethod(ShadowId id, ShadowFilterMethod method) override;
|
||||
void SetSofteningBoundaryWidthAngle(ShadowId id, float boundaryWidthRadians) override;
|
||||
void SetPredictionSampleCount(ShadowId id, uint16_t count) override;
|
||||
void SetFilteringSampleCount(ShadowId id, uint16_t count) override;
|
||||
void SetShadowProperties(ShadowId id, const ProjectedShadowDescriptor& descriptor) override;
|
||||
const ProjectedShadowDescriptor& GetShadowProperties(ShadowId id) override;
|
||||
@@ -65,8 +63,7 @@ namespace AZ::Render
|
||||
{
|
||||
Matrix4x4 m_depthBiasMatrix = Matrix4x4::CreateIdentity();
|
||||
uint32_t m_shadowmapArraySlice = 0; // array slice who has shadowmap in the atlas.
|
||||
uint16_t m_shadowFilterMethod = 0; // filtering method of shadows.
|
||||
PcfMethod m_pcfMethod = PcfMethod::BoundarySearch; // method for performing Pcf (uint16_t)
|
||||
uint32_t m_shadowFilterMethod = 0; // filtering method of shadows.
|
||||
float m_boundaryScale = 0.f; // the half of boundary of lit/shadowed areas. (in degrees)
|
||||
uint32_t m_predictionSampleCount = 0; // sample count to judge whether it is on the shadow boundary or not.
|
||||
uint32_t m_filteringSampleCount = 0;
|
||||
|
||||
Reference in New Issue
Block a user