Particles emit only when visible

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By gmaps

I saw this question a couple of times, but none of them were properly answered. So, I have a scene with effects node, where I attach all the one shot particles (e.g. explosions). They last few seconds, a new one is triggered every few seconds, old ones are dequeued and they seem to work perfectly… until I move camera to other part of the map and they’re not visible. When I move back, they seem to stack and start playing all at once. Like they were all instanced, but then waited for me to see them. It’s a very odd behavior to have by default.

So if anybody has an idea how to make it act “normal” = play when they are instanced, not when seen, I’d be glad to hear it.

My guess is that because they are simulated on the GPU, if they are not drawn, then they are not simulated. This is quite lame tbh, but that’s only a guess. I wonder if culling could be disabled on them (or could be given a large AABB to never be culled).

Does this happen with CPUParticles?

Zylann | 2019-09-24 12:58

I got a similar answer on discord - make AABB cover all the map. I’ll try it, but it doesn’t sound good performance-wise. I was also thinking instead of increasing AABB to add a timer to the “explosion” scene which manages the particles so it dequeues after few seconds. The problem still persists with the explosions that are invisible, but we looked at them before timer passed - they would start late and dequeue too soon. But then I noticed there is a “preprocess” parameter. Maybe if I could somehow detect when camera sees the particle emitter and set that preprocess parameter in scene script to value of the seconds left, it would look seamless. I’ll try changing AABB, adding timer and CPU particles and report which one is the winner.

gmaps | 2019-09-24 14:25