Particle micro-freeze on emitting

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


Just want to check if other people are experiencing the same issue. I have a Particle emitter that is not emitting by default. The amount is set to 100. The particles are sphere with standard ParticlesMaterial.

When I turn emitting on, the game freeze for some frame, I’m not sure how long exactly but it is quite noticeable. I’m on a 970M, the game usually run at around 400fps without v-sync (v-sync is on all the time).

You can use built-in profiler to check which part/script spikes during freeze. Please let us know what it says.

Skipperro | 2019-07-31 10:16

All I see with the profiler is a spike in the idle time, therefore an increase of the frame time (almost double).

BraindeadBZH | 2019-07-31 10:58

OK, then we are closer. Please stop profiler after such a spike, click on the spike and on the list of functions on the left scroll down to see what function takes the longest time and spikes alongside of Idle. Maybe you’ve got a Timer, that is processed on Idle time?

Skipperro | 2019-07-31 11:02

That’s the weird thing, I don’t see any other spike in all the of the measured functions.

I’ve got a Timer but it is a single shot that only set a boolean variable, and it is used at other moment without creating this spike.

If I find the time I will try to make a test project to try to replicate this specific issue.

BraindeadBZH | 2019-07-31 11:19

If you will have a project, send a link, so I could see what’s there :slight_smile:

Skipperro | 2019-07-31 11:21

Yes I’ll try, I cannot post the actual project, so I have to extract the faulty part to a test project first, I’ll let you know, this is not a critical issue for me right now.

BraindeadBZH | 2019-07-31 11:28

:bust_in_silhouette: Reply From: roboeast

Particles use material/shaders. In OpenGL any new shader that is loaded needs to be complied, hence the lag spike.

Godot 4.0 will supposedly cache them ahead of time. In the mean time you need to cache them yourself.