Skip to content

Conversation

@WestLangley
Copy link
Collaborator

Related issue: #25819

Transmission, as implemented in three.js, requires either opaque scene objects, a skybox, or an opaque scene background to serve as a source of light.

Light is transmitted and attenuated from behind the model towards the camera. If there is no light, there is no color.

Consequently, the rendering will be incorrect if the background is transparent. It will also be incorrect even if there is a CSS background, since the CSS background is not accessible to the renderer.

One workaround is to enure an opaque background is present during the transmission calculation.

There are trade-offs involved. This PR is a proof of concept for discussion.

Before:
Before

After:
After

@github-actions
Copy link

github-actions bot commented Apr 18, 2023

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
634 kB (157.2 kB) 634.1 kB (157.2 kB) +124 B

🌳 Bundle size after tree-shaking

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

Filesize dev Filesize PR Diff
425.2 kB (103.1 kB) 425.3 kB (103.1 kB) +158 B

@WestLangley
Copy link
Collaborator Author

If it is important to be able to see the CSS through the transmissive object, I can modify this proof-of-concept.

After 2:
After 2

@mrdoob
Copy link
Owner

mrdoob commented Apr 20, 2023

/ping @elalish

@elalish
Copy link
Contributor

elalish commented Apr 21, 2023

@WestLangley Yes, I'd love to see how you achieved the transparent object transmitting the background. Can you update the PR here so we can see that version and test it? The current one does not seem to transmit the background through at all.

@elalish
Copy link
Contributor

elalish commented Apr 24, 2023

Thanks, this is great. What I notice as the primary differences between this and #25819 is that this PR properly reduces to the thin transmission model when thickness -> 0, retaining the specular highlights, which #25819 does not. Conversely, in #25819 as attenuationDistance -> 0, the model becomes correctly fully opaque, while this PR it transmits just as much of the background. However, I think the two approaches may yet be compatible, so I'm going to see if I can manage something that's the best of both worlds in #25819.

@WestLangley
Copy link
Collaborator Author

Closed, and replaced by a mergeable PR.

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.

3 participants