Skip to content

Improved webgpu_compute_particles example#31092

Merged
mrdoob merged 6 commits into
devfrom
compute
May 14, 2025
Merged

Improved webgpu_compute_particles example#31092
mrdoob merged 6 commits into
devfrom
compute

Conversation

@mrdoob

@mrdoob mrdoob commented May 13, 2025

Copy link
Copy Markdown
Owner

Description

Was tinkering a bit with the example and ended up with something more interesting looking/behaving and texture-less.

Screen.Recording.2025-05-13.at.8.08.53.PM.mov

@mrdoob mrdoob added this to the r177 milestone May 13, 2025
Comment thread examples/webgpu_compute_particles.html Fixed
…rt, function or class

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@sunag sunag closed this May 13, 2025
@sunag sunag reopened this May 13, 2025
@sunag

sunag commented May 13, 2025

Copy link
Copy Markdown
Collaborator

Great improvement.
What do you think about switching to Sprite instead of Mesh?

const particles = new THREE.Sprite( material );
particles.count = particleCount;
particles.frustumCulled = false;
scene.add( particles );

@mrdoob

mrdoob commented May 14, 2025

Copy link
Copy Markdown
Owner Author

@sunag Done!

@mrdoob mrdoob merged commit e04f92e into dev May 14, 2025
10 of 11 checks passed
@mrdoob mrdoob deleted the compute branch May 14, 2025 07:25
@adrianooo30

Copy link
Copy Markdown

I hate my mind.

@mrdoob

mrdoob commented May 16, 2025

Copy link
Copy Markdown
Owner Author

@sunag Was trying to set material.alphaToCoverage = true to get antialias in the alphaTestNode but doesn't seem to be working. Should it be working?

@sunag

sunag commented May 17, 2025

Copy link
Copy Markdown
Collaborator

I added shapeCircle() in the user's intention can add other kind of shapes #30300 it is compatible with alphaToCoverage.

const material = new THREE.SpriteNodeMaterial();
material.colorNode = uv().mul( colors.element( instanceIndex ) );
material.positionNode = positions.toAttribute();
material.scaleNode = size;
material.opacityNode = shapeCircle();
material.alphaToCoverage = true;
material.transparent = true;

RuthySheffi pushed a commit to RuthySheffi/three.js that referenced this pull request Jun 5, 2025
* Improved webgpu_compute_particles example.

* Indentation fix.

* Indentation fix.

* Potential fix for code scanning alert no. 3517: Unused variable, import, function or class

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* Sprite instead of Mesh.

* Clean up.

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
RuthySheffi pushed a commit to RuthySheffi/three.js that referenced this pull request Jun 5, 2025
* Improved webgpu_compute_particles example.

* Indentation fix.

* Indentation fix.

* Potential fix for code scanning alert no. 3517: Unused variable, import, function or class

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* Sprite instead of Mesh.

* Clean up.

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants