UE4 - OPTIMIZATION - Switching between GPU and CPU

Hi!

As usual, straigth to the point: When is it relevant to use a GPU particles instead of a CPU ?

I get that it may depends on the kind of effects, like smoke or whatever, but what about FX such as ambient dust (using a 128X128 texture) ? Since the particles are rather small, it may not me that bad but i’m trying to find a good balance.

So if anyone could lighten me on the matter, that would be cool. Thanks!

Profile your game. If GPU is a bottleneck, use CPU particles and vice versa.
For anything high in count you should use GPU.
If you need custom particle behaviour you can implement new modules on the CPU faster and easier than on the GPU.
CPU has more reliable physics system so if you need to collide even when collider is invisible/culled you would use CPU.
Some functionalities are not available on the GPU and some are not available on the CPU.

Basically CPU has more behaviours and is more accurate/stable than GPU (collisions, culling) but GPU is far superior in terms of performance per particle.

1 Like

Alright then. Tho, is there a raw number of particles that can be used as a reference to have a rough guess of what’s good or not ?

Like:

Or there: image

Depends on how many emmiters you use on your levels :wink: A 100 CPU particles for a single level is fine. If you have 10 emitters playing with 100 CPU particles each I would say it’s quite a lot and I would advise using GPU. Then again, depends on the modules you are using and LOD settings you have. That’s why I recommend profiling your VFX on actual game levels and pay attention to stats Cascade shows you. 5ms on CPU for all particle effects on any level is quite high but depends on your project. I had 2-3ms budgets for my prev games but the one I’m working on now has higher ms budget for VFX as it’s visually heavy. Better talk with your tech team to get some guidelines on how heavy you can go.

1 Like

it’s worth noting that it’s the update cost of the particle, not the rendering cost that’s moving between CPU and GPU - a large smoke GPU particle will still be expensive on the GPU for the material and overdraw costs.

A good rule of thumb is anything large in size and low in number should probably be CPU and take advantage of things like Dynamic Parameters, and anything small and numerous should be GPU and take advantage of Vector Fields. As always with these things though, it depends on the game and effect you’re making.

1 Like

And ALWAYS make sure you profile on the target platform.

2 Likes

This. Some things are ok with GPU and others don’t like them, or work better with CPU.

Thanks a lot, folks!