DavidHDev/react-bits

[BUG]: Particles Random Size

Closed this issue · 1 comments

Describe the issue

We want all particles to have the same size, so we set sizeRandomness={0} in the props.
However, this isn’t fully respected in the current implementation.

To fix this, I modified the vertex shader code in Particles.tsx as follows:

// Conditional point size
if (uSizeRandomness == 0.0) {
  // added by zekith
  gl_PointSize = uBaseSize;
} else {
  // Earlier only this conditional branch existed
  gl_PointSize = (uBaseSize * (1.0 + uSizeRandomness * (random.x - 0.5))) / length(mvPos.xyz);
}

This ensures that when sizeRandomness is set to 0, all particles use the same size (uBaseSize).

I’d be happy to raise a pull request if you agree with these changes.

Reproduction Link

No response

Steps to reproduce

We want all particles to have the same size, so we set sizeRandomness={0} in the props.
However, this isn’t fully respected in the current implementation.

Validations

  • I have checked other issues to see if my issue was already reported or addressed

Thanks for bringing it up, I pushed the fix you suggested, it's faster this way