Skip to content

Add experimental water stereo fixes - #49

Draft
philpax wants to merge 1 commit into
mainfrom
issue-47-water-stereo-experimental
Draft

Add experimental water stereo fixes#49
philpax wants to merge 1 commit into
mainfrom
issue-47-water-stereo-experimental

Conversation

@philpax

@philpax philpax commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds experimental per-eye water corrections for issue #47. The WaveWorks ocean simulation is gated to one step per real frame, the planar reflection camera is re-mirrored per eye, and diagnostic toggles for screen-space water reflection are exposed. Screenshots capture per-eye water draw inputs for offline inspection.

Context

In two-pass stereo the second eye advances the WaveWorks simulation again and renders a later ocean, decorrelating sun-glint sparkle between eyes. The water planar reflection camera is mirrored once per frame for the centre pose; the water shader samples reflection maps at the pixel's own screen position, so a map rendered from the centre mirror is only valid for one view. The screen-space reflection path samples a reflection map aligned to one view; disabling it provides an A/B test for the seam.

Changes

payload/src/stereo/config.rs adds share_water_simulation, per_eye_water_reflection and disable_screen_space_water_reflection with defaults true, true, false.

payload/src/hooks/graphics_engine/scene/water.rs implements the once-per-frame simulation latch via SIMULATION_STEPPED_THIS_FRAME and begin_dispatch, re-mirrors CWaterPatchManager::m_ReflectionCamera per eye with mirrored_eye_reflection_transform, and adds apply_ssr_override with save/restore of m_EnableScreenSpaceWaterReflection. WaterDrawSnapshot and last_water_draws capture per-eye inputs for diagnostics. Unit tests verify the reflection transform.

payload/src/screenshot.rs stores [Option<WaterDrawSnapshot>; 2] in PendingWrite and emits a water field in the sidecar JSON.

payload/src/ui/render/corrections.rs exposes the three toggles in the debug UI with hover text referencing issue #47.

payload/src/hooks/graphics_engine/mod.rs widens scene to pub(crate) so the screenshot path can read water snapshots.

Testing

Tested in-game. The simulation gating and per-eye reflection re-mirror reduce the per-eye decorrelation, but the issue is not fully resolved. Further testing and analysis are required.

Notes

Experimental and incomplete. The per-eye reflection re-render requires pre-pass sharing to be carved out elsewhere. The single-pass collapse path is intentionally left on the engine centre mirror.

Closes #47

The WaveWorks ocean simulation is gated to one step per frame. The
simulation step inside the main-body water draw runs on the first water
draw of the frame and is suppressed thereafter, so both eyes render the
same archived displacement state.

The planar reflection camera is re-mirrored per eye. The water shader
samples reflection maps at the pixel's own screen position, so a map
rendered from one mirrored camera only matches one view. The engine
mirror is snapshotted on the first dispatch and the eye's rigid pose
delta is conjugated by the water-plane mirror before being applied to
the camera. Reflection pre-passes are re-rendered on the second eye when
the toggle is on.

The screen-space water reflection flag can be disabled for A/B testing.
Disabling forces the water onto the full-reflection binding; if the
per-eye mismatch disappears, the screen-space sampling is the seam.

Screenshots now capture per-eye water draw inputs. WaterDrawSnapshot
records frame, dispatch ordinal, render pass, under-water flag,
simulation time, screen-space reflection state, per-eye reflection
state, reflection camera pose, reflection pass count and texture
identities. The sidecar JSON emitted with F12 captures includes a water
field.

The debug UI exposes share_water_simulation, per_eye_water_reflection
and disable_screen_space_water_reflection. The scene module visibility
is widened to pub(crate) so the screenshot path can read the water
snapshots.

This is incomplete experimental work for #47.
@philpax
philpax force-pushed the issue-47-water-stereo-experimental branch from 887caf9 to 8ade05c Compare August 12, 2026 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Water sun-glint specular doesn't correspond between eyes in two-pass stereo

1 participant