Where the direction that the particles move is determined by the output of the shader. More specifically, each point on the texture is a vec2 that represents how much and in what direction a force should be applied to any particle at that point. I’m not sure if this is the right way to go about accomplishing that
Calculating particle direction in a shader automatically excludes the CPU particle system, as you’d have to read the values back to the CPU, which is slow and takes at least one frame (as the read is asynchronous and returns a promise).
You’d have to use a GPU particle system, but that’s not easy either because we don’t provide a way for the user to override the shader we use to update the particles, so you’re kind of on your own to figure out the shader and replace it with your own shader. The shader code can be found in BABYLON.ShaderStore.ShadersStore["gpuUpdateParticlesVertexShader"]. You can replace it by simply changing the value of this entry.
Not really, you will have to add a new uniform to the shader and set it in the javascript code. You will have to patch Particles/webgl2ParticleSystem.ts to do that.