-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
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
WebGPURenderer: Instance Sprite Example #29503
WebGPURenderer: Instance Sprite Example #29503
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
This is a thing of beauty. ❤️ I have hacked your example to test some scaling issues... A Plane and a Sprite of unit size render the same size by design. So should a single instanced Sprite. Currently the instanced Sprite is too big by a factor of two. This is because the geometry is twice as big. I temporarily fix it by scaling the uniform, but you will have to scale the geometry instead. |
Thanks! 😊 I’ve scaled the geometry accordingly, so it should be now fixed. |
Do you think Granted, you can add the property and it works. const sprites = new InstancedSprites( geometry, material );
sprites.center = new THREE.Vector2( 0.5, 0 ); |
We can already make instanced sprites, this would be an additional redundancy in the library, more code, documentation and maintenance, const material = new THREE.SpriteNodeMaterial( { sizeAttenuation: true, map: sprite, alphaMap: sprite, alphaTest: 0.1, transparent: true } );
material.positionNode = instancedBufferAttribute( new THREE.InstancedBufferAttribute( new Float32Array( positions ), 3 ) );
const particles = new THREE.Sprite( material );
particles.count = 10000;
scene.add( particles ); |
Could we use the |
Ahh, we all forgot about this obvious one. That's why you're the boss 😄. Updated the PR consequently. |
The nodes allow so many combinations. It also took me a while to process this possibility, luckily the implementation has evolved this far 🙏. |
The original purpose of this PR was to add But What is the plan for:
|
My initial idea was just rendering multiples sprites but I understand these elements are importants. I can still cherry pick my previous commit if we want to add a new Class in the future with all these functions included just like InstancedMesh. |
@RenaudRohlinger I do think your original PR was excellent. |
@WestLangley These possibilities also came to my mind, but I think we should upgrade these apporachs based on GPU-Compute and abandon approchs using CPU. We could handle some internal rules using |
Related comment: #29491 (comment)
Description
Third attempt to provide a fallback for THREE.Points with sizeAttenuation support. This PR demonstrates how to combine Sprite Meshes with
instanceBufferAttribute
. /cc @WestLangleyThis contribution is funded by Segments.AI & Utsubo