-
-
Notifications
You must be signed in to change notification settings - Fork 36k
Closed
Description
Description
In webgpu_compute_particles_rain, if you modify the gui to let the user set rainParticles.count = 0, single sprites will still render periodically on screen. Ideally, we'd want the object to no longer draw to the screen if it's count is set to 0.
Untitled.video.-.Made.with.Clipchamp.2.mp4
To fix this, we always consider the count value when it is defined, rather than clamping it to 1.
getDrawParameters() {
// const instanceCount = geometry.isInstancedBufferGeometry ? geometry.instanceCount : ( object.count > 1 ? object.count : 1 );
const instanceCount = geometry.isInstancedBufferGeometry ? geometry.instanceCount : ( object.count !== undefined ? object.count : 1);
}
Now when the object.count value is set to 0, instanceCount will equal 0 and getDrawParameters() will return null, preventing the particles from drawing.
Untitled.video.-.Made.with.Clipchamp.3.mp4
EDIT: I initially found this issue while attempting to port SimonDev's Particle Tutorial over to TSL. Here is the version without the change in RenderObject.
Particles.-.Made.with.Clipchamp.mp4
And here's the version with the change:
Particles.Fixed.-.Made.with.Clipchamp.mp4
Reproduction steps
- Give the user the ability to arbitrarily set rainParticles.count to a range of 0 to maxParticles within the GUI.
Code
// code goes here
Live example
// TBD
Screenshots
No response
Version
r175
Device
Desktop
Browser
Chrome
OS
Windows
mrdoob