-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
WebGLRenderer: Render transmissiveObjects in two passes. #25502
Conversation
Very supportive of this as an option 😁 With the (eventual) addition of depth peeling you should be able to get a really nice render and get rid of some artifacts like these that are missing depth: Here's a demo I made awhile ago that uses depth peeling with a transmission-like light attenuation - this uses the depth of the back faces to derive the thickness of the volume at each pixel: https://twitter.com/garrettkjohnson/status/1433267075867295753 Lowering layers to 1 will show the above artifacts you'll see in more complicated models. This shows the use with 1, 2, 3, 4 layers: |
I guess it depends on the performance impact... I would like it to be on by default. |
Do you mind adding stats.js to the amber examples? Testing them on a M2 Pro or RTX 2070 shows no difference in performance but on a Pixel 4a you can see noticeable more stuttering when moving the camera around. Does the PR version also contain the new texture filtering approach? If so, a comparison with |
Here they are: https://threejs-gltf-mosquito.glitch.me/index-r150a.html
|
Thanks for updating! Here are my numbers:
|
If we decide to go for "best possible quality" in context of the PBR implementation, we should be aware that specific materials features like transmission will be more and more problematic to use on certain low- and potentially mid-end mobile devices. On the other side, it's very difficult to provide a single PBR implementation that looks good and performs well on any device. I suspect that even |
I'm losing about 10 fps on my Pixel 3, as well -- from ~37 fps to ~27 or so. |
+1. Even MeshStandardMaterial (with none of these features) is often too expensive for painting the screen on a mobile device. I think Mozilla Hubs switches down to MeshBasicMaterial; Lambert would be plausible too. I'm interested in whether we could offer a "MeshStandardLiteMaterial" (better name needed?), with some careful approximations and feature limitations for better mobile performance. But as MeshPhysicalMaterial is our highest-end material for the latest PBR features ... the quality/performance tradeoff here seems acceptable. |
I changed it so this only happens when a material is doublesided. Hopelly these two links have the same performance: https://threejs-gltf-mosquito.glitch.me/index-r150a.html
|
a and c render in 4 FPS on my tablet (Samsung Galaxy Tab A 10.1), b renders in 2. On my laptop (HP Pavilion, AMD A8-7410 APU) they render in 26 and 20 FPS. |
Considering that the current approach (only doing this for |
+1, we (and many people out there) are developing three-js based product and aiming to support older devices. There is certainly demand for quality shaders, but it would be great to have support for lighter lower quality shaders as well.
|
So, now that this only happens with I'm also curious why there is such a difference between three.js and three-gpu-pathtracer for e.g. the dragon, @gkjohnson may know. I would think that an attenuation color and a thickness texture should get us closer than a factor of 2 difference in output color. Did we get our units wrong somewhere? |
Specified in the spec for
The Overview section mentions:
Essentially, when |
Two differences that come to mind. Currently three.js is not modeling overlap of objects using something like depth peeling - so as shown here foreground objects will appear lighter. Three.js is also, of course, not modeling changes in ray distance traversal due to refraction or internal bounces which would cause the attenuation to increase. It would be best to do a comparison with an ior of 1.0 if we want to make sure the math is correct - but without those few things I wouldn't expect the visuals with a higher ior to exactly match. |
Yeah, I'd expect differences, but not of this magnitude. I feel like either the thickness texture on this model is in the wrong units or we're interpreting it wrong. I think it's seriously off by a factor of 2. |
Try the AttenuationTest model, it has measurable thickness.
|
Specifically, the latest version of AttenuationTest has been updated since the screenshot shown in the original post on this PR. The current version features a "Sample Color" row with flat squares instead of the cubes shown above, and this correction makes it much easier to identify what shade of color is the correct color based on depth. |
FYI, after talking on the PBR call, we believe the thickness texture of the dragon model is likely incorrect, so let's fix it and compare again before trying to match the path tracers any better. |
Description
Inspired by @drcmda recent tweets, I was curious to see how it would look like if we also rendered the transmissive objects (back sided) in the transmissive pass.
Not a fan of calling this twice:
But the results are pretty good!
I'll do a couple of links to test the performance in a bit.