From bbae3b6d48c3ab8e1c910e31edda2b671e9e4731 Mon Sep 17 00:00:00 2001 From: Michael Riegger Date: Mon, 26 Apr 2021 16:16:05 -0700 Subject: [PATCH] Slight improvements --- .../Atom/Features/PBR/Lights/PointLight.azsli | 16 +++++----------- .../CoreLights/PointLightFeatureProcessor.cpp | 2 +- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Lights/PointLight.azsli b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Lights/PointLight.azsli index 588f6419af..f803a5802c 100644 --- a/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Lights/PointLight.azsli +++ b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Lights/PointLight.azsli @@ -101,20 +101,14 @@ void ApplyPointLight(ViewSrg::PointLight light, Surface surface, inout LightingD { const float3 Directions[6] = {float3(0,0,1), float3(0,0,-1), float3(0,1,0), float3(0,-1,0), float3(1,0,0), float3(-1,0,0)}; const int shadowDirectionIndex = GetShadowDirectionIndex(surface.position, light.m_position); - - { - - litRatio *= ProjectedShadow::GetVisibility( - GetShadowIndex(light, shadowDirectionIndex), + const int shadowIndex = GetShadowIndex(light, shadowDirectionIndex); + litRatio *= ProjectedShadow::GetVisibility( + shadowIndex, light.m_position, surface.position, Directions[shadowDirectionIndex], surface.normal); - - } - - - /* + // Use backShadowRatio to carry thickness from shadow map for thick mode backShadowRatio = 1.0 - litRatio; if (o_transmission_mode == TransmissionMode::ThickObject) @@ -122,7 +116,7 @@ void ApplyPointLight(ViewSrg::PointLight light, Surface surface, inout LightingD backShadowRatio = ProjectedShadow::GetThickness( shadowIndex, surface.position); - } */ + } } diff --git a/Gems/Atom/Feature/Common/Code/Source/CoreLights/PointLightFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/CoreLights/PointLightFeatureProcessor.cpp index fcc4acc246..62af94e548 100644 --- a/Gems/Atom/Feature/Common/Code/Source/CoreLights/PointLightFeatureProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/CoreLights/PointLightFeatureProcessor.cpp @@ -234,7 +234,7 @@ namespace AZ ProjectedShadowFeatureProcessorInterface::ProjectedShadowDescriptor desc = m_shadowFeatureProcessor->GetShadowProperties(shadowId); Vector3 position = Vector3::CreateFromFloat3(pointLight.m_position.data()); - desc.m_fieldOfViewYRadians = 1.58825f; + desc.m_fieldOfViewYRadians = DegToRad(90.5f); // Make it slightly larger than 90 degrees to avoid artifacts on the boundary between 2 cubemap faces desc.m_transform = Transform::CreateLookAt(position, position + m_directions[i]); desc.m_aspectRatio = 1.0f; desc.m_nearPlaneDistance = 0.1f;