This is the Unity version. See the matching Unreal Engine Niagara tutorial.

Back to the elemental comparison and recipes

What you will build

Build a campfire from three separate parts: Flames is the main fire, Sparks adds small, fast-moving embers, and Smoke adds a slower cloud above it. Each part uses a Particle System, Unity’s component for emitting and moving small images or meshes. Start with Flames alone and check that it rises from the base and fades away.

Flames forms the main fire, Sparks adds embers, and Smoke adds the cloud. Their emission rates are 25, 4 and 6 new particles per second respectively.
Flames forms the main fire, Sparks adds embers, and Smoke adds the cloud. Their emission rates are 25, 4 and 6 new particles per second respectively.

Preparation: make a small test scene

Use Unity 2022.3 LTS with URP 14 and save a separate practice Scene. A Scene is the workspace containing the floor, camera and effect. Hierarchy lists its objects; Inspector shows settings for the selected object. If you use another Unity version, including Unity 6, menu names and positions may differ.

  1. Right-click an empty area in Hierarchy, choose Create Empty and name it EF_Fire. In Inspector, open the Transform menu and choose Reset to restore its position, rotation and scale. The examples treat one Unity unit as one meter and keep parent scale at (1,1,1).
    Keep the practice scene and its assets together
    Keep the practice scene and its assets together
  2. Place a unit cube at (2,0.5,0) as a size reference, away from the effect origin. Add a floor cube at (0,-0.05,0), scale (4,0.1,4), with its top at Y=0.
    Scale reference
    Scale reference
  3. Frame the origin from an elevated angle in Scene view. Select Main Camera and use GameObject → Align With View, then verify the floor/work area in Game view.
    Match Main Camera to the Scene view
    Match Main Camera to the Scene view
  4. Inspect the Game view in Play mode against mid-gray, initially without bloom or strong grading. Keep a Directional Light for Lit materials, whose shading responds to lights. Bloom is the glow around bright areas; leave it off while checking shapes.
    Enter Play and inspect shape and motion in Game view
    Enter Play and inspect shape and motion in Game view

Build Flames, then Sparks, then Smoke. Check each part on its own before adding the next part.

Object relationships

EF_Fire groups the whole effect. In the list below, each indented object is a child of the object above it. Start with the root and add the children in the order explained below.

EF_Fire
  Flames
  Sparks
  Smoke

How to enter values and curves

A range such as 0.8–1.2 means each particle receives a value between 0.8 and 1.2. Open the menu beside the field, choose Random Between Two Constants and enter the minimum and maximum. Choose Constant for a single value. Lifetime is how many seconds a particle remains; Speed is its distance traveled per second in Unity units. Compare at normal playback speed, timeScale=1.

Size over Lifetime changes a particle’s size while it is alive. Enable the module and open its Curve. Add keys at the stated positions: horizontal zero means the particle has just appeared; one means its lifetime has ended. The vertical value multiplies Start Size. For a particle lasting 0.8 seconds, horizontal 0.25 is 0.2 seconds after it appears.

Color over Lifetime changes particle color and transparency over its lifetime. Click Gradient: lower keys set RGB color; upper keys set Alpha, the transparency value. Alpha 0 is invisible; 1 applies no transparency reduction. You can leave RGB white and still fade Alpha. Values here use 0–1. In a 0–255 picker, 1 becomes 255 and 0.5 becomes about 128.

Select each new Particle System and reset its Transform before entering the position and rotation from its table. In Main, turn Play On Awake on so it starts when you enter Play, and leave Prewarm off. Set Start Color to white with Alpha 1. Sections of settings are called modules. Emission controls particle counts; Burst emits a group at a specified time; Shape controls where particles start and their direction. Leave unspecified extra modules off for this first test.

Build the mask, material, flames and fading, then add sparks and smoke.
Build the mask, material, flames and fading, then add sparks and smoke.

1. Prepare a grayscale mask

Mask_Flame is a mask: white marks the visible shape, black marks hidden areas and gray creates partial transparency. Read R, the red component of this grayscale image, into the material’s opacity. The material adds color later. Finish the material setup below so the black area becomes transparent.

  1. In Photoshop create a 512×512 RGB, 8-bit image with a black background and a separate layer for the white shape.
    RGB / 8 bit
    RGB / 8 bit
  2. Draw three white tapered tongues rising from the lower center with a pen or brush. Vary their heights and leave at least 32 pixels of black margin.
    Keep black margins
    Keep black margins
  3. Soften the edges by roughly two to four pixels, preserving broad white shapes instead of covering the mask in fine noise.
    Keep black margins
    Keep black margins
  4. Export Mask_Flame.png and drag it into Unity Project. Start with Default type, sRGB off, Bilinear filtering and Clamp wrapping; select the imported PNG, click Apply in Inspector, and check that the preview contains the white shape and black margin.
    Connect image brightness to opacity: black disappears
    Connect image brightness to opacity: black disappears

512 is the image size used for this exercise. Keep the editable PSD. Compare a smaller resolution at the effect’s actual screen size before choosing the final size. Check PNG file size separately from memory used by the imported Unity texture.

2. Build the mask-and-color material

A Material holds appearance settings such as the image, color and transparency. Shader Graph builds the calculations by connecting nodes. Here the grayscale image supplies the shape and Tint supplies the color. Unlit displays that color without directional-light shading.

  1. Right-click in Project and choose Create → Shader Graph → URP → Unlit Shader Graph. Name it SG_Flame and double-click to open it. Set Transparent surface, Alpha blending and Alpha Clipping off.
    RGB / 8 bit
    RGB / 8 bit
  2. In the Blackboard, use + to add Texture2D MaskTex, Color Tint and Float Intensity and Opacity. Enable Exposed for each so it appears in the Material Inspector. MaskTex chooses the image, Tint chooses its color, Intensity multiplies brightness and Opacity multiplies transparency. Set the default Tint to white with alpha one and both floats to one; verify them on the material too.
    Expose Texture2D MaskTex · Color Tint · Float
    Expose Texture2D MaskTex · Color Tint · Float
  3. Right-click empty graph space to add nodes, the small calculation blocks. Connect MaskTex to the Texture input of Sample Texture 2D. Use Multiply nodes to multiply sample R, Vertex Color A and Opacity, then pass the result through Saturate into Fragment Alpha. Multiply performs multiplication; Saturate limits the result to 0–1. Feed Tint RGB × Vertex Color RGB × Intensity into Base Color.
    Connect image brightness to opacity: black disappears
    Connect image brightness to opacity: black disappears
  4. Create M_Flame from the saved graph, assign its PNG to MaskTex and set Tint to orange. Save the Material here. Assign it to the Flames Renderer after creating that object in the later steps. Renderer is the component that draws the object on screen.
    Connect image brightness to opacity: black disappears
    Connect image brightness to opacity: black disappears

Vertex Color passes the particle or line color and Alpha into the material. Multiplying its A makes settings such as Color over Lifetime visibly fade the result. For Particle System, open Renderer and check that Custom Vertex Streams includes Color and supplies the expected UV coordinates, which choose where the image is sampled.

See the Shader Graph walkthrough and mask workflow for node and export details.

The color and opacity paths for flame, spark and smoke masks.
The color and opacity paths for flame, spark and smoke masks.

3. Assemble Flames

Select EF_Fire in Hierarchy and choose GameObject → Effects → Particle System. Name it Flames. If it is not indented under EF_Fire, drag Flames onto EF_Fire. Keep Flames selected and enter the table values in Inspector. Tick a module to enable it, then open its heading to edit its fields.

SettingValuePurpose / check
Transform / Rotation(-90, 0, 0) degPoint the cone local +Z toward world +Y.
Main / Duration; Looping2 s; OnA continuous small fire.
Main / Start Lifetime0.8–1.2 sLifetime of an individual particle.
Main / Start Speed1–1.6 units/sInitial upward speed.
Main / Start Size0.35–0.55Compare size with the unit cube.
Main / Gravity Modifier; Simulation Space0; WorldNo gravity; emitted particles stay in world space.
Main / Start ColorWhite, Alpha 1Begin with material Tint controlling color.
Emission / Rate over Time25 /sParticles emitted per second; remove bursts.
Shape / Shape; Angle; RadiusCone; 12 deg; 0.12Keep a narrow base with modest spread.
Renderer / Render Mode; MaterialBillboard; M_FlameShow the mask on camera-facing cards.

In Play mode verify upward emission. For sideways motion inspect the system/parent rotation before changing color or noise.

Build Flames first; add sparks and smoke as separate Particle Systems.
Build Flames first; add sparks and smoke as separate Particle Systems.
Smoke
Smoke

4. Shape birth and disappearance

Enable Size over Lifetime with a curve of 0.3 at age 0, 1 at age 0.25 and 0.1 at age 1. The horizontal axis is normalized particle age, not seconds; the curve multiplies Start Size.

Keep lifetime RGB white and set alpha keys to (0,0), (0.1,1), (0.65,0.7), (1,0). The flame should become readable, then smaller and thinner toward its tip.

Select Flames and enable Noise, which adds irregular motion. Try Strength 0.12, Frequency 0.5 and Low quality. Strength controls how strongly the particles wander. Lower Strength if the small shaking makes the upward flame motion hard to see.

Smoke
Smoke

5. Add separate spark and smoke layers

  1. Duplicate Flames as Sparks, make a small white-dot mask and duplicate its material. Start at rate 4/s, lifetime 0.3–0.6 s, speed 2–3 and size 0.03–0.06.
    Smoke
    Smoke
  2. Create Smoke with a soft-disc mask and a separate alpha material, gray Tint and Opacity 0.2. Start at rate 6/s, lifetime 1.5–2 s, speed 0.2–0.4 and size 0.4–0.7.
    Smoke
    Smoke
  3. Set Smoke Transform rotation to (-90,0,0) for upward emission and zero gravity. Grow lifetime size from 0.5 to 1.5 and set alpha keys (0,0), (0.2,0.5), (1,0); it should linger larger and slower than flames.
    Smoke
    Smoke

For brighter Sparks, duplicate its own Material and compare Additive blending, which adds color to the background. Keep Smoke on its separate Alpha-blended material so it can remain darker than the background.

A Size over Lifetime value of one multiplies Start Size by one; it is not one meter. Alpha one is further multiplied by mask R and material Opacity.

Flames size multiplier and alpha over normalized particle lifetime. Left vertical axis: size factor; right: alpha.
Flames size multiplier and alpha over normalized particle lifetime. Left vertical axis: size factor; right: alpha.

Verify the baseline before tuning

Rate over Time is the number of new particles emitted each second. At 25 particles per second and a maximum lifetime of 1.2 seconds, Flames retains roughly 30 at once. Max Particles is the upper limit: start with 64 for Flames, 8 for Sparks and 24 for Smoke. Compare Noise on and off to see exactly what the extra motion adds.

For duplicated Sparks verify every listed rate/lifetime/size/material change. Give Smoke its own material rather than recoloring the shared flame material.

From the first playback to saving

Temporarily disable Sparks and Smoke. Flames alone should appear low, rise and shrink away before the supporting layers are added.

Enable Flames alone and observe for about two seconds. Once it rises and tapers, restore Sparks and Smoke one at a time. Exit/re-enter Play for a fresh comparison.

Inspector values tested in Play may reset when you stop. Write down the values you want to keep, exit Play and enter them again, then save the Scene. Drag the completed root object into Project to save a Prefab, a reusable file containing the whole effect.

Troubleshoot one cause at a time

SymptomFirst checkComparison
Rectangular cardsMask R and shader alphaRead R rather than an all-one A and verify black becomes zero.
Smoke races with flamesCopied speed/lifetimeShow Smoke alone, reduce speed and extend lifetime.
No light on surroundingsUnlit shading roleVisible glow and scene lighting are separate; add a light if needed.

Completion checks: compare under matching conditions

  1. Isolate each layer and verify distinct speed/lifetime.
    Smoke
    Smoke
  2. Verify upward tapering motion without hue.
    Smoke
    Smoke
  3. Move the emitter and compare world-space persistence.
    Smoke
    Smoke
  4. Check overlap and target-device frame time with several fires.
    Smoke
    Smoke

Continue by comparing another element

Return to the eight-element comparison to compare shape, motion and persistence. Another exercise is the water recipe.

References