Best ways to optimize VFX in Unreal?

Been waiting since 4.12 on that.
Started out me requesting the particle cutouts not only use an alpha in a texture as a lookup, and this is the result.
Makes me very very happy.

1 Like

Hi there! Just some thoughts;

  • Shaders complexity vary with the shader type there are using. The simplest it is (unlit), the more overdraw you can have. Here is a benchmark of overdraw cost with particle in Unreal4:


    first bar means one fx overlaping, the second have 5… So you can see you have to be careful when your material uses Lit directional.

  • Also if your FX is always with the same lighting settings, its might be enough to use unlit and cheat your light inside your material

  • For adding volume with low overdraw, maybe a half-emisphere mesh instead of mass of sprites might do the trick

4 Likes

I would suggest you always check performance on your target platform. Like you mentioned earlier your PC isn’t a good indicator of how things perform on the console.

So let’s break down some steps you can take.

  1. Shader complexity is always a good start. If your particle system is showing up white in a simple scene (like the default scene) just think about what that’s going to do in a full level which has complex shaders on the environments. Because the complexity of the shader behind the translucent object is going to contribute to the colour indicator in shader complexity.
  2. Run the vfx on your target platform. You should have access to console commands which can tell you how much time per frame is being spent on the whole scene - draw thread, game thread, render thread (which is cpu and gpu). Fill the screen with your effect and then turn the effect on and off. You can use a console command to show/hide particles for instance. Have a look at the change in ms for the various threads. The difference will be how expensive your effect is on the cpu and the gpu. Sometime you might have an effect which doesn’t have a lot of shader complexity but it might be taking up a large portion of the screen or there are so many particles being calculated that it can effect the cpu instead of the gpu. And as a side note don’t think that gpu particles in ue4 don’t effect the cpu too. They do.
  3. Shader complexity is only going to tell you how expensive the particle/shader is on the gpu but that doesn’t help you figure out what to change to improve things. That’s where something like PIX comes in. It will give you a detailed break down of how much time is spent on the cpu and the gpu to create your effect. It also has some great tools to visualise what might be causing the problem.
  4. If you can, stress test your effect by placing a bunch of them in a level. A lot of the time we create a great effect on it’s own and think it will be fine but then find that that same effect is being spawned multiple times in a small area which can blow performance. So think about how your effect is going to be used.
1 Like

I agree with @mikelyndon and @tharlevfx here. Best case scenario you should test on your target console and keep in mind that the Xbox One is not as good as PS4 on the GPU side.

That said, the idea is to keep in mind that the fill rate problem (or overdraw) on the GPU is proportional to the number of instructions X the number of pixels covered X the number of layers that the effect represent on screen.

The bigger and the closer an effect can be seen on screen the more attention it needs on the instructions counts, particle counts and so on…

It seems like texture trimming could be of a great help on the GPU but there are some other features that could help a lot on the performance side that some other engines or our custom version of Unreal has. Maybe you could ask for some help on this with some programmers?

Here are some examples:

  1. Near Scale: Scale down the particles based on a distance and move them out of the screen. This works okay if you also fade to transparent the particles at the same time and that you don’t need the effect to hide anything specific.
  2. Cut Emitter: Sometime it’s also interesting to just stop the emitter if you are too close to it. IE: A smoke column. As soon as the player is too close the emitter stop emitting particles (could use LODs too but it’s a bit annoying to use LOD0 to stop emission)
  3. Half-Res Buffer/ Quarter Res Buffer: It seems like this feature is part of Frosbyte and help them a lot on the performance by basically calculating the particles lighting, shadings, movement and so on on a smaller buffer (Half = 1920/2, 1080/2) and then scaling it back to make it full screen. This is a bigger feature to develop from my understanding since you have to clean some upscale artifacts as well as sorting particles with other translucent that use the full res buffer (IE: UI). It’s a Rendering Feature while the two previous one could be tool features.
1 Like

To add some clarity to the question of what red or white even mean in Shader Complexity mode, what it ramps to is defined in BaseEngine.ini, under MaxPixelShaderAdditiveComplexityCount=.

Whatever number comes after that equal sign is the instructions per pixel that it takes to go full white. You can alter that value as you like, and it won’t affect the game at all, it’ll just change how things are displayed in Shader Complexity. Depending on your target platform and other performance concerns you might want to alter that value so you can see more clearly what you need to worry about.

2 Likes

Hi, I have question. Is it possible to turn off particles using LODs, culling etc. and spawn in appropriate place plane imitating this effect? It’s needed on vistas and far distances.

Yes it is :slight_smile: https://docs.unrealengine.com/en-us/Engine/Rendering/ParticleSystems/LODs

Somewhere in the back of my brain, I remember someone talking about making platform/console-specific LODs, but I can’t remember who or where. Glossing over the link Simon posted I didn’t see anything about it in there either. Is my brain making this up?

I’m not talking about LODs in particles, I know how they works. I was thinking about hmm… flat presentation of effect. I’m not sure how to explain it correctly. For example. We have some kind of smoke with fire . But on landscape and very far distance fx must be killed. I want to turn off particle actor and put there “replacement” f.ex. single plane mesh with material imitating effect.

From my gut-feeling I would guess that you need to make a blueprint for this which switches your particle system agaist a plane/billboard which always turns toward the camera. Could that be an idea?

1 Like

There shouldn’t be much overhead if you just spawn a single particle with the desired material and make it immortal (lifetime 0).
Expensive stuff is spawning, overdraw, lights and translucent material blending. The simulation is very cheap.

Yes, this would be idea. Next question. How to make similar flat presentation of effect on one plane :slight_smile: I’m curious how in games like Uncharted series, they make such nice looking waterfalls in vistas and landscapes.

Be careful with that. I did this once (using 1 particle with limitless lifetime) and soon after a programmer came to me and mentioned that none of my particle systems i culled anymore :smiley: So they where running all the time in the whole level (it was some torch-fires) even if they where behind you. :smiley:

1 Like

you can set up a scene in unreal that renders out the effect on a black background and then make it loop in after effects to make your flipbook.

1 Like