Skip to content
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

Alpha blended transmission #377

Open
vorg opened this issue May 31, 2024 · 1 comment
Open

Alpha blended transmission #377

vorg opened this issue May 31, 2024 · 1 comment
Labels
type/fix A bug fix
Milestone

Comments

@vorg
Copy link
Member

vorg commented May 31, 2024

In the previous version of pex-renderer we could combine transmission with alpha blending and have reflective glass 50% faded out based on baseColor.a opacity. That is no longer possible. Setting alpha blending disables transmission. What does the glTF spec says here?

@vorg vorg added the type/fix A bug fix label May 31, 2024
@dmnsgn
Copy link
Member

dmnsgn commented May 31, 2024

https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_transmission#blend-mode

The glTF alphaMode is used for alpha-as-coverage, NOT for physically-based transparency (i.e. this extension). If alpha-as-coverage is not being used, the blend mode of the material should be set to "OPAQUE" even though it is transparent. Again, it's helpful to think of alpha-as-coverage as whether the physical surface is there or not. transmission applies to the surface material that exists. Note that alpha-as-coverage can still be used along with transmission as shown in the example below.

But filament and three.js allow alpha:

https://github.com/mrdoob/three.js/blob/f0f0e195e16490dac58520cdae23a9feee7547f5/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js#L31

https://github.com/mrdoob/three.js/blob/f0f0e195e16490dac58520cdae23a9feee7547f5/src/renderers/shaders/ShaderChunk/opaque_fragment.glsl.js#L7

google/filament@25a8291

@dmnsgn dmnsgn added this to the 5.0.0 milestone Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/fix A bug fix
Projects
None yet
Development

No branches or pull requests

2 participants