Skip to content

TRAANode: New TRAA implementation. #31421

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 16, 2025
Merged

TRAANode: New TRAA implementation. #31421

merged 6 commits into from
Jul 16, 2025

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Jul 15, 2025

Fixed #29842.

Description

The PR implements what has been suggested in #31361 (comment). TRAAPassNode is transformed to TRAANode so it is not an alternative to PassNode anymore. Now, you render a scene as always with pass() node and the common MRT settings. traa() is now added in the pass chain like ao(), ssr() or bloom() which makes it much more practical to use.

I've directly updated the AO demo to use TRAA instead of MSAA which brings the framerate back to 60 and also improves the overall AA quality.

@sunag I have not found yet an elegant way to integrate TRAA into PostProcessing. Right now, a separate call postProcessing.setTRAANode( traaNode ); is required to tell PostProcessing TRAA is in place. That is required so in render() the view offset (Jitter) can properly be configured. Is there a way to traverse the FX nodes so we can automatically detect an instance of TRAANode in PostProcessing?

Copy link

github-actions bot commented Jul 15, 2025

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 338.01
78.83
338.01
78.83
+0 B
+0 B
WebGPU 557.41
154.27
557.94
154.37
+528 B
+93 B
WebGPU Nodes 556.33
154.05
556.86
154.17
+528 B
+116 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 469.26
113.53
469.26
113.53
+0 B
+0 B
WebGPU 633.24
171.4
633.24
171.4
+0 B
+0 B
WebGPU Nodes 588.38
160.72
588.38
160.72
+0 B
+0 B

@sunag
Copy link
Collaborator

sunag commented Jul 15, 2025

@Mugen87 Why is there a vibration in the rendering now? I'm using pixel ratio 1, and it's quite noticeable.

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Jul 15, 2025

It seems on dev, TRAAPassNode is broken since #31361 on my system with dpr of 2. And #31416 seems to broke the colors for the second cube. It currently looks like so:

image

I'll try to fix TRAANode before looking into TRAAPassNode but it seems the latest changes require more testing.

@sunag
Copy link
Collaborator

sunag commented Jul 15, 2025

Maybe it's best to revert the #31361 PR for now. I have to check what happened, but opening it now I noticed that it's quite different.

If this PR takes a long time...

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Jul 15, 2025

Sounds good! I'm not sure how long it takes to fix the instability issue.

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Jul 15, 2025

Okay, the vibration should be fixed now. The behavior is now as before.

@sunag
Copy link
Collaborator

sunag commented Jul 15, 2025

Okay, the vibration should be fixed now. The behavior is now as before.

Thanks @Mugen87.

I introduced onBeforePostProcessing() and onAfterPostProcessing() in the context of PostProcessing. They should be called after the second render, since the first one is still in the final stage of setup. I had to add a needsPostProcessingSync flag in TRAA to "synchronize" the first frame, but I'm not sure if it's the best way to fix this bug.

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Jul 16, 2025

It's definitely a step forward compared to my initial approach since TRAANode is now less coupled with PostProcessing.

@Mugen87 Mugen87 added this to the r179 milestone Jul 16, 2025
@Mugen87 Mugen87 merged commit 71f36f2 into mrdoob:dev Jul 16, 2025
9 checks passed
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.

TRAAPassNode: Incomplete MRT support.
2 participants