-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
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
Addons: Add SSRNode
.
#29597
Addons: Add SSRNode
.
#29597
Conversation
|
||
// blend SSR over beauty | ||
|
||
const outputNode = vec4( scenePass.rgb.mul( ssrPass.a.oneMinus() ).add( ssrPass.rgb.mul( ssrPass.a ) ), scenePass.a ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sunag This imitates the previous normal blending but I hope we can find an easier way to blend the reflective colors onto the beauty pass.
I think we need to add opacity support in |
Sharing my results with FPS limiter turned off.
The new approach is much more performant. 🎉🎉🎉 |
FYI @gonnavis |
Just want to confirm that the new const blurPass = premultipliedGaussianBlur( ssr.getTextureNode(), 0.5 ); The second parameter controls the intensity of the blur. IMO, a subtle blur should be sufficient for most use cases. |
Did some more testing and on Safari with enabled WebGPU the demo runs flawless with 60 FPS on the same device. But latest Chrome and even Chrome Canary have performance issues with the SSR demo. I suspect this is related to loop-heavy WGSL code. Before I report a bug at the Chromium bug tracker, I would appreciate if someone with a Mac (M processor) can test the SSR demo with Chrome and Safari. If the frame rate is slower in Chrome, it's probably the same issue. https://rawcdn.githack.com/mrdoob/three.js/dev/examples/webgpu_postprocessing_ssr.html |
Hello @Mugen87 , tried on my mac that, can run at 120 fps (Full fps?) on both Chrome and Firefox. Chrome (Just open and wait, do nothing): 85 fps Chrome (Do some rotate): 120 fps |
Oh, the low fps caused by opening the page on Chrome and Firefox simultaneously. |
Thanks for your feedback! The viewing angle influences the runtime behavior/complexity of the ray marching. However, if the FPS reacts so sensitive in Chrome, it suspect the same performance issue on your device. |
Yea I think so. |
Bug report: https://issues.chromium.org/issues/372714384 |
Related issue: #29295
Description
This PR ports
SSRPass
toWebGPURenderer
asSSRNode
. I have not ported all features yet (bouncing) since I'd like to focus on the existing open issues first.Good things first: Instead of 3 passes (beauty/depth + normals + metalness),
SSRNode
now gets its (shared) inputs with just one pass thanks to MRT (🎉 ). Besides, #21487 should be partly solved since the implementation use themetalness()
TSL function to render the actual metalness values of the materials. What's missing is some sort of attenuation during the SSR blending that depends on the metalness/roughness values.Finally,
SSRNode
performs no hierarchy traversal likeSSRPass
does for its metalness rendering which is also a plus in performance.The bad thing is that the fragment shader (to be more precise the raymarching portion) runs poorly in WGSL. On a mac Mini with M2 Pro and a 5K resolution I get just 42 FPS. With WebGL, I get the expected 60 FPS. So that needs a closer investigation. Especially since the SSR already runs at half resolution (you can tweak this via a
resolutionScale
property).I took the time to document the
ssr()
TSL function since I bet there is some room for refactoring and performance improvements. We might want to study different SSR implementations to further improve this one. Inputs from the community are welcome!