Skip to content

fix(TAA): restore VR per-eye reprojection and opaque alpha#84

Merged
alandtse merged 2 commits into
devfrom
fix/taa-vr-reprojection-alpha
Jun 3, 2026
Merged

fix(TAA): restore VR per-eye reprojection and opaque alpha#84
alandtse merged 2 commits into
devfrom
fix/taa-vr-reprojection-alpha

Conversation

@alandtse
Copy link
Copy Markdown
Owner

@alandtse alandtse commented Jun 3, 2026

Problem

Upstream PR community-shaders#2399 (fix(TAA): banding and oversharpening, commit 7cc80382) replaced the high-level TAA implementation with a faithful SE decompile transcription. The unified math is correct (it matches the VR decompile too), but the rewrite dropped two VR-specific behaviors that Open Shaders' combined-eye render target depends on, breaking TAA in VR.

Fixes (both #ifdef VR-only — SE path is byte-identical)

  1. Per-eye reprojection. Vanilla VR renders eyes to separate targets, so plain texCoord + velocity is safe there. Open Shaders packs both eyes into one RT, so a pixel near the x=0.5 seam sampled the other eye's history → cross-eye ghosting. Restored Stereo::ApplyVelocityToUV + the per-eye history clamp via GetPreviousDynamicResolutionAdjustedScreenPosition, and fed its mono-space out-of-bounds flag into the history reject (the stereo-space [0,1] test missed the seam).

  2. Output alpha. The surviving VR branch wrote colorOut.w = allTransparent ? 1 : 0, so opaque pixels (nearly the whole frame) got alpha 0. Restored the vanilla decompile behavior (o0.w = 1) on both editions.

Notes

  • This is fundamentally an upstream VR regression; the fix is self-contained and could be PR'd to community-shaders so the fork resyncs cleanly.
  • The upstream HDR banding/oversharpen fix is untouched.

Validation

  • fxc ps_5_0 clean (exit 0, no warnings) across flat / VR / HDR / VR+HDR permutations.
  • Deployed via COPY_SHADERS to SE + VR Data dirs; in-game VR verification pending.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced temporal anti-aliasing stability for VR headsets with improved reprojection and out-of-bounds handling.
    • Refined alpha channel processing for more consistent visual quality across all rendering modes.

PR community-shaders#2399 (upstream) replaced the high-level TAA implementation with a
faithful SE decompile transcription, but dropped two VR-specific behaviors
that Open Shaders' combined-eye render target depends on:

1. Per-eye reprojection. Vanilla VR renders eyes to separate targets, so
   plain texCoord+velocity is safe there; Open Shaders packs both eyes in
   one RT, so a pixel near the x=0.5 seam sampled the other eye's history
   (cross-eye ghosting). Restored Stereo::ApplyVelocityToUV plus the
   per-eye history clamp via GetPreviousDynamicResolutionAdjustedScreen-
   Position, and fed its mono-space out-of-bounds flag into the history
   reject (the stereo-space [0,1] test missed the seam).

2. Output alpha. The VR branch wrote colorOut.w = allTransparent ? 1 : 0,
   so opaque pixels (nearly the whole frame) got alpha 0. Restored the
   vanilla decompile behavior (o0.w = 1) on both editions.

Both changes are guarded by #ifdef VR; the SE path is byte-identical.
Validated with fxc ps_5_0 across flat / VR / HDR / VR+HDR permutations.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 3, 2026 05:08
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 3, 2026

Review Change Stack

Warning

Review limit reached

@alandtse, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 52 minutes and 47 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c765301d-8e90-442e-aee3-e06476ab05b9

📥 Commits

Reviewing files that changed from the base of the PR and between 2e32ec2 and 882b9d8.

📒 Files selected for processing (1)
  • package/Shaders/ISTemporalAA.hlsl
📝 Walkthrough

Walkthrough

This PR adds VR-specific stereo reprojection and disocclusion detection to temporal anti-aliasing. The shader now conditionally applies per-eye history UV reprojection via VR helpers, uses per-eye out-of-bounds flags instead of SE-only clamping for mask rejection, and consistently outputs opaque alpha.

Changes

VR Temporal Anti-Aliasing Support

Layer / File(s) Summary
VR History Reprojection Setup
package/Shaders/ISTemporalAA.hlsl
Includes Common/VR.hlsli and branches on VR flag to compute per-eye previous UVs via Stereo::ApplyVelocityToUV and derive history sample positions using FrameBuffer::GetPreviousDynamicResolutionAdjustedScreenPosition, while the non-VR path retains the prior motionReject.zw + ClampHistoryUV logic.
VR Disocclusion Detection and Opaque Output
package/Shaders/ISTemporalAA.hlsl
VR path sets motionReject.z from per-eye prevUVOutOfBounds for disocclusion masking; non-VR path uses component-wise UV comparisons. Alpha output is changed to always write colorOut.w = 1 (opaque), removing the prior VR-conditional behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes


In the halls of shaders bright and true,
We trace the rays through screens of two,
Each eye now knows where history flows,
VR reprojection reaps what code sows. ✨🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(TAA): restore VR per-eye reprojection and opaque alpha' accurately summarizes the main changes: restoring VR-specific reprojection behavior and fixing the alpha output behavior in the temporal anti-aliasing shader.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/taa-vr-reprojection-alpha

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 3, 2026

No actionable suggestions for changed features.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Restores VR-specific Temporal AA behavior in ISTemporalAA.hlsl to prevent cross-eye history sampling when using a combined-eye render target, and to ensure the TAA output alpha matches vanilla expectations.

Changes:

  • Add VR-only per-eye reprojection via Stereo::ApplyVelocityToUV and feed its mono-space out-of-bounds result into history rejection.
  • Use FrameBuffer::GetPreviousDynamicResolutionAdjustedScreenPosition for VR history UV clamping to keep clamping per-eye under dynamic resolution.
  • Write opaque alpha unconditionally (colorOut.w = 1) for both SE and VR paths.

Condense the reprojection/reject why-comments per CLAUDE.md concise-comment
guidance. Comment-only; compiled bytecode unchanged across all permutations.
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.

2 participants