Create a GPU Particle Effect

This document describes how you can use your GPU to spawn millions of particles.

Windows
MacOS
Linux
Prerequisite Topics

This page assumes you have prior knowledge of the following topics. Please read them before proceeding.

On this page

For some effects, you may need to spawn tens of thousands of particles. However, using the standard CPU to generate this many particles can cause the game to slow down. In the following how-to, we will demonstrate how to spawn particles using the GPU instead of the CPU.

Steps

  1. First, create a Niagara Emitter by right-clicking in the Content Browser and select FX > Niagara Emitter. The Niagara Emitter wizard displays.

    Click image for full size.

  2. Click the radio button next to Create a new emitter from an emitter template. Select the Fountain template, then click OK to create a new Niagara Emitter in the Content Browser.

    Click image for full size.

  3. Name the newly created Niagara Emitter FX_GPU and double-click to open it.

    CreateGPU_Steps_Step2-CreateEmitter.png

  4. Expand the Emitter Spawn section. Locate Emitter Properties and expand it. Click the dropdown next to Sim Target. From the displayed list, select the GPUCompute Sim option.

    Click image for full size.

    This setting changes particle simulation from the CPU to the GPU. This enables the Engine to spawn more particles while maintaining performance.

  5. Expand the Emitter Update section. Locate the Spawn Rate module. Set the SpawnRate to a value of 5000.

    Click image for full size.

  6. Expand the Particle Spawn section. Expand the Initialize Particle module, and under Point Attributes set the Lifetime Minimum and Maximum to 5.0.

    Click image for full size.

  7. Set the Mass Minimum and Maximum to the following values.

    Click image for full size.

    Property

    Value

    Minimum

    1.0

    Maximum

    2.0

  8. Under Sprite Attributes, set the Sprite Size to X: 5.0, Y: 5.0. Make sure the Sprite Rotation box is unchecked.

    Click image for full size.

  9. Expand the Add Velocity module. Set the Velocity Minimum and Maximum to the following values.

    Click image for full size.

    Property

    Value

    Minimum

    X: 10.0, Y: 10.0, Z: 400

    Maximum

    X: 50.0, Y: 50.0, Z: 800.0

  10. Expand the Sphere Location module. Set the Sphere Radius to 100.

    Click image for full size.

  11. In the Particle Update section, expand Gravity Force. Set the Gravity to X: 0, Y: 0, Z: 500.

    Click image for full size.

    A negative Z value will make the Mesh particles go up briefly, and then fall down. A positive Z value will make the Mesh particles go up without falling.

  12. Click the Compile, Apply and Save buttons to compile and save your work. Then close the FX_GPU emitter.

    Click image for full size.

  13. Right-click in the Content Browser, and from the displayed menu select FX > Niagara System. The Niagara System wizard displays.

    Click image for full size.

  14. Click the radio button next to Create an empty system with no emitters. Click OK to create a new Niagara System in the Content Browser.

    Click image for full size.

  15. Name the new Niagara System GPU

    NiagaraSystem_GPUIcon.png

  16. Double-click the GPU Niagara System to open it, then drag the FX_GPU Niagara Emitter from the Content Browser to the system Timeline.

    Click image for full size.

    Instead of steps 13-16, you can also right-click on the Emitter in the Content Browser and select Create Niagara System. This creates a system based on the Emitter you selected, at which point you can name it and open it.

  17. Click the Compile and Save buttons to compile and save your work, and then close the GPU Niagara System. In the Content Browser, drag the GPU Niagara System into the Level Viewport. When that is completed, you should now see something like the image below.

    Click image for full size.

End Result

When all steps have been completed, you will have a particle effect that is larger and more complex but uses less resources. An example is shown in the video below.

Tags
Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback