Skip to content

Commit f3a2ec5

Browse files
committed
Merge branch 'dev'
2 parents ecf4997 + 0cc51b8 commit f3a2ec5

File tree

13 files changed

+46
-60
lines changed

13 files changed

+46
-60
lines changed

assets/models/qx50.glb

2.17 MB
Binary file not shown.

assets/shaders/Accumulate.comp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ void main() {
4242

4343
vec4 src = imageLoad(NewSourceImage, ipos);
4444

45-
bool isEvenFrame = Camera.TotalFrames % 2 == 0;
45+
bool isEvenFrame = Camera.TotalFrames % 2 == 0 ? true : false;
4646

4747
bool useHistory = true;
4848
vec4 final = src;
4949
vec2 motion = imageLoad(MotionVectorImage, ipos).rg;
5050
ivec2 previpos = ivec2( floor(ipos + motion) );
51-
const bool inside = all(lessThan(previpos, ivec2(Camera.ViewportRect.xy + Camera.ViewportRect.zw))) && all(greaterThanEqual(previpos, ivec2(Camera.ViewportRect.xy)));
52-
const bool check = length(motion) > 0.01;
51+
const bool inside = all(lessThan(previpos, ivec2(Camera.ViewportRect.xy + Camera.ViewportRect.zw))) && all(greaterThanEqual(previpos, ivec2(Camera.ViewportRect.xy) + ivec2(-1,-1)));
52+
const bool check = length(motion) > 0.01 ? true : false;
5353
// fetch visibility to validate the history
5454
uint current_primitive_index = isEvenFrame ? imageLoad(VisibilityBuffer, ipos).r : imageLoad(Visibility1Buffer, ipos).r;
5555
if(Camera.TotalFrames == 0 || !inside)
@@ -127,14 +127,17 @@ void main() {
127127
imageStore(AccumulateImage, ipos, final);
128128
}
129129

130-
uint realInstanceId = FetchPrimitiveIndex(current_primitive_index);
131-
if(realInstanceId == Camera.SelectedId)
130+
if(Camera.ShowEdge)
132131
{
133-
if( EdgeDetect(current_primitive_index, isEvenFrame, ipos ) )
132+
uint realInstanceId = FetchPrimitiveIndex(current_primitive_index);
133+
if(realInstanceId == Camera.SelectedId)
134134
{
135-
//final.rgb = vec3(1,0.05,0) * Camera.PaperWhiteNit;
135+
if( EdgeDetect(current_primitive_index, isEvenFrame, ipos ) )
136+
{
137+
final.rgb = vec3(1,1,0.05) * Camera.PaperWhiteNit;
138+
}
136139
}
137140
}
138-
141+
139142
imageStore(OutImage, ipos, vec4( final.rgb, 1.0 ));
140143
}

assets/shaders/Compose.comp

Lines changed: 0 additions & 30 deletions
This file was deleted.

assets/shaders/common/UniformBufferObject.glsl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ struct UniformBufferObject
4343
uint AdaptiveSteps;
4444
glbool TAA;
4545
uint SelectedId;
46+
glbool ShowEdge;
4647

4748
float BFSigma;
4849
float BFSigmaLum;

src/Options.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Options::Options(const int argc, const char* argv[])
2323
("bounces", value<uint32_t>(&Bounces)->default_value(4), "The general limit number of bounces per ray.")
2424
("max-bounces", value<uint32_t>(&MaxBounces)->default_value(10), "The maximum bounces per ray.")
2525
("temporal", value<uint32_t>(&Temporal)->default_value(32), "The number of temporal frames.")
26-
("denoiser", bool_switch(&Denoiser)->default_value(true), "Use Denoiser.")
26+
("nodenoiser", bool_switch(&NoDenoiser)->default_value(false), "Not Use Denoiser.")
2727
("adaptivesample", bool_switch(&AdaptiveSample)->default_value(false), "use adaptive sample to improve render quality.")
2828

2929
;

src/Options.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Options final
2424
bool Benchmark{};
2525
bool SaveFile{};
2626
bool RenderDoc{};
27-
bool Denoiser{};
27+
bool NoDenoiser{};
2828
bool ForceSDR{};
2929
std::string locale{};
3030

src/Runtime/Application.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,15 @@ UserSettings CreateUserSettings(const Options& options)
134134
userSettings.UseCheckerBoardRendering = false;
135135
userSettings.TemporalFrames = options.Benchmark ? 256 : options.Temporal;
136136

137-
userSettings.Denoiser = options.Denoiser;
137+
userSettings.Denoiser = options.Benchmark ? false : !options.NoDenoiser;
138138

139139
userSettings.PaperWhiteNit = 600.f;
140140

141141
userSettings.SunRotation = 0.5f;
142142
userSettings.SunLuminance = 500.f;
143143
userSettings.SkyIntensity = 100.f;
144144

145-
userSettings.AutoFocus = false;
145+
userSettings.RequestRayCast = false;
146146

147147
userSettings.DenoiseSigma = 0.5f;
148148
userSettings.DenoiseSigmaLum = 10.0f;
@@ -341,7 +341,7 @@ Assets::UniformBufferObject NextRendererApplication::GetUniformBufferObject(cons
341341
Assets::RayCastResult rayResult {};
342342
renderer_->GetLastRaycastResult(rayResult);
343343

344-
if( userSettings_.AutoFocus )
344+
if( userSettings_.RequestRayCast )
345345
{
346346
if(rayResult.Hitted )
347347
{
@@ -354,7 +354,7 @@ Assets::UniformBufferObject NextRendererApplication::GetUniformBufferObject(cons
354354
}
355355

356356
// only active one frame
357-
userSettings_.AutoFocus = false;
357+
userSettings_.RequestRayCast = false;
358358
}
359359

360360
userSettings_.HitResult = rayResult;
@@ -399,6 +399,11 @@ Assets::UniformBufferObject NextRendererApplication::GetUniformBufferObject(cons
399399
ubo.BFSigmaNormal = userSettings_.DenoiseSigmaNormal;
400400
ubo.BFSize = userSettings_.Denoiser ? userSettings_.DenoiseSize : 0;
401401

402+
#if WITH_EDITOR
403+
ubo.ShowEdge = true;
404+
#endif
405+
406+
402407
// Other Setup
403408
renderer_->supportDenoiser_ = userSettings_.Denoiser;
404409
renderer_->visualDebug_ = userSettings_.ShowVisualDebug;
@@ -504,7 +509,7 @@ void NextRendererApplication::OnRendererPostRender(VkCommandBuffer commandBuffer
504509

505510
//Renderer::visualDebug_ = userSettings_.ShowVisualDebug;
506511

507-
userInterface_->Render(commandBuffer, imageIndex, stats, renderer_->GpuTimer(), scene_.get());
512+
userInterface_->Render(commandBuffer, renderer_->SwapChain(), imageIndex, stats, renderer_->GpuTimer(), scene_.get());
508513
}
509514

510515
void NextRendererApplication::OnKey(int key, int scancode, int action, int mods)
@@ -593,7 +598,7 @@ void NextRendererApplication::OnMouseButton(const int button, const int action,
593598
{
594599
if( glm::distance(pressMousePos_, mousePos_) < 1.0f )
595600
{
596-
userSettings_.AutoFocus = true;
601+
userSettings_.RequestRayCast = true;
597602
}
598603
}
599604
#endif

src/Runtime/UserInterface.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ UserInterface::UserInterface(
127127
const Vulkan::DepthBuffer& depthBuffer,
128128
UserSettings& userSettings,
129129
Vulkan::RenderImage& viewportImage) :
130-
swapChain_(swapChain),
131130
userSettings_(userSettings)
132131

133132
{
@@ -197,8 +196,6 @@ UserInterface::UserInterface(
197196
const auto scaleFactor = window.ContentScale();
198197
#endif
199198

200-
201-
//ImGui::StyleColorsDark();
202199
MainWindowStyle();
203200
ImGui::GetStyle().ScaleAllSizes(scaleFactor);
204201

@@ -398,7 +395,7 @@ void UserInterface::ToolbarUI()
398395
ImGui::End();
399396
}
400397

401-
void UserInterface::Render(VkCommandBuffer commandBuffer, uint32_t imageIdx, const Statistics& statistics, Vulkan::VulkanGpuTimer* gpuTimer, Assets::Scene* scene)
398+
void UserInterface::Render(VkCommandBuffer commandBuffer, const Vulkan::SwapChain& swapChain, uint32_t imageIdx, const Statistics& statistics, Vulkan::VulkanGpuTimer* gpuTimer, Assets::Scene* scene)
402399
{
403400
GUserInterface = this;
404401

@@ -427,7 +424,7 @@ void UserInterface::Render(VkCommandBuffer commandBuffer, uint32_t imageIdx, con
427424
ImGuiID id = DockSpaceUI();
428425
ToolbarUI();
429426
ImGuiDockNode* node = ImGui::DockBuilderGetCentralNode(id);
430-
swapChain_.UpdateEditorViewport(Utilities::Math::floorToInt(node->Pos.x - viewport->Pos.x), Utilities::Math::floorToInt(node->Pos.y - viewport->Pos.y), Utilities::Math::ceilToInt(node->Size.x), Utilities::Math::ceilToInt(node->Size.y));
427+
swapChain.UpdateEditorViewport(Utilities::Math::floorToInt(node->Pos.x - viewport->Pos.x), Utilities::Math::floorToInt(node->Pos.y - viewport->Pos.y), Utilities::Math::ceilToInt(node->Size.x), Utilities::Math::ceilToInt(node->Size.y));
431428
MainWindowGUI(*editorGUI_, scene, statistics, id, firstRun);
432429
#else
433430
DrawSettings();

src/Runtime/UserInterface.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class UserInterface final
6767
Vulkan::RenderImage& viewportImage);
6868
~UserInterface();
6969

70-
void Render(VkCommandBuffer commandBuffer, uint32_t imageIdx, const Statistics& statistics, Vulkan::VulkanGpuTimer* gpuTimer, Assets::Scene* scene);
70+
void Render(VkCommandBuffer commandBuffer, const Vulkan::SwapChain& swapChain, uint32_t imageIdx, const Statistics& statistics, Vulkan::VulkanGpuTimer* gpuTimer, Assets::Scene* scene);
7171

7272
bool WantsToCaptureKeyboard() const;
7373
bool WantsToCaptureMouse() const;
@@ -85,7 +85,6 @@ class UserInterface final
8585
ImGuiID DockSpaceUI();
8686
void ToolbarUI();
8787

88-
const Vulkan::SwapChain& swapChain_;
8988
void DrawSettings();
9089
void DrawOverlay(const Statistics& statistics, Vulkan::VulkanGpuTimer* gpuTimer);
9190
void DrawIndicator(uint32_t frameCount);

src/Runtime/UserSettings.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ struct UserSettings final
3232
float RawFieldOfView;
3333
float Aperture;
3434
float FocusDistance;
35-
bool AutoFocus;
35+
bool RequestRayCast;
3636

3737
float SkyRotation;
3838
float SunRotation;

0 commit comments

Comments
 (0)