This is my first post so I would like to say hi and that I love what you guys have done with babylonjs. I am a big fan of it.
I would like to raise a bug related to sizeGradient.
According to the documentation:
https://doc.babylonjs.com/babylon101/particles
To add a size gradient just call the following code particleSystem.addSizeGradient(0, 0.5); The first parameter defines the gradient (0 means at the particle birth and 1 means at particle death). The second parameter is the factor to apply to particle initial size.
In reality the value of the sizeGradient is used as the size rather than a multiplier/factor on the initial size.
Below is a repro:
In the playgroud, the sizeGradient’s factor is set to 1 from birth to death which should have no influence on the size. But try and comment out the line On line 58, 59 and one would see that is not the case.
We can see that in particleSystem.ts
/src/Particles/particleSystem.ts (sorry can’t post a github link because a new user has link limitations)
line 1341 to 1353
// Size if (!this._sizeGradients || this._sizeGradients.length === 0) { particle.size = Scalar.RandomRange(this.minSize, this.maxSize); } else { particle._currentSizeGradient = this._sizeGradients[0]; particle._currentSize1 = particle._currentSizeGradient.getFactor(); particle.size = particle._currentSize1; if (this._sizeGradients.length > 1) { particle._currentSize2 = this._sizeGradients[1].getFactor(); } else { particle._currentSize2 = particle._currentSize1; } }
if _sizeGradient is defiend, it does not randomise particle based on minSize and maxSize at birth.
Similarly in line 364, it does not take into account the minSize or maxSize.
Please let me know if my understanding is correct and if you would like me to propose a bug fix.
Thank you!