Skip to content

Commit 9776c07

Browse files
GUI overhaul WIP and reduced FSR lod bias for shadows.
1 parent 251fdc6 commit 9776c07

File tree

5 files changed

+503
-252
lines changed

5 files changed

+503
-252
lines changed

data/config/defaultLayout.ini

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ DockId=0x0000000C,0
4242
Pos=0,24
4343
Size=335,271
4444
Collapsed=0
45-
DockId=0x0000000D,0
45+
DockId=0x0000000D,1
4646

4747
[Window][###lights_window]
4848
Pos=0,24
@@ -70,15 +70,15 @@ DockId=0x00000009,0
7070

7171
[Window][Dear ImGui Demo]
7272
Pos=337,24
73-
Size=1233,1056
73+
Size=1233,758
7474
Collapsed=0
75-
DockId=0x0000000F,0
75+
DockId=0x0000000F,1
7676

7777
[Window][ Shadow]
78-
Pos=1572,561
79-
Size=348,202
78+
Pos=1572,381
79+
Size=348,382
8080
Collapsed=0
81-
DockId=0x0000000A,1
81+
DockId=0x0000000A,0
8282

8383
[Window][ Viewer##viewer_window]
8484
Pos=0,297
@@ -105,6 +105,17 @@ Collapsed=0
105105
DockId=0x0000000E,2
106106

107107
[Window][Scene Graph##scene_graph_window]
108+
Pos=0,24
109+
Size=335,271
110+
Collapsed=0
111+
DockId=0x0000000D,0
112+
113+
[Window][FPS Window]
114+
Pos=342,48
115+
Size=149,44
116+
Collapsed=0
117+
118+
[Window][###component_editor_window]
108119
Pos=0,297
109120
Size=335,404
110121
Collapsed=0
@@ -114,8 +125,8 @@ DockId=0x0000000E,0
114125
DockSpace ID=0x4BBE4C7A Window=0x4647B76E Pos=0,24 Size=1920,1056 Split=X Selected=0xE87781F4
115126
DockNode ID=0x00000005 Parent=0x4BBE4C7A SizeRef=335,1056 Split=Y Selected=0x6A2E32C2
116127
DockNode ID=0x0000000B Parent=0x00000005 SizeRef=213,677 Split=Y Selected=0x6A2E32C2
117-
DockNode ID=0x0000000D Parent=0x0000000B SizeRef=335,271 Selected=0x30110D95
118-
DockNode ID=0x0000000E Parent=0x0000000B SizeRef=335,404 Selected=0x25BC1AD3
128+
DockNode ID=0x0000000D Parent=0x0000000B SizeRef=335,271 Selected=0xA95BCB0F
129+
DockNode ID=0x0000000E Parent=0x0000000B SizeRef=335,404 Selected=0x67C27239
119130
DockNode ID=0x0000000C Parent=0x00000005 SizeRef=213,377 Selected=0x213C89B5
120131
DockNode ID=0x00000006 Parent=0x4BBE4C7A SizeRef=1583,1056 Split=X
121132
DockNode ID=0x00000001 Parent=0x00000006 SizeRef=1233,1056 Split=Y Selected=0x91EB2F4F

src/FrogRenderer2.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ FrogRenderer2::FrogRenderer2(const Application::CreateInfo& createInfo)
222222

223223
debugGpuAabbsBuffer = Fvog::Buffer(*device_, {sizeof(Fvog::DrawIndirectCommand) + sizeof(Debug::Aabb) * 100'000}, "Debug GPU AABBs");
224224

225-
debugGpuRectsBuffer = Fvog::Buffer(*device_, {sizeof(Fvog::DrawIndirectCommand) + sizeof(Debug::Rect) * 100'000}, "Deug GPU Rects");
225+
debugGpuRectsBuffer = Fvog::Buffer(*device_, {sizeof(Fvog::DrawIndirectCommand) + sizeof(Debug::Rect) * 100'000}, "Debug GPU Rects");
226226

227227
device_->ImmediateSubmit(
228228
[this](VkCommandBuffer commandBuffer)
@@ -545,7 +545,8 @@ void FrogRenderer2::OnRender([[maybe_unused]] double dt, VkCommandBuffer command
545545

546546
auto ctx = Fvog::Context(*device_, commandBuffer);
547547

548-
const float fsr2LodBias = fsr2Enable ? log2(float(renderInternalWidth) / float(renderOutputWidth)) - 1.0f : 0.0f;
548+
const auto baseBias = fsr2Enable ? log2(float(renderInternalWidth) / float(renderOutputWidth)) - 1.0f : 0.0f;
549+
const float fsr2LodBias = std::round(baseBias * 100) / 100;
549550

550551
{
551552
ZoneScopedN("Update GPU Buffers");
@@ -564,7 +565,10 @@ void FrogRenderer2::OnRender([[maybe_unused]] double dt, VkCommandBuffer command
564565

565566
// VSM lod bias corresponds to upscaling lod bias, otherwise shadows become blocky as the upscaling ratio increases.
566567
auto actualVsmUniforms = vsmUniforms;
567-
actualVsmUniforms.lodBias += fsr2LodBias;
568+
if (fsr2Enable)
569+
{
570+
actualVsmUniforms.lodBias += fsr2LodBias + 1.0f; // +1 to cancel "AA" factor and avoid too much negative bias (this should bring shadow detail to approx. pixel-scale)
571+
}
568572
vsmContext.UpdateUniforms(commandBuffer, actualVsmUniforms);
569573
ctx.Barrier();
570574
}
@@ -730,6 +734,8 @@ void FrogRenderer2::OnRender([[maybe_unused]] double dt, VkCommandBuffer command
730734
}
731735
ctx.EndRendering();
732736

737+
ctx.Barrier();
738+
733739
// VSMs
734740
{
735741
const auto debugMarker = ctx.MakeScopedDebugMarker("Virtual Shadow Maps");

src/FrogRenderer2.h

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#include "shaders/Resources.h.glsl"
2020
#include "shaders/ShadeDeferredPbr.h.glsl"
2121

22+
#include <variant>
23+
2224
// TODO: these structs should come from shared headers rather than copying them
2325
FVOG_DECLARE_ARGUMENTS(VisbufferPushConstants)
2426
{
@@ -154,15 +156,13 @@ class FrogRenderer2 final : public Application
154156
void GuiDrawDockspace(VkCommandBuffer commandBuffer);
155157
void GuiDrawFsrWindow(VkCommandBuffer commandBuffer);
156158
void GuiDrawDebugWindow(VkCommandBuffer commandBuffer);
157-
void GuiDrawBloomWindow(VkCommandBuffer commandBuffer);
158-
void GuiDrawAutoExposureWindow(VkCommandBuffer commandBuffer);
159-
void GuiDrawCameraWindow(VkCommandBuffer commandBuffer);
160159
void GuiDrawShadowWindow(VkCommandBuffer commandBuffer);
161160
void GuiDrawViewer(VkCommandBuffer commandBuffer);
162161
void GuiDrawMaterialsArray(VkCommandBuffer commandBuffer);
163162
void GuiDrawPerfWindow(VkCommandBuffer commandBuffer);
164163
void GuiDrawSceneGraph(VkCommandBuffer commandBuffer);
165164
void GuiDrawSceneGraphHelper(Utility::Node* node);
165+
void GuiDrawComponentEditor(VkCommandBuffer commandBuffer);
166166

167167
void CullMeshletsForView(VkCommandBuffer commandBuffer, const ViewParams& view, Fvog::Buffer& visibleMeshletIds, std::string_view name = "Cull Meshlet Pass");
168168
void MakeStaticSceneBuffers(VkCommandBuffer commandBuffer);
@@ -665,5 +665,12 @@ class FrogRenderer2 final : public Application
665665
ScrollingBuffer<double> accumTimes;
666666
double accumTime = 0;
667667

668-
bool showGui = true;
668+
// GUI
669+
bool showGui = true;
670+
bool showFpsInfo = true;
671+
bool showSceneInfo = false;
672+
struct CameraSelected{};
673+
struct AtmosphereSelected{};
674+
using SelectedThingyType = std::variant<std::monostate, CameraSelected, AtmosphereSelected, Utility::Node*>;
675+
SelectedThingyType selectedThingy = std::monostate{};
669676
};

0 commit comments

Comments
 (0)