diff --git a/src/Features/VR.cpp b/src/Features/VR.cpp index 1ad629ce7d..58118dd47e 100644 --- a/src/Features/VR.cpp +++ b/src/Features/VR.cpp @@ -29,7 +29,8 @@ constexpr int kOverlayHeight = 1080; NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT( VR::Settings, - EnableDepthBufferCulling, + EnableDepthBufferCullingInterior, + EnableDepthBufferCullingExterior, MinOccludeeBoxExtent, VRMenuScale, VRMenuPositioningMethod, @@ -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 //============================================================================= @@ -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."); } } } diff --git a/src/Features/VR.h b/src/Features/VR.h index 08e5f497ef..1855753cb8 100644 --- a/src/Features/VR.h +++ b/src/Features/VR.h @@ -2,7 +2,6 @@ #include "Menu.h" #include "OverlayFeature.h" #include -#include #include #include #include @@ -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; @@ -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)