Better SSAO + added shader reloading in debug

This commit is contained in:
antopilo
2024-11-23 19:46:39 -05:00
parent 1782f18f26
commit dd46e32bee
8 changed files with 210 additions and 342 deletions

View File

@@ -642,6 +642,10 @@ namespace Nuake {
{
texture = Engine::GetCurrentScene()->m_SceneRenderer->GetGBuffer().GetTexture(GL_COLOR_ATTACHMENT6);
}
else if (SelectedViewport == 6)
{
texture = Engine::GetCurrentScene()->GetEnvironment()->mSSAO->GetOuput()->GetTexture();
}
ImVec2 imagePos = ImGui::GetWindowPos() + ImGui::GetCursorPos();
Input::SetEditorViewportSize(m_ViewportPos, viewportPanelSize);
@@ -1964,7 +1968,7 @@ namespace Nuake {
ImGui::PushStyleColor(ImGuiCol_FrameBg, IM_COL32(20, 20, 20, 0));
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, IM_COL32(20, 20, 20, 60));
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, IM_COL32(33, 33, 33, 45));
const char* items[] = { "Shaded", "Albedo", "Normal", "Depth", "Velocity", "UV"};
const char* items[] = { "Shaded", "Albedo", "Normal", "Depth", "Velocity", "UV", "SSAO"};
ImGui::SetNextItemWidth(128);
if (ImGui::BeginCombo("##Output", items[SelectedViewport]))
{
@@ -2496,6 +2500,14 @@ namespace Nuake {
}
}
#ifdef NK_DEBUG
// Shader reloading
if (ImGui::IsKeyPressed(ImGuiKey_F1, false))
{
ShaderManager::RebuildShaders();
}
#endif
pInterface.m_CurrentProject = Engine::GetProject();
uint32_t selectedEntityID;

View File

@@ -912,7 +912,7 @@ void EditorSelectionPanel::DrawFile(Ref<Nuake::File> file)
ImGui::Text("SSAO Strength");
ImGui::TableNextColumn();
ImGui::DragFloat("##SSAOStrength", &env->mSSAO->Strength, 0.1f, 0.0f, 10.0f);
ImGui::DragFloat("##SSAOStrength", &env->mSSAO->Strength, 0.01f, 0.01f, 10.0f);
ImGui::TableNextColumn();
// Reset button
@@ -928,13 +928,13 @@ void EditorSelectionPanel::DrawFile(Ref<Nuake::File> file)
ImGui::Text("SSAO Radius");
ImGui::TableNextColumn();
ImGui::DragFloat("##SSAORadius", &env->mSSAO->Radius, 0.001f, 0.0f, 1.0f);
ImGui::DragFloat("##SSAORadius", &env->mSSAO->Radius, 0.01f, 0.0f, 10.0f);
ImGui::TableNextColumn();
// Reset button
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1, 1, 1, 0));
std::string resetRadius = ICON_FA_UNDO + std::string("##resetRadius");
if (ImGui::Button(resetRadius.c_str())) env->mSSAO->Radius = 0.5f;
if (ImGui::Button(resetRadius.c_str())) env->mSSAO->Radius = 1.0f;
ImGui::PopStyleColor();
}
@@ -944,45 +944,13 @@ void EditorSelectionPanel::DrawFile(Ref<Nuake::File> file)
ImGui::Text("SSAO Bias");
ImGui::TableNextColumn();
ImGui::DragFloat("##SSAOBias", &env->mSSAO->Bias, 0.0001f, 0.0f, 0.5f);
ImGui::DragFloat("##SSAOBias", &env->mSSAO->Bias, 0.0001f, 0.00001f, 0.5f);
ImGui::TableNextColumn();
// Reset button
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1, 1, 1, 0));
std::string resetBloomThreshold = ICON_FA_UNDO + std::string("##resetSSAOBias");
if (ImGui::Button(resetBloomThreshold.c_str())) env->mSSAO->Bias = 0.025f;
ImGui::PopStyleColor();
}
ImGui::TableNextColumn();
{
// Title
ImGui::Text("SSAO Area");
ImGui::TableNextColumn();
ImGui::DragFloat("##SSAOArea", &env->mSSAO->Area, 0.0001f, 0.0f, 0.5f);
ImGui::TableNextColumn();
// Reset button
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1, 1, 1, 0));
std::string resetBloomThreshold = ICON_FA_UNDO + std::string("##resetSSAOArea");
if (ImGui::Button(resetBloomThreshold.c_str())) env->mSSAO->Area = 0.0075f;
ImGui::PopStyleColor();
}
ImGui::TableNextColumn();
{
// Title
ImGui::Text("SSAO Falloff");
ImGui::TableNextColumn();
ImGui::DragFloat("##SSAOFalloff", &env->mSSAO->Falloff, 0.0001f, 0.0f, 0.5f);
ImGui::TableNextColumn();
// Reset button
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1, 1, 1, 0));
std::string resetBloomThreshold = ICON_FA_UNDO + std::string("##resetSSAOFalloff");
if (ImGui::Button(resetBloomThreshold.c_str())) env->mSSAO->Falloff = 0.0022f;
if (ImGui::Button(resetBloomThreshold.c_str())) env->mSSAO->Bias = 0.001f;
ImGui::PopStyleColor();
}