From 78247b4c8a164fa776692acac8b12719b790f6cb Mon Sep 17 00:00:00 2001 From: "C. S." <76898260+Pentalimbed@users.noreply.github.com> Date: Wed, 11 Dec 2024 19:44:48 +0000 Subject: [PATCH] feat: add saturation slider for ssgi il, remove backface mult (#845) * feat: saturation slider for ssgi il * chore: bump ssgi ver * chore: more drastic IL bounce value --- .../Shaders/Features/ScreenSpaceGI.ini | 2 +- .../Shaders/ScreenSpaceGI/common.hlsli | 2 +- .../Shaders/ScreenSpaceGI/gi.cs.hlsl | 4 ++-- src/Features/ScreenSpaceGI.cpp | 14 ++++---------- src/Features/ScreenSpaceGI.h | 6 +++--- 5 files changed, 11 insertions(+), 17 deletions(-) diff --git a/features/Screen Space GI/Shaders/Features/ScreenSpaceGI.ini b/features/Screen Space GI/Shaders/Features/ScreenSpaceGI.ini index 67116d260..b889ce2cc 100644 --- a/features/Screen Space GI/Shaders/Features/ScreenSpaceGI.ini +++ b/features/Screen Space GI/Shaders/Features/ScreenSpaceGI.ini @@ -1,2 +1,2 @@ [Info] -Version = 3-0-0 \ No newline at end of file +Version = 3-0-1 \ No newline at end of file diff --git a/features/Screen Space GI/Shaders/ScreenSpaceGI/common.hlsli b/features/Screen Space GI/Shaders/ScreenSpaceGI/common.hlsli index b9532f015..6d150a394 100644 --- a/features/Screen Space GI/Shaders/ScreenSpaceGI/common.hlsli +++ b/features/Screen Space GI/Shaders/ScreenSpaceGI/common.hlsli @@ -47,7 +47,7 @@ cbuffer SSGICB : register(b1) float2 DepthFadeRange; float DepthFadeScaleConst; - float BackfaceStrength; + float GISaturation; float GIBounceFade; float GIDistanceCompensation; float GICompensationMaxDist; diff --git a/features/Screen Space GI/Shaders/ScreenSpaceGI/gi.cs.hlsl b/features/Screen Space GI/Shaders/ScreenSpaceGI/gi.cs.hlsl index d1c30ca4f..9cbb958c8 100644 --- a/features/Screen Space GI/Shaders/ScreenSpaceGI/gi.cs.hlsl +++ b/features/Screen Space GI/Shaders/ScreenSpaceGI/gi.cs.hlsl @@ -210,7 +210,7 @@ void CalculateGI( if (dot(samplePos, normalSample) > 0) normalSample = -normalSample; float frontBackMult = -dot(normalSample, sampleHorizonVec); - frontBackMult = frontBackMult < 0 ? abs(frontBackMult) * BackfaceStrength : frontBackMult; // backface + frontBackMult = frontBackMult < 0 ? 0.0 : frontBackMult; // backface if (frontBackMult > 0.f) { float3 sampleHorizonVecWS = normalize(mul(FrameBuffer::CameraViewInverse[eyeIndex], half4(sampleHorizonVec, 0)).xyz); @@ -246,7 +246,7 @@ void CalculateGI( radianceY *= rcpNumSlices; radianceY = lerp(radianceY, 0, depthFade); - radianceCoCg *= rcpNumSlices; + radianceCoCg *= rcpNumSlices * GISaturation; #endif o_ao = visibility; diff --git a/src/Features/ScreenSpaceGI.cpp b/src/Features/ScreenSpaceGI.cpp index 8e881047f..b76845c7a 100644 --- a/src/Features/ScreenSpaceGI.cpp +++ b/src/Features/ScreenSpaceGI.cpp @@ -19,7 +19,7 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT( GIRadius, Thickness, DepthFadeRange, - BackfaceStrength, + GISaturation, EnableGIBounce, GIBounceFade, GIDistanceCompensation, @@ -194,6 +194,8 @@ void ScreenSpaceGI::DrawSettings() ImGui::Separator(); } + Util::PercentageSlider("IL Saturation", &settings.GISaturation); + recompileFlag |= ImGui::Checkbox("Ambient Bounce", &settings.EnableGIBounce); if (auto _tt = Util::HoverTooltipWrapper()) ImGui::Text( @@ -208,14 +210,6 @@ void ScreenSpaceGI::DrawSettings() if (auto _tt = Util::HoverTooltipWrapper()) ImGui::Text("How much of this frame's ambient+IL get carried to the next frame as source."); } - - if (showAdvanced) { - ImGui::Separator(); - - Util::PercentageSlider("Backface Lighting Mix", &settings.BackfaceStrength); - if (auto _tt = Util::HoverTooltipWrapper()) - ImGui::Text("How bright at the back of objects is compared to the front. A small value to make up for foliage translucency."); - } } /////////////////////////////// @@ -574,7 +568,7 @@ void ScreenSpaceGI::UpdateSB() data.DepthFadeRange = settings.DepthFadeRange; data.DepthFadeScaleConst = 1 / (settings.DepthFadeRange.y - settings.DepthFadeRange.x); - data.BackfaceStrength = settings.BackfaceStrength; + data.GISaturation = settings.GISaturation; data.GIBounceFade = settings.GIBounceFade; data.GIDistanceCompensation = settings.GIDistanceCompensation; data.GICompensationMaxDist = settings.AORadius; diff --git a/src/Features/ScreenSpaceGI.h b/src/Features/ScreenSpaceGI.h index c3886ca20..9a9514433 100644 --- a/src/Features/ScreenSpaceGI.h +++ b/src/Features/ScreenSpaceGI.h @@ -58,9 +58,9 @@ struct ScreenSpaceGI : Feature float Thickness = 75.f; float2 DepthFadeRange = { 4e4, 5e4 }; // gi - float BackfaceStrength = 0.f; + float GISaturation = .9f; bool EnableGIBounce = true; - float GIBounceFade = .5f; + float GIBounceFade = .3f; float GIDistanceCompensation = 0.f; // mix float AOPower = 2.f; @@ -98,7 +98,7 @@ struct ScreenSpaceGI : Feature float2 DepthFadeRange; float DepthFadeScaleConst; - float BackfaceStrength; // + float GISaturation; // float GIBounceFade; float GIDistanceCompensation; float GICompensationMaxDist;