UE5 - Niagara

Sprite Smoke

A prechewed run-through of the sprite smoke tutorial.

  • Sprite Smoke
    • Note:
      This example uses the M_smoke_subUV Material, which can be found with the Starter Content.
    • Create the System and Emitter
      • Create a folder, name it “Niagara_fx” (or something else) and step into it.
      • Create a Niagara System, RMB click > FX > Niagara System (or choose from create basic assets at the top of the popup menu)
      • Select New system from selected emitters. Then click Next.
      • Under Template, select Simple Sprite Burst. Click the Plus sign icon (+) to add the emitter to the list of emitters to add to the system. Then click Finish
      • Name the new system “NS_smoke”. Double-click to open it in the Niagara Editor.
      • We can rename the emitter instance by selecting it and pressing F2 (or slow LMB double click) name it “FX_Smoke”
    • Change Renderer Settings
      • Setup Material
        • On the emitter node select *Render > Sprite Renderer to open it in the Selection panel
        • Set Material : “M_smoke_subUV” material
        • Set Sub Image Size : 8 (x) and 8 (y)
          • Since we use a Spritesheet / SubUV material we nede to set the num row & colums (u & v)
        • Set Sub UV Blending Enabled : Checked
        • Drag the SmokeSystem into your Level.
          • Note When you make a particle effect, it is always a good idea to drag your system into your Level. This gives you a chance to see every change and edit in context. Any changes you make to the system automatically propagate to the instance of the system in your Level.
    • Edit the Emitter Update Group Settings
      • Note First you will edit the modules in the Emitter Update group. These are behaviors that apply to the emitter, and that update each frame
      • Remove Instantaneous module
        • In the System Overview, click the Emitter Update group to open it in the Selection panel.
        • You want to create a constant column of smoke, not a burst of smoke. Click the Trashcan icon to delete the Spawn Burst Instantaneous module.
      • Add Spawn Rate
        • Add the Spawn Rate module to the Emitter Update group.
          • Clicking the + icon (at the top-right of the Emitter update in the selection panel)
          • Start typing “spa…” select Spawn Rate
          • Set the Spawn Rate to 50.
      • Set Infinite loop
        • Note We set the sim to run on an inifinite loop while building the effect. This gives us more time to evaluate how the settings are affecting the effect.
        • In the Emitter State module click the dropdown for Life Cycle Mode and select Self.
        • Click the dropdown for Loop Behavior and select Infinite.
    • Particle Spawn Group Settings
      • Note These modules contain behaviors that apply to particles when they first spawn.
      • Life span
        • On the emitter overview select Particle Spwan
        • In the Selection panel expand Particle Spawn > Initialize Particle > Point Attributes
        • If we wanrt some more random life we can set:
          • Lifetime Mode : Random
          • Lifetime Min : 2
          • Lifetime Max : 3
      • Sprite Size
        • Whith the Particle spawn still in the selection panel expand the Sprite Attributes section.
        • Sprite Size Mode : Random Uniform
        • Uniform Sprite Size Min : 75
        • Uniform Sprite Size Max : 200
      • Sprite Rotation
        • In the Sprite attributes section set:
          • Sprite Rotation Mode : Direct Normalized Angle (0-1)
            • This means the rotation angle is calculated as a number between 0 and 1 instead of degrees
          • Sprite Rotation Angle click on the down arrow on the right side and start typing ‘rand…’ click on Random Range Float (General > Dynamic Inputs > Random Range Float)
            • Minimum : 0.25
            • Maximum : 0.5
      • Initial Velocity
        • Click on the + icon on the right side of the Particle Spawn (in the selection panel, tip you can also click on the emitter node in the system overview)
        • In the popup dialog start typing ‘vel…’ select “Add Velocity”
        • Click the dropdown arrow on the right side of the Velocity attributes (the three xyz floats) and start typing ‘rand…’ select Random Range Vector
          • Minimum : X: 0, Y: 0, Z: 50
          • Maximum : X: 1, Y: 1, Z: 200
      • Shape Location
        • This controls the shape & origin where particles are spawned.
        • Add a shape location.
          • Click on the + icon on the right side of the Particle Spawn, start typing “sha…”” select Shape Location
        • Set Properties
          • Shape Primitive : Sphere
          • Sphere Radius : 64
          • Sphere Distribution : Random
      • SubUV Animation
        • Note
          • According to the epic tutorial this was added in the section Particle Spawn. When doing this I did not get the sub uv sampling to work, I guess since the uv coord is sampled once during the spawn and does not update over time. To get this to work I added it to the Particle Update section instead.
          • Since we use a spritesheet, we want to control which section of the spritesheets gets sampled in order to give the illusion of movement.
        • Click on the + icon and start typing “sub…” select Sub UV Animation
        • Set the Range
          • Make sure that the Sub UV Animation Mode is set to linear.
          • Set the Start Frame Range Override to 0
          • Set the End Frame Range Override to 63
            • We do this since 8 x 8 = 64 frames
        • Set the Sprite Renderer
          • This was not set in the tutorial, but in order to not get any warnings I needed to do the ollowing.
          • In the tab Sub UV Animation > Spritre Renderer > source > Sprite Renderer I needed to set which sprite renderer to use. I set this to the same renderer we used under the tab Render. Note that it is possible to rename the renderer.
    • Particle Update Group Settings
      • Here we add modules that apply behaviors to particles, and update each frame.
      • Note that I added the Sub UV Animation module here instead of the Particle Spawn
      • We can add curl noise, drag, acceleration and so on
    • Note
      • If you want to be able to reuse the smoke emitter in your system, you can save it as a separate asset. Click the Gear icon to open the Emitter Settings menu, and select Create Assset From This. The result is an independent Niagara Emitter asset.
      • Sprite Smoke epic tutorial

Sequencer

Custom Parameter

Here is a way to add a user parameter that you can animate in sequencer

  • Add user parameter
    • Open up the niagara system
    • Click the User Parameters tab on the left side of UI
    • Lets add a float parameter
      • Click the plus icon on the right side of the User Parameters UI
      • Make New > Common > Float
      • Give it a descriptive name, like Particle Amount
      • Note that you can delete parmeters by RMB clicking them in the User Parameters panel > delete
  • Connect the parameter to emitter
    • Lets connect the user parm to the spawn rate of the emitter
    • Select the Spawn Rate module of the Emitter Update section.
      • If you do not have one add it
    • In the selection Panel, click on the down arrow on the right side of the spwan rate parameter
      • Start typing “Part…” select Particle Amount (Link Inputs > User > Particle Amount)
  • Animate parm in sequencer
    • Drag and drop NS (niagara system) to the viewport
    • Create a level Sequence
    • Add the niagara system to the sequencer
    • Add Niagara Component track
      • Click the + icon to the right on the NS track Components > NiagaraComponent0
    • Add a Niagara System Life Cycle Track
      • Click the + icon to the right on the Niagara Component track Tracks > Niagara System Life Cycle Track
    • Add the User Parameter
      • Click the + icon to the right on the Niagara Component track Tracks > Particle Amount Parameter Track

Cache

  • Niagara Cache Track
    • Add the niagara Cach plugin
    • Add Niagara Cach Track
      • Click the + icon to the right on the Niagara Component track Tracks > Niagara Cache
      • Note that the life cycle track needs to start on the same frame (or earlier) than the cahce track
    • Click on the red dot to cahce
    • Note
      • I needed to remove the Cache berfore rendering with the MRQ, if I did not do this I got really weird results.