-
-
Notifications
You must be signed in to change notification settings - Fork 36.2k
BatchedMesh: Enable per-instance opacity #32725
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
base: dev
Are you sure you want to change the base?
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
|
Puppeteer doesn't like my screenshot - probably because of too many random values 🤔 I'll try changing the materials used in the demo back to |
gkjohnson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just added some comments - at a high level I don't have an issue with the idea but I think there are some architectural complexities with vertex colors that make this more difficult.
Puppeteer doesn't like my screenshot - probably because of too many random values 🤔
It looks like the uploaded screenshot doesn't include any transparency. Here's the comparison downloaded from the CI artifacts:
| Commited | CI |
|---|---|
![]() |
![]() |
| @@ -1,5 +1,5 @@ | |||
| export default /* glsl */` | |||
| #if defined( USE_COLOR_ALPHA ) | |||
| #if defined( USE_COLOR_ALPHA ) || defined( USE_BATCHING_COLOR ) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like we're still unnecessarily checking for "USE_BATCHING_COLOR" below
| #ifdef USE_COLOR | ||
| vColor *= color; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens when vertex colors without alpha are used with batching color, now? The attribute will be vec3 while vColor will be set to vec4 so I'd expect this to throw an error. And if we use vec4 for a 3-element attribute then I'd expect the alpha component to default to 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review! I'll test this on Thursday.


Description
Related: #28151
This PR adds support for per-instance opacity to
BatchedMesh. The current implementation ofBatchedMeshalready uses colors with 4 components and it supports sorting. The only thing missing is to use the alpha information in the shader.I've removed the
opacityoption from the example because it no longer made sense with per-instance transparency.This contribution is funded by Cozy Giant