-
-
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
BatchedMesh: add per-instance setOpacity #28151
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
Worth mentioning that the material used in the this.three.material = new THREE.MeshLambertMaterial({
color: 0xffffff,
transparent: true,
vertexColors: true
}); |
TBH, I don't like the idea of moving material properties to |
I get your point, yet here is how I see it:
So my take is to just converge both classes APIs so they support at least At least I think we should add |
It feels consistent to align both APIs and add @gkjohnson Are you okay with that? |
I'll defer to you but my feeling is that this is all already possible with shader overrides, etc as my prior demo shows. I'd rather see some thought put into what a more extensible API would look like to support per-object material properties. Even with InstancedMesh users were quickly asking for other material setting support if I recall correctly. If you'd just like to just add |
Thx for your feedback @Mugen87 and @gkjohnson, I will then close this PR and add just |
similar discussion here: #20431 |
Description
This PR adds per-instance
setOpacity
andgetOpacity
toBatchedMesh
.I created this PR inspired by these two threads from the forum:
https://discourse.threejs.org/t/batchedmesh-per-geometry-opacity/61284
https://discourse.threejs.org/t/batchedmesh-set-per-instance-opacity/64170
I tested it in the project I'm working on and it seems to work wonders with absolute perfect performance.
If you are fine with this implementing
setColorAt
shouldn't be too difficult, and with that theInstancedMesh
andBatchedMesh
APIs would finally converge :).Here is a video capture of it animating individually the opacity of all instances in the
BatchedMesh
with the help of gsap (the links you see in the graph are tube geometries all used in the sameBatchedMesh
):2024-04-17.23-47-32_1_4.mp4