Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions src/Features/VR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ constexpr int kOverlayHeight = 1080;

NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(
VR::Settings,
EnableDepthBufferCulling,
EnableDepthBufferCullingInterior,
EnableDepthBufferCullingExterior,
MinOccludeeBoxExtent,
VRMenuScale,
VRMenuPositioningMethod,
Expand Down Expand Up @@ -110,10 +111,15 @@ void VR::PostPostLoad()

void VR::DataLoaded()
{
*gDepthBufferCulling = settings.EnableDepthBufferCulling;
*gDepthBufferCulling = settings.EnableDepthBufferCullingExterior;
*gMinOccludeeBoxExtent = settings.MinOccludeeBoxExtent;
}

void VR::EarlyPrepass()
{
*gDepthBufferCulling = globals::game::tes->interiorCell ? settings.EnableDepthBufferCullingInterior : settings.EnableDepthBufferCullingExterior;
}

//=============================================================================
// OVERLAY FEATURE OVERRIDES
//=============================================================================
Expand Down Expand Up @@ -551,13 +557,18 @@ namespace
auto& vr = globals::features::vr;
VR::Settings& settings = vr.settings;
if (ImGui::CollapsingHeader("General Settings", ImGuiTreeNodeFlags_DefaultOpen)) {
ImGui::Checkbox("Enable Depth Buffer Culling", &settings.EnableDepthBufferCulling);
ImGui::Checkbox("Enable Depth Buffer Culling in Exteriors", &settings.EnableDepthBufferCullingExterior);
if (auto _tt = Util::HoverTooltipWrapper()) {
ImGui::Text("Improves performance in exteriors, recommended ON.");
}
ImGui::Checkbox("Enable Depth Buffer Culling in Interiors", &settings.EnableDepthBufferCullingInterior);
if (auto _tt = Util::HoverTooltipWrapper()) {
ImGui::Text("Enables depth buffer culling for VR performance optimization.");
ImGui::Text("Improves performance in interiors, recommended OFF due to occasional visual glitches.");
}
ImGui::SliderFloat("Min Occludee Box Extent", &settings.MinOccludeeBoxExtent, 0.0f, 1000.0f, "%.1f");
if (ImGui::SliderFloat("Min Occludee Box Extent", &settings.MinOccludeeBoxExtent, 0.0f, 1000.0f, "%.1f"))
*vr.gMinOccludeeBoxExtent = settings.MinOccludeeBoxExtent;
if (auto _tt = Util::HoverTooltipWrapper()) {
ImGui::Text("Minimum box extent for occlusion culling in VR.");
ImGui::Text("Minimum bounding box dimensions for object occlusion culling. Lower values improve performance but may result in visual artifacts.");
}
}
}
Expand Down
7 changes: 4 additions & 3 deletions src/Features/VR.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include "Menu.h"
#include "OverlayFeature.h"
#include <algorithm>
#include <atomic>
#include <d3d11.h>
#include <imgui_impl_dx11.h>
#include <magic_enum.hpp>
Expand Down Expand Up @@ -281,6 +280,7 @@ struct VR : OverlayFeature

virtual void PostPostLoad() override;
virtual void DataLoaded() override;
virtual void EarlyPrepass() override;

virtual void LoadSettings(json& o_json) override;
virtual void SaveSettings(json& o_json) override;
Expand Down Expand Up @@ -312,8 +312,9 @@ struct VR : OverlayFeature
struct Settings
{
// Performance optimization settings
bool EnableDepthBufferCulling = true; ///< Enable depth buffer culling for VR performance
float MinOccludeeBoxExtent = 10.0f; ///< Minimum bounding box size for occlusion culling
bool EnableDepthBufferCullingExterior = true; ///< Enable depth buffer culling for VR performance
bool EnableDepthBufferCullingInterior = false;
float MinOccludeeBoxExtent = 10.0f; ///< Minimum bounding box size for occlusion culling

// VR Menu Overlay positioning settings
float VRMenuScale = Config::kDefaultMenuScale; ///< Scale factor for overlay UI (0.5-2.0)
Expand Down