Hazel

Particles

Fire, smoke, sparks, magic, confetti: anything made of many small moving pieces is a particle effect. In Renzora an effect is a .vfx file in your project. You build it in the Particles workspace, then place it in a scene as many times as you like. Every copy plays the same file, so improving the file improves every fire in your game at once.

Effects work in 3D and 2D scenes, play in the editor while you work, and play the same way in your exported game.

Place a ready-made effect

The quickest way to see particles is the built-in campfire:

  1. Open the Add Entity menu and choose Effects > Particle System.
  2. A new entity called Particle System appears, already playing a campfire.
  3. Move it where you want it, like any other object.

The effect has no solid shape to click, so the viewport draws a small orange sparkle icon at its origin. Click the icon to select it. While it is selected, the viewport also outlines where its particles are born (a sphere, cone or box) and anything they bounce off.

Make your own effect

  1. In the Assets panel, open the create menu and choose Particle Effect.
  2. A gallery of starting points opens. Pick one.
  3. Renzora writes a new .vfx file into the folder you have open in the Assets panel (or into effects/ if none is open), and switches to the Particles workspace with it ready to edit.

The New Particle Effect gallery with its template cards

The templates in the gallery:

TemplateGroupWhat it is
Blank 3DStartOne emitter spraying soft dots from a small sphere
Blank 2DStartOne emitter for a 2D scene, measured in pixels
Campfire3DBright flames with embers drifting off them
Realistic Fire3DA log fire in five layers: flame tongues, smoke, embers and glowing coals
Sparks Burst3DA single burst of stretched sparks falling under gravity
Smoke3DSlow, swirling puffs that grow and fade
Confetti2DSpinning paper that bursts up and tumbles down
Magic Sparkles2DTwinkling stars around a point
GPU StressGPU200,000 sparks at once, to show what the graphics card can carry

Pick the one closest to what you want and change it, rather than starting blank. It is faster to turn smoke into steam than to build steam from nothing.

To put your effect in a scene, drag the .vfx file from the Assets panel into the viewport. You get a new entity playing it, standing on the ground in a 3D scene or on the plane in a 2D one.

The Particle System component

Select an effect in the scene and the Inspector shows its Particle System component.

FieldWhat it does
EffectWhich .vfx file this entity plays. Drag a different one onto the slot to swap it.
Pencil buttonOpens the effect in the Particles workspace. For a built-in effect such as the default campfire, it opens the template gallery instead, so you get your own copy to change.
PlaybackPlay, Pause, Stop (clears every particle) and Restart, with the current state beside them.
SpeedHow fast the effect runs. 0.5 is slow motion, 2 is double speed.
When FinishedWhat happens when an effect that does not loop reaches its end: Keep it, Deactivate it, or Despawn the entity. Despawn is the right choice for an explosion that should clean itself up.

The Particles workspace

Double-click a .vfx in the Assets panel, or press the pencil button in the Inspector. The editor switches to the Particles workspace, which has three panels:

  • Effect Preview (top left): the effect playing on its own, away from your scene.
  • Emitter Settings (below it): the effect as a whole and the emitter you are editing.
  • Effect Graph (the large area on the right): what the particles do, as a node graph.

The Particles workspace with Realistic Fire open: Effect Preview top left, Emitter Settings below, the Effect Graph on the right

Every change shows up straight away in the preview and in every scene entity using the file, before you save. Press Ctrl+S to save the file. Edits go on the undo history, so Ctrl+Z takes them back.

Effect Preview

The bar over the preview has:

  • Backdrop: what the effect is shown against, so you can check it on dark and light backgrounds.
  • Speed: slow the preview down to study fast effects like sparks.
  • Move: moves the emitter around, to check how trails and smoke react to a moving source (a torch carried by a character, for example).
  • Restart: plays the effect from the beginning.
  • The ... button: Loop the preview, and Restart on Edit so each change replays from the start.

Emitters

An effect is made of one or more emitters. Each emitter is one layer of the effect: in Realistic Fire, the flames, the smoke, the embers and the coals are separate emitters, each with its own look and behaviour.

The emitters appear as tabs along the top of the graph. Click a tab to edit that emitter. Click + Emitter to add another. Right-click a tab to Rename, Duplicate or Delete it.

Emitter Settings

The Emitter Settings panel is split into sections.

Effect applies to the whole file:

SettingWhat it does
NameThe effect's name
Dimension3D or 2D. 2D effects are measured in pixels.
DurationHow long one run of the effect lasts, in seconds
LoopingStart again when it reaches the end. Turn this off for one-off effects like explosions.

Emitter applies to the tab you are on:

SettingWhat it does
EnabledSwitch this layer off without deleting it
CapacityThe most particles this emitter can have alive at once
BackendAuto, CPU or GPU. Auto picks for you; large emitters run much faster on the GPU. Running On shows which one is actually in use.
SpaceLocal particles move with the entity. World particles stay where they were born, so a moving torch leaves a trail of smoke behind it.
SeedChanges the random pattern while keeping the same look

Render decides what each particle looks like: a Texture (with Sheet Columns and Sheet Rows for a flipbook animation), how it Blends with what is behind it (Additive for glowing fire and magic, Alpha for smoke and dust), which way it Faces (towards the camera, along its direction of travel, or as a Ribbon trail), and whether it Casts Shadows. A particle can also be a small 3D model instead of a flat sprite, for debris or leaves.

Light makes the effect light up the scene around it: Off, one light Per Emitter, or lights on the Brightest Particles. A campfire that actually lights the ground looks far more convincing.

Sub-Emitters start another emitter from this one's particles: On Birth, On Death or Every Interval. Fireworks are the classic use: a rocket particle that bursts into sparks when it dies.

Effect Graph

The graph says how each particle is born, how it moves and how it changes over its life. Every emitter ends in a Particle Output node, and the nodes you connect into it decide the particle's position, speed, size, colour and lifetime.

To add a node, click + Add Node or right-click empty space in the graph, then type to search. Drag from a node's output to another node's input to connect them. If something is wrong, the node with the problem gets a red warning icon that tells you why.

The nodes come in groups:

GroupUse it for
Shape, Shape 2DWhere particles are born: a sphere, cone, box or rectangle
InputFacts about the particle, such as its age or how far through its life it is
RandomRandom directions, colours and values, so particles are not identical
CurveChanges over the particle's life, such as shrinking or fading out
ForceDrag, wind, speed limits, gravity wells, attractors and orbits
CollisionMaking particles bounce off a floor, a box or a sphere
MathCombining values when you need more control

Hover a node in the search list to read what it does.

Changing a value over time

Right-click a value field on a node and choose Animate. The field turns the accent colour and gets keys on the Timeline panel, so the value changes over the effect's duration. Right-click it again for Remove Animation. Use this for a fire that flares up and then dies down.

Controlling effects from a script

A Rust script can play, stop and burst an effect, and spawn new ones. The types live in renzora::particles.

Trigger an effect that is already in the scene, for example a muzzle flash on a gun:

use bevy::prelude::*;
use renzora::particles::ParticlePlayback;
use renzora::ScriptCtx;

fn update(ctx: &mut ScriptCtx) {
    let fire = ctx.world().resource::<ButtonInput<MouseButton>>().just_pressed(MouseButton::Left);
    if fire {
        if let Some(mut playback) = ctx.get_mut::<ParticlePlayback>() {
            playback.restart();
        }
    }
}

renzora::script!(update);

Spawn a one-off effect that removes itself when it ends:

use bevy::prelude::*;
use renzora::particles::{ParticlePlayback, ParticleSystem};

fn spawn_explosion(world: &mut World, at: Vec3) {
    world.spawn((
        Name::new("Explosion"),
        ParticleSystem::from_path("effects/explosion.vfx"),
        ParticlePlayback::one_shot(),
        Transform::from_translation(at),
    ));
}

ParticlePlayback also has play, pause, stop, burst(count) for a handful of extra particles, seek(seconds) to jump in time, and a time_scale field.

If your graph uses a Parameter node, a script can feed it a value by name through the ParticleParams component: set_float, set_vec3 or set_color. A magic effect can then change colour with the spell, or a fire can grow with a "strength" value your game controls.

See Rust Scripts for how scripts are written and attached.

Older .particle effects

Projects made before the .vfx system have .particle files. They keep working:

  • When you open the project, each .particle without a .vfx beside it is converted to one with the same name. The Console lists what was converted and anything that did not carry over.
  • Scenes that used old effects load with a Particle System pointing at the converted file. Save the scene to keep it that way.
  • Double-clicking a .particle opens its .vfx, and dropping a .particle onto an Effect slot converts it.

Your .particle files are never changed or deleted, and an existing .vfx is never overwritten.

Tips

  • Use a few emitters with simple graphs rather than one emitter doing everything. It is easier to tune "the smoke" than a tangle of nodes.
  • Keep Capacity as low as the effect allows. A fire that never has more than 200 particles alive does not need room for 5,000.
  • Set When Finished to Despawn on effects your game spawns, so finished explosions do not pile up in the scene.
  • Additive blending looks great on dark backgrounds and washes out on bright ones. Check both with the preview's Backdrop.