diff --git a/Source/Engine/Level/Actors/DirectionalLight.cpp b/Source/Engine/Level/Actors/DirectionalLight.cpp index 38ac0407d..b34eaecbc 100644 --- a/Source/Engine/Level/Actors/DirectionalLight.cpp +++ b/Source/Engine/Level/Actors/DirectionalLight.cpp @@ -35,6 +35,7 @@ void DirectionalLight::Draw(RenderContext& renderContext) data.ShadowsDepthBias = ShadowsDepthBias; data.ShadowsSharpness = ShadowsSharpness; data.VolumetricScatteringIntensity = VolumetricScatteringIntensity; + data.IndirectLightingIntensity = IndirectLightingIntensity; data.CastVolumetricShadow = CastVolumetricShadow; data.RenderedVolumetricFog = 0; data.ShadowsMode = ShadowsMode; diff --git a/Source/Engine/Level/Actors/PointLight.cpp b/Source/Engine/Level/Actors/PointLight.cpp index 04024e480..6bceaba93 100644 --- a/Source/Engine/Level/Actors/PointLight.cpp +++ b/Source/Engine/Level/Actors/PointLight.cpp @@ -131,6 +131,7 @@ void PointLight::Draw(RenderContext& renderContext) data.SourceRadius = SourceRadius; data.SourceLength = SourceLength; data.ContactShadowsLength = ContactShadowsLength; + data.IndirectLightingIntensity = IndirectLightingIntensity; data.IESTexture = IESTexture ? IESTexture->GetTexture() : nullptr; renderContext.List->PointLights.Add(data); } diff --git a/Source/Engine/Level/Actors/SkyLight.cpp b/Source/Engine/Level/Actors/SkyLight.cpp index 6bab5440b..bc2035a23 100644 --- a/Source/Engine/Level/Actors/SkyLight.cpp +++ b/Source/Engine/Level/Actors/SkyLight.cpp @@ -112,6 +112,7 @@ void SkyLight::Draw(RenderContext& renderContext) data.CastVolumetricShadow = CastVolumetricShadow; data.RenderedVolumetricFog = 0; data.AdditiveColor = AdditiveColor.ToVector3() * (AdditiveColor.A * brightness); + data.IndirectLightingIntensity = IndirectLightingIntensity; data.Radius = GetScaledRadius(); data.Image = GetSource(); renderContext.List->SkyLights.Add(data); diff --git a/Source/Engine/Level/Actors/SpotLight.cpp b/Source/Engine/Level/Actors/SpotLight.cpp index 234786e3c..229dfe1e4 100644 --- a/Source/Engine/Level/Actors/SpotLight.cpp +++ b/Source/Engine/Level/Actors/SpotLight.cpp @@ -182,6 +182,7 @@ void SpotLight::Draw(RenderContext& renderContext) data.CosOuterCone = _cosOuterCone; data.InvCosConeDifference = _invCosConeDifference; data.ContactShadowsLength = ContactShadowsLength; + data.IndirectLightingIntensity = IndirectLightingIntensity; data.IESTexture = IESTexture ? IESTexture->GetTexture() : nullptr; Vector3::Transform(Vector3::Up, GetOrientation(), data.UpVector); data.OuterConeAngle = outerConeAngle; diff --git a/Source/Engine/Renderer/GI/GlobalSurfaceAtlasPass.cpp b/Source/Engine/Renderer/GI/GlobalSurfaceAtlasPass.cpp index b1c9095f0..c67709a6f 100644 --- a/Source/Engine/Renderer/GI/GlobalSurfaceAtlasPass.cpp +++ b/Source/Engine/Renderer/GI/GlobalSurfaceAtlasPass.cpp @@ -786,6 +786,7 @@ bool GlobalSurfaceAtlasPass::Render(RenderContext& renderContext, GPUContext* co const bool useShadow = CanRenderShadow(renderContext.View, light); // TODO: test perf/quality when using Shadow Map for directional light (ShadowsPass::Instance()->LastDirLightShadowMap) instead of Global SDF trace light.SetupLightData(&data.Light, useShadow); + data.Light.Color *= light.IndirectLightingIntensity; data.LightShadowsStrength = 1.0f - light.ShadowsStrength; context->UpdateCB(_cb0, &data); context->SetState(_psDirectLighting0); @@ -813,6 +814,7 @@ bool GlobalSurfaceAtlasPass::Render(RenderContext& renderContext, GPUContext* co // Draw draw light const bool useShadow = CanRenderShadow(renderContext.View, light); light.SetupLightData(&data.Light, useShadow); + data.Light.Color *= light.IndirectLightingIntensity; data.LightShadowsStrength = 1.0f - light.ShadowsStrength; context->UpdateCB(_cb0, &data); context->SetState(_psDirectLighting1); @@ -840,6 +842,7 @@ bool GlobalSurfaceAtlasPass::Render(RenderContext& renderContext, GPUContext* co // Draw draw light const bool useShadow = CanRenderShadow(renderContext.View, light); light.SetupLightData(&data.Light, useShadow); + data.Light.Color *= light.IndirectLightingIntensity; data.LightShadowsStrength = 1.0f - light.ShadowsStrength; context->UpdateCB(_cb0, &data); context->SetState(_psDirectLighting1); diff --git a/Source/Engine/Renderer/RenderList.h b/Source/Engine/Renderer/RenderList.h index 589a1162c..43b6daab2 100644 --- a/Source/Engine/Renderer/RenderList.h +++ b/Source/Engine/Renderer/RenderList.h @@ -34,6 +34,7 @@ struct RendererDirectionalLightData float ShadowsSharpness; float VolumetricScatteringIntensity; + float IndirectLightingIntensity; int8 CastVolumetricShadow : 1; int8 RenderedVolumetricFog : 1; @@ -72,6 +73,7 @@ struct RendererSpotLightData float CosOuterCone; float InvCosConeDifference; float ContactShadowsLength; + float IndirectLightingIntensity; ShadowsCastingMode ShadowsMode; int8 CastVolumetricShadow : 1; @@ -106,6 +108,7 @@ struct RendererPointLightData float SourceLength; float ContactShadowsLength; + float IndirectLightingIntensity; ShadowsCastingMode ShadowsMode; int8 CastVolumetricShadow : 1; @@ -126,6 +129,7 @@ struct RendererSkyLightData float Radius; Vector3 AdditiveColor; + float IndirectLightingIntensity; int8 CastVolumetricShadow : 1; int8 RenderedVolumetricFog : 1;