Skip to content

Conversation

mrdoob
Copy link
Owner

@mrdoob mrdoob commented Jul 31, 2025

Description

Spent some time trying to make this example look prettier.

Before After
Screenshot 2025-07-31 at 7 32 16 PM Screenshot 2025-07-31 at 7 23 44 PM

I'm still not happy with it...

I'm not sure this is the best scene to showcase AO. May be better to showcase SSR with it.

@Mugen87 Why did you pick this scene? The textures are pretty low-res, specially the tree one.
There's also a mesh with a clouds texture outside the windows that is not visible.

@Mugen87
Copy link
Collaborator

Mugen87 commented Jul 31, 2025

Please do not add too many effects at once. SSR usage here will totally kill the performance for many devices. I have now 3 FPS on my mac mini with M2 Pro. The previous version had 60 FPS. I'm curious, on what device are you testing this PR?

Besides, the SMAA usage worsens the AA quality. The previous TRAA produces an image with less aliasing.

@Mugen87 Why did you pick this scene? The textures are pretty low-res, specially the tree one.
There's also a mesh with a clouds texture outside the windows that is not visible.

I wanted to pick a room environment since to me it's ideal for showcasing AO. At the time when adding the example, I've found this one at Sketchfab and thought it's appropriate. I like the minimalistic style and other better looking assets had not the appropriate CC license.


// ao

aoPass = ao( scenePassDepth, scenePassNormal, camera );
aoPass.resolutionScale = 0.5; // running AO in half resolution is often sufficient
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would advice to revert this change as well. Half resolution AO is quite common and the performance lost running full resolution is usually not worth the quality gain.

Copy link
Owner Author

Choose a reason for hiding this comment

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

This is at 0.5:

Screen.Recording.2025-07-31.at.6.05.47.PM.mov

This is at 1.0:

Screen.Recording.2025-07-31.at.6.07.51.PM.mov

Maybe 0.25 with denoising could be better?

However, to me it's weird that the plant is producing a shadow like that in the window behind it.
The plant should be receiving light from the window and now casting a shadow in the window.

Copy link
Collaborator

Choose a reason for hiding this comment

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

A TAA performs some sort of denoising so I found a separate denoise pass is not necessarily required.

Also not that the way we apply AO at the moment means we attenuate the entire scene. A more physically correct approach would compute AO before the beauty pass and then just attenuate the indirect light. This requires a more complex setup though.

Besides, as long as transparent object write into the depth buffer, they are affected by the SSAO computation. The given window is especially challenging since although light travels through it, it can receives shadows because of its dull/milky surface. I guess the issue could be mitigate somewhat with a directional light shining through the window but that would require AO only attenuates the indirect light.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Ah I see...

Another issue I noticed with TRAA is that it requires velocity and ...

When I tried to add metalness to mrt() I ran into this:

Screenshot 2025-07-31 at 7 40 31 PM

Copy link
Collaborator

@Mugen87 Mugen87 Jul 31, 2025

Choose a reason for hiding this comment

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

I guess we have to start pack things a bit^^. We end up with too many color attachments.

@Mugen87
Copy link
Collaborator

Mugen87 commented Jul 31, 2025

BTW: I'm totally fine with replacing the asset if we find a better one. There are surly better picks. But we should try to update the example so the current performance level is retained.

@mrdoob
Copy link
Owner Author

mrdoob commented Jul 31, 2025

Please do not add too many effects at once. SSR usage here will totally kill the performance for many devices. I have now 3 FPS on my mac mini with M2 Pro. The previous version had 60 FPS. On what device are you testing this PR?

I'm using a Macbook Pro (M1 Pro)

Besides, the SMAA usage worsens the AA quality. The previous TRAA produces an image with less aliasing.

TRAA was showing continuous glitches when combined with SSR:

Screen.Recording.2025-07-31.at.6.01.20.PM.mov

@Mugen87
Copy link
Collaborator

Mugen87 commented Jul 31, 2025

Yes, the TRAA+SSR combination still requires some fine-tuning. The overall performance of SSR also needs an improvement.

@Mugen87
Copy link
Collaborator

Mugen87 commented Jul 31, 2025

@mrdoob mrdoob added this to the r180 milestone Jul 31, 2025
@mrdoob
Copy link
Owner Author

mrdoob commented Jul 31, 2025

I've reduced the AO quality, hopefully now it runs faster?

@Mugen87
Copy link
Collaborator

Mugen87 commented Jul 31, 2025

Still 4 FPS. The major performance killer is the full-resolution SSR.

@Mugen87
Copy link
Collaborator

Mugen87 commented Jul 31, 2025

I highly recommend we leave SSR out of the AO demo. The example should showcase AO with a best possible performance. If you are not happy with the asset, we can search for a new one.

@Mugen87
Copy link
Collaborator

Mugen87 commented Aug 2, 2025

Once I'm done with the DoF and blur stuff, I'll revisit the SSR. Maybe we can switch to a different implementation that gives us more stable results and a better performance. The current SSRNode is based on the previous implementation but with MRT and metalness support. When converting the code to TSL, I had not the chance the review the approach in-depth and study other SSR approaches more closely.

@mrdoob
Copy link
Owner Author

mrdoob commented Aug 3, 2025

That would be great!

@mrdoob
Copy link
Owner Author

mrdoob commented Aug 18, 2025

@Mugen87

Just updated the example using the latest SSR.
How's the performance on Pixel 8A now?

@Mugen87
Copy link
Collaborator

Mugen87 commented Aug 18, 2025

@Mugen87
Copy link
Collaborator

Mugen87 commented Aug 18, 2025

Both the Pixel 8A and the iMac with M2 Pro and 5K Display run the example with 60 FPS now 🎉 .


postProcessing.outputNode = traaPass;
ssrPass = ssr( scenePassColor, scenePassDepth, scenePassNormal, customMetalness, camera );
ssrPass.resolutionScale = 1.0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

1 is the default now so this line can be removed.

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