Origin shifting and particle systems

Hi guys,

I’m developing a large world game that relies on origin shifting to avoid the floating point precision problem. However, my game involves the movement of ships which have a particle trail to simulate a boat’s wake. When I shift the origin, the particle emitters shift but the GPU particles don’t.

Is there anyway to force the particle system to reposition each particle relative to the emitter when the origin is shifted?

Here’s a PG:

Unfortunately (and for perf reason) the particles when using GPUParticleSystem are not accessible by the CPU. So in your case I’m afraid you will have to rely on CPU particles and you will have to use a custom update function:

Why could we not just add an offset uniform for the whole GPU Particle system?

uniform vec3 globalOffset;

position = globalOffset;
#elif defined(BOXEMITTER)
position = (minEmitBox + (maxEmitBox - minEmitBox) * randoms2)+globalOffset;
position = globalOffset + (radius - (radius * radiusRange * randoms2.z)) * vec3(randX, abs(randY), randZ);
#elif defined(SPHEREEMITTER)
position = globalOffset + (radius - (radius * radiusRange * randoms2.z)) * vec3(randX, randY, randZ);
#elif defined(CYLINDEREMITTER)
position = vec3(xPos, yPos, zPos)+globalOffset;

Well this is AN EXCELLENT idea! :smiley:
@Luan_Ngo: would that be good for you? I can add it if that works for you

I could add it as well, its fairly ezpz! Let me know what’s good cause we can make this happen. I even have time to do a PR today surprisingly…

please do!

Yes, that’s a great idea! Thanks for being so supportive, guys.

I got halfway done and realized I do not have any way to validate if it worked or not… I have never done my own build from my branch and am kinda intimidated to try.

Might be best if you do it Delta, pretty much just needs what already posted just in the right spots.

Also in the example:

the emitter can move its position why would this not accommodate what @luan_Ngo is trying to do? Maybe I am missing something.

Hi Pryme, thanks for working on this.

I currently have the emitter moving with the ships (emulating a boat’s wake), but I sometimes have to shift the emitters and the particles so that my camera origin is kept at 0,0.

I changed your example (see line 50). Here, the emitter’s location shifted. And I’m hoping to have a feature that would shift the particles as well.


Thanks again for your help.


offset is defined on line 183 of the shader. Ideally it would be a uniform.

Issue created:

I will work on it this week!

Thanks for this guys!


1 Like