How is "Random Texture" used for GPU Particle Systems? How do I get spawn locations to seem more random?

I am getting some issues with GPU Particles spawning at identical locations, and I have a feeling that I need to use randomTextureSize somehow.

Here’s a PG that shows how the particles initially spawn OK, but then they seem to spawn in identical locations over time: Babylon.js Playground

This transition to “not so random-seeming anymore” is especially apparent when the camera is adjusted/rotated. Perhaps I need to find other ways to inform the spawn locations of things. Maybe it has something to do with the “Random Texture” that’s mentioned in the documentation?

So, OK, a random texture is made, as explained in that document. Now what? How is it sampled? Are there any examples of it in use? This part isn’t explained.

The random texture is always enabled and used, not just when you set the option. By default, the biggest supported texture size is used (16K). The randomTextureSize option is only for reducing the size of the texture. You may need to get creative to work around this limitation for your use-case.

@Evgeni_Popov and @sebavan may have some ideas on how you can do it.

You can actually see the textures in the Inspector:

The shader that updates the particles is this: Babylon.js/gpuUpdateParticles.vertex.fx at master · BabylonJS/Babylon.js (

Thanks for this information. How would I use this in order to prevent the issue I face whereby (for short-lived particles, like sparkles) every GPUParticleSystem I make results in this nonrandom spawning issue? Basically, the “capacity” reaches saturation and every subsequent spawning of particles occurs at the same place, looking like particles hovering in a stationary position.