optional Vivecraft VR post-processing compatibility (fix: https://github.com/FoundryMC/Veil/issues/91 )#143
optional Vivecraft VR post-processing compatibility (fix: https://github.com/FoundryMC/Veil/issues/91 )#143DarkFoxYT wants to merge 10 commits into
Conversation
This branch keeps the light changes focused on buffer correctness and instance upload cost. It does not change the voxel shadow grid or the point/area light fragment shaders. ## ImGuiMC Renderer Fix - Updated ImGuiMC to `1.2.4`. - Added Fabric and NeoForge compatibility mixins for `foundry.imgui.impl.renderer.v0.ImGuiRendererGL33`. - Fixed ImGuiMC 1.2.x shader compilation on NVIDIA/OpenGL 3.3 by replacing the invalid GLSL 130 version line that included the `core` profile suffix. - This prevents ImGui from failing to compile its vertex/fragment shaders during startup. ## Sodium 0.8.12 Compatibility - Updated the Sodium dependency to `0.8.12-alpha.3+mc1.21.1`. - Adjusted Fabric and NeoForge Sodium compat to use Sodium's current `RenderSectionManager` rebuild scheduling path. ## Light Instance Buffer Optimization - Added a lightweight revision counter to `LightData`. - Point and area light setters now mark their light data dirty when position, color, brightness, size, radius, angle, distance, orientation, or occlusion changes. - `InstancedLightRenderer` now tracks the previous visible-light order and each light's uploaded revision. - If the visible light order changes, or the GL instance buffer is resized, Veil still uploads the full visible light buffer. - If the visible light order is unchanged, only lights whose data revision changed are uploaded with `glBufferSubData`. - This keeps the current rendering model intact while avoiding full instance-buffer uploads for static lights. ## Indirect Sphere Compute Shader Fix - Fixed NVIDIA GLSL compile errors in `veil:light/indirect_sphere`. - `gl_GlobalInvocationID` is unsigned, while Veil's light buffer offsets and command buffer indexes are signed integers. - The shader now converts the invocation ID math once and uses `int` for buffer indexing, avoiding implicit `int` to `uint` casts that NVIDIA rejects.
|
I like this one, hyped for them to merge this! |
- Added an optional Vivecraft bridge that detects Vivecraft reflectively and only activates during Vivecraft left/right eye passes. - Kept normal non-VR Veil rendering on the existing path. - Added per-eye post, dynamic, bloom, light, and temporary composite framebuffer isolation. - Cached per-eye VR framebuffers and dynamic wrappers so they are reused until the eye target size changes. - Added performance-oriented VR quality caps for post, bloom, and light buffers, while keeping bloom visible for first-person held items in VR and normal desktop rendering. - Resolved post/light work against Vivecraft's active eye target instead of assuming the vanilla main framebuffer owns the headset image. - Added Sodium/Iris/Embeddium detection logs and a config-controlled Sodium-compatible Vivecraft eye-target fallback. - Added configurable VR debug counters for frame time, post time, framebuffer resize/create counts, blit/copy counts, and fallback usage. - Added optional CSV frame-time history output for VR profiling. ### Why VR needs this Vivecraft renders left and right eyes as separate camera passes. Sharing color, depth, normals, light buffers, velocity, or temporal history across eyes causes stereo mismatch, screen-stuck lighting, cutouts, and nausea-inducing artifacts. The compatibility path keeps shader authoring unchanged by feeding existing Veil shaders per-eye framebuffers, matrices, camera position, and viewport size. ### Performance and compatibility notes - VR buffers are rebuilt only when the active eye size changes. - `optimizeVrPerformance` caps VR post, bloom, and light-buffer scales to reduce headset pixel cost; users can disable it for higher quality captures. - Per-eye dynamic framebuffer wrappers are pooled to avoid allocation/free churn during eye switches. - Vivecraft VR initialized/active state is cached per render frame to avoid repeated reflective checks from every post stage. - Veil light dynamic buffers stay warm while lights exist in the world, avoiding shader/buffer churn when visible lights briefly leave the frustum. - Voxel shadow-grid setup is skipped for DDA light passes that do not have occlusion-enabled lights. - Isolated auto-clear framebuffers are cleared only if used that frame. - Post resolves are counted and routed to the active Vivecraft eye target. - Frame-time logs report last/average/min/max frame milliseconds plus estimated FPS when `debugVRPerformance` is enabled. - Sodium/Embeddium fallback behavior is optional and logged once when used. - First-person bloom capture uses the first-person depth target before compositing back into the normal main target, so held items can glow without being clipped by world depth. ### Testing - Launch without Vivecraft and confirm normal post-processing behavior is unchanged. - Launch with Vivecraft installed but VR inactive and confirm the VR path stays dormant. - Launch in Vivecraft VR with and without Sodium, enable `debugVRPerformance`, and verify left/right buffer creation stops after the initial eye-size setup. - Test Veil lights, bloom, first-person bloom, temporal effects, and GUI/world compositing.
|
so uhh latest commit is just for like better performance and compat with bloom and stuff in fp and in vr and having other stuff like sodium not crash when vr is active. Small changes but mainly just issue fixing XD fixes this too btw #107 |
|
oh btw i wanna slide in a quick note, the fps is capped due to the refresh rate of the headset, vivecraft does that by it'self and it is completeley normal, just saying! |
The issue was that Veil always skipped Minecraft’s vanilla particles_target setup in Fabulous mode, even when Veil dynamic buffers were not actually active. Particles then rendered into the wrong target and disappeared during Fabulous compositing. I changed it so vanilla target setup/clear runs unless Veil is truly replacing that framebuffer state. I also corrected the clear hook to wrap clearRenderState() instead of accidentally wrapping setup twice.
quick fix for issue #144The issue was that Veil always skipped Minecraft’s vanilla particles_target setup in Fabulous mode, even when Veil dynamic buffers were not actually active. Particles then rendered into the wrong target and disappeared during Fabulous compositing. I changed it so vanilla target setup/clear runs unless Veil is truly replacing that framebuffer state. I also corrected the clear hook to wrap clearRenderState() instead of accidentally wrapping setup twice. |
|
Can't wait for a possible fix for the Fabulous graphics issue so I can finally see particles behind colored glass 🥹 |
|
Updated the optional Vivecraft VR compatibility work with a cleaner, lower-noise debug path and improved documentation. Changes:
Validation:
|
Optional Vivecraft VR Post-Processing Compatibility
Overview
This PR introduces an optional
VeilVRCompatintegration layer that enables VR-aware post-processing when running alongside Vivecraft, while fully preserving Veil’s existing rendering pipeline for standard desktop gameplay.The integration is entirely reflective, meaning Veil does not require a hard Vivecraft dependency. VR-specific behavior only activates during active Vivecraft stereo eye rendering (
LEFT/RIGHTrender passes). Outside of VR rendering, Veil continues using its normal framebuffer, post-processing, and dynamic buffer workflow unchanged.Key Features
VR-Aware Rendering Path
veil:postthrough isolated left/right eye post-processing framebuffers.Per-Eye Lighting & Buffer Isolation
This avoids stereo mismatches, ghosting, reprojection issues, and other VR rendering artifacts.
VR-Safe Rendering State Handling
Automatic VR Uniform Support
Post shaders automatically receive VR-aware uniforms:
VeilIsVRVeilEyeIndexVeilViewMatrixVeilProjectionMatrixVeilInverseViewMatrixVeilInverseProjectionMatrixVeilCameraPositionVeilViewportSizeAdditional VR safety uniforms/fallbacks are also provided for:
Why Per-Eye Rendering Matters
Vivecraft renders the scene independently for each eye. Sharing framebuffer data between eyes can introduce severe stereo artifacts, including:
This integration isolates eye-specific rendering resources while preserving the existing Veil shader authoring workflow. Existing shaders continue to function normally and automatically receive the correct eye-specific framebuffer state, matrices, viewport data, and camera information without requiring separate shader variants.
Non-VR Behavior
The VR compatibility layer remains completely dormant unless all of the following conditions are true:
LEFTorRIGHTWhen those conditions are not met:
Configuration
New client configuration options added to
config/veil-client.json:enableVrCompatibilityusePerEyePostProcessingdisableMotionBlurInVRreduceDistortionInVRvrPostQualitydebugVREyeBuffersVR-Specific Adjustments
Default VR Safety Behavior
Per-Eye Resource Isolation
The following systems are isolated per eye during stereo rendering:
Dynamic Buffer Improvements
Lighting Compatibility
Limitations
Veil*ScaleVR safety uniforms.1.21.1with Yarn mappings and should still be validated in real headset testing scenarios.ps: i just wanted to have veil have vr support for horror mod lol but if it ain't gona be used i hope ya don't mind if i use this version for myself, but i tested and it works for fabric and neoforge so like yeah... also according to this it would be peak so like i made it XD #91