Skip to content

Fix Oculus stencil and first-person depth ordering - #731

Draft
DecoderCoder wants to merge 2 commits into
MCModderAnchor:1.20.1from
DecoderCoder:1.20.1-render-compat-fixes
Draft

Fix Oculus stencil and first-person depth ordering#731
DecoderCoder wants to merge 2 commits into
MCModderAnchor:1.20.1from
DecoderCoder:1.20.1-render-compat-fixes

Conversation

@DecoderCoder

@DecoderCoder DecoderCoder commented Aug 3, 2026

Copy link
Copy Markdown

What changed

  • Provision the main render target's stencil attachment during TACZ's existing Oculus compatibility initialization.
  • Register TACZ's shared gun item ID with Oculus through Forge IMC so it uses the late first-person hand pass.

Why

The first scoped-weapon draw previously called RenderTarget.enableStencil() in the middle of hand rendering. Forge can recreate the main color and depth attachments at that point, after Oculus and Distant Horizons have cached the old depth texture. Provisioning stencil before Oculus constructs its pipeline makes later render-time calls no-ops.

With Separate Entity Draws enabled, translucent player models are intentionally drawn after the solid hand pass. Registering the gun for Oculus's existing late hand pass prevents nearby players from compositing over the weapon and scope.

Standalone compatibility

The IMC message contains only the existing gun ResourceLocation and is sent only on the physical client. TACZ has no compile-time Oculus dependency; absent or older Oculus builds ignore it, dedicated servers are unchanged, and shaders-disabled rendering keeps the vanilla path.

Validation

  • Full packaged build passed on Java 17 against Forge 1.20.1-47.4.22
  • PR source compile passed with no custom version change
  • Stencil/depth correction runtime-tested by the reporter
  • Paired Oculus late-hand scope/stencil smoke test still requested

Refs #519
Refs Asek3/Oculus#797

Prevent the first scope render from recreating main depth attachments after Oculus and Distant Horizons cache them.
@DecoderCoder
DecoderCoder force-pushed the 1.20.1-render-compat-fixes branch from 1bb2dc5 to a03d39b Compare August 4, 2026 08:11
Register the shared gun item through Forge IMC so delayed player models cannot composite over first-person weapons.
@DecoderCoder
DecoderCoder force-pushed the 1.20.1-render-compat-fixes branch from 9b77877 to c54bc80 Compare August 10, 2026 13:56
@DecoderCoder DecoderCoder changed the title fix(oculus): provision stencil before render Fix Oculus stencil and first-person depth ordering Aug 10, 2026
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.

1 participant