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
InstancingMesh: Added per instance color support #19947
Conversation
@mrdoob note that this already works, without GLSL or renderer changes, as shown in this example: three.js/examples/webgl_instancing_scatter.html Lines 101 to 105 in b5c272c
Maybe |
I looked at that example but I'm not able to follow the code. And then we have this other one: I think we need a simpler example. |
Does the approach in |
No, it is relying on the fact that existing shader code for the
I think most of the complexity has to do with turning a Mesh into InstancedMesh+InstancedBufferGeometry. calling |
What does GLTF think about this? |
To support |
As far as I can see, this PR doesn't conflict with that usage, correct? The intent of this PR is to make a nicer API for per-instance colors. |
Just for my understanding: This PR allows to use vertex colors and a color value per instance right? In any event, I like the idea of defining the instance color via |
This PR allows setting a color per-instance that multiplies the geometry vertex colors (if enabled) which multiplies the material color, etc |
I don't see any confilct, no. :) Worst case, we could always change the internal implementation of |
Thanks doob! |
I am happy to see color being added to instancing. Is there a reason for not including alpha, or at least the possibility of including the alpha channel? |
Thanks @Mugen87 . This is what I feared. Thanks for the link, it provides good insight. |
This allows doing this: