-
-
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
GLTFLoader: Explicitly clone ShaderMaterial properties. #12274
GLTFLoader: Explicitly clone ShaderMaterial properties. #12274
Conversation
/cc @takahirox |
Just curious to know if |
The cause of the linked bug is that ShaderMaterial does the right thing, copying everything it knows about and invoking Material.copy(). But the |
Hm, so having |
IMO, this change is good so far but I'd like to add comments into the code why we need Explicitly clone ShaderMaterial properties. And we'll also should try to fix |
Yeah. The current status of that is probably @mrdoob's comment here, that we would wait to see if people use the workflow. I don't really expect people to create spec/gloss materials manually, but importing models that use the workflow has a bit of traction. In this case, the Minecraft exporter creates spec/gloss materials (why it does that, I don't know...). So IMO the SG workflow is not something most users need to worry about when creating materials programmatically, but ideally it should work reliably when importing models. 😕
Not sure I understand — |
The problem I'm worrying is If users want to copy of SG material in their user code, they need to be aware of that they need to explicitly clone properties instead of calling So I wondered if we can enable In my mind, I have three options.
I prefer 3. so far if it won't have any problems. Probably inheriting |
Even if we do (2) or (3), it will still not be possible to clone a THREE.ShaderMaterial created from a glTF model. In addition to copying properties, we need for the This PR just corrects things so that at least the model renders correctly in the first place — cloning still does not work. |
OK, this change would be a good workaround if we add the comment why we need "Explicitly clone ShaderMaterial properties" into the code. And let's keep discussing how to solve the root issue. |
c33ba19
to
f51e228
Compare
Sounds good — done. |
Thanks guys! |
Fixes #donmccurdy/three-gltf-viewer#42 (thanks @emackey!).
The spec/gloss ShaderMaterial is pretty fragile. 😕 Maybe we will want to revisit the idea of having
MeshSGStandardMaterial
at some point?