Visitar URL original
TRAANode: Preserve projections and align depth history jitter. by bhouston · Pull Request #35239 · mrdoob/three.js · GitHub
Skip to content

TRAANode: Preserve projections and align depth history jitter. - #35239

Closed
bhouston wants to merge 4 commits into
mrdoob:devfrom
bhouston:traa-projection-history-fix
Closed

bhouston wants to merge 4 commits into
mrdoob:devfrom
bhouston:traa-projection-history-fix

Conversation

@bhouston

@bhouston bhouston commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

TRAA currently replaces an existing camera view offset and regenerates custom projection matrices while applying jitter. Preserve the camera's projection by translating in clip space, restore it after rendering, and ignore cleanup when no jitter was applied. Also account for the previous/current projection jitter difference when sampling depth history, since velocity excludes jitter while the depth buffer includes it.

Extracted from #35228. The history-copy optimization remains separate.

Live Demo Links:
https://raw.githack.com/bhouston/three.js/traa-projection-history-fix/examples/webgpu_postprocessing_traa.html

webgpu_postprocessing_traa modified to call camera.setViewOffset( 2560, 1440, 640, 360, 1280, 720 ) (a 2× zoom into the center). Before, TRAA discards the view offset:

Before After
View offset before View offset after

Validation:

  • Rendering check: 24 frames of camera/object motion with a resize on both WebGPU and WebGL2, including six render-target readbacks per backend; no rendering or validation errors.

@bhouston
bhouston force-pushed the traa-projection-history-fix branch from 111ea08 to ff0f01e Compare October 27, 2026 16:47
@Mugen87

Mugen87 commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

This PR combines two changes.

  • Preserve existing view offsets or custom projection matrices
  • The depth history jitter.

I doubt we need the second one. The previous depth is off by at most 1 pixel because jitter stays within +-0.5 pixel per frame. TRAA's disocclusion test already tolerates that:

  • Smooth surfaces: closestDepth is the minimum depth over a 3x3 neighbourhood (±1 pixel). A sample shifted by up to 1 pixel is never closer than that minimum, so closestDepth − previousDepth > depthThreshold can't fire.
  • Silhouettes: this is the only place a 1-pixel shift crosses a depth jump and there isEdge keeps the history regardless.

So it seems the suggested code does not change the existing history decision. I would say we only fix this if there is a clear visible improvement.

@Mugen87

Mugen87 commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

Closing in favor of #35313.

@Mugen87 Mugen87 closed this Nov 2, 2026
@Mugen87 Mugen87 added this to the r188 milestone Nov 2, 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.

2 participants