Skip to content

Commit

Permalink
feat: add saturation slider for ssgi il, remove backface mult (#845)
Browse files Browse the repository at this point in the history
* feat: saturation slider for ssgi il

* chore: bump ssgi ver

* chore: more drastic IL bounce value
  • Loading branch information
Pentalimbed authored Dec 11, 2024
1 parent ab4f713 commit 78247b4
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[Info]
Version = 3-0-0
Version = 3-0-1
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ cbuffer SSGICB : register(b1)
float2 DepthFadeRange;
float DepthFadeScaleConst;

float BackfaceStrength;
float GISaturation;
float GIBounceFade;
float GIDistanceCompensation;
float GICompensationMaxDist;
Expand Down
4 changes: 2 additions & 2 deletions features/Screen Space GI/Shaders/ScreenSpaceGI/gi.cs.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -246,7 +246,7 @@ void CalculateGI(
radianceY *= rcpNumSlices;
radianceY = lerp(radianceY, 0, depthFade);

radianceCoCg *= rcpNumSlices;
radianceCoCg *= rcpNumSlices * GISaturation;
#endif

o_ao = visibility;
Expand Down
14 changes: 4 additions & 10 deletions src/Features/ScreenSpaceGI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(
GIRadius,
Thickness,
DepthFadeRange,
BackfaceStrength,
GISaturation,
EnableGIBounce,
GIBounceFade,
GIDistanceCompensation,
Expand Down Expand Up @@ -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(
Expand All @@ -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.");
}
}

///////////////////////////////
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/Features/ScreenSpaceGI.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -98,7 +98,7 @@ struct ScreenSpaceGI : Feature
float2 DepthFadeRange;
float DepthFadeScaleConst;

float BackfaceStrength; //
float GISaturation; //
float GIBounceFade;
float GIDistanceCompensation;
float GICompensationMaxDist;
Expand Down

0 comments on commit 78247b4

Please sign in to comment.