-
-
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
Material: transparent=true has no effect on glTF materials (since r132) #22598
Comments
In the latest version you may also need to set |
Thank you @donmccurdy, your proposed solution solves the issue for the JavaScript case. Should I close the issue, though? The documentation for Material and MeshStandardMaterial does not mention the |
No. This has to be fixed. |
In the short term maybe reverting Of the alternatives I think that #22414 (comment) (or something like it) is currently my favorite, turning |
to summarise
is this correct ? |
I think Right now, GLTFLoader sets I think of |
I find this phenomenon a bit odd. Would this basically invalidate a version(s) of three.js (at least from the perspective of this feature)? Would it be possible to label some releases as "broken" or something along those lines? Ie. for all intents and purposes, if my project uses transparent objects, i might not be able to use 133, but based on the conversation here, 134 may work exactly like 132. I ran into this somewhat when working with shader chunks, some files can be pretty long lived between versions, but then could also start changing in a few consecutive versions. |
I'm new to three.js - but dropping in to say that I recently experienced this and it was a nightmare to debug - I thought it was an issue with the model. This should definitely be reverted or otherwise fixed. |
To recap briefly – When a material is opaque (which is not the same as Unfortunately, we can't solely determine whether to write alpha based on state of This brings us to a conflict — intuitively and historically, From here, a few ideas: (A) Replace (B) Ignore (C) Turn class Material {
set transparent ( transparent ) {
this.alphaMode = AlphaBlend;
this.alphaWrite = true;
this.depthWrite = false;
}
get transparent () {
return this.alphaMode === AlphaBlend && this.alphaWrite === true;
}
} If any of these are acceptable, I'm glad to open a PR. |
Indeed! I like |
Thanks for recapping this! I wanted to join the discussion but it was hard to read through the long discussion. The recap help me a lot. In the three suggestions I want to vote for |
I think (a) is not quite enough by itself — When a user loads an opaque glTF material, Longer discussion in #18631 (comment). |
OK, that makes sense to me.
That's one of the good options to me. And, I'm thinking of the option B. Although I said
I started to feel it may be ok. We already have some properties which have an effect only if some other properties have certain values, e.g. Is there any concerns of ignoring |
maybe to always draw one object after another |
I'd rather we not create any expectation that |
OK, so the option B may be good to me. What do you folks think? |
My 2 cts: Today I bumped into this issue. I was surprised to see that IMO the way it is now is very confusing and counterintuitive. I would expect materials coming from GLTF to work the same way with transparency as materials created by code by ourselves in threejs and think it's a little overkill and confusing to need to set three (!) variables on a material, just to make it transparent. |
From reading this it doesn’t sound like this interface is here to stay, it may only be present in a few versions of three, but not before or after those few versions. I imagine that without something like typescript, one of these three properties simply won’t do anything in some near future, it doesn’t sound like you would have to change code. |
Love you don! ahahah Thank you it worked for me :) |
With Three.js r132 I can no longer make my models transparent. I export Models in Blender (2.92.0) as .glb file. I then import via GLTFLoader and set the opacity in JavaScript. I am also unable to make the object transparent using the three.js editor (drag and drop .glb in the editor).
Steps to reproduce the behavior:
(expect that model ist transparent)
Code
Expected behavior
With r131, the sample project looks like this:
https://codesandbox.io/s/threejs-transparency-r131-rth6g
Screenshots
With r132, the sample project looks like this:
https://codesandbox.io/s/threejs-transparency-r132-1hs0v
Platform:
The text was updated successfully, but these errors were encountered: