PARTICLES DOCUMENTATION
Version: 1.10.0.7

Index

Component Concept
Namespacing
MoLang integration
Basic Structure Overview
Structure In Detail
Current Component List
Emitter Components
Particle Components
Examples
Flame particle
Smoke particle
Mob Flame effect
Bouncing Bubbles
Particles Entity Integration
Effect List
Effect Event
Animation Controller effects
Animation Timeline effects
Back to top

Component Concept

The particle system is component based. What this means is that particle effects are composed via a set of components. In order for an effect to do something, you add a component that handles that aspect of the effect. For example, an emitter usually needs to have rules for its lifetime, thus the effect should have one or more lifetime components that handle lifetime duties for the emitter and emitted particles.

The idea is that new components can be added later, and one can combine components (where it makes sense) to get different behaviors. A particle might have a Dynamic component for moving around, and a Collision component for handling interaction with the terrain, for example.

Think of components as telling the particle system what you want the emitter or particle to do, rather than exposing a list of particle parameters and having to wrangle those parameters to get the desired behavior.
Back to top

Namespacing

All particle effects should be namespaced (in their name).

Namespacing involves adding a 'name:' prefix on the effect tag.

Regular Minecraft will use the 'minecraft: prefix. See the examples for example names.
Back to top

MoLang integration

Where it makes sense, any field can use a MoLang expression. MoLang expressions are strings, and are defined in the MoLang documentation. The particle system uses some special MoLang variables that particle MoLang expressions can use. Additionally, custom MoLang paramaters can be set in various ways and used in MoLang expressions in effects.

Parameters

Name Description
variable.particle_lifetime How long the particle lives for
variable.particle_age How long the particle has lived
variable.particle_random_1 A random from 0.0 to 1.0 that is constant for the lifetime of the particle
variable.particle_random_2 Another random from 0.0 to 1.0 that is constant for the lifetime of the particle
variable.particle_random_3 A third random from 0.0 to 1.0 that is constant for the lifetime of the particle
variable.particle_random_4 A fourth random from 0.0 to 1.0 that is constant for the lifetime of the particle
variable.emitter_lifetime How long the current loop lasts for the emitter
variable.emitter_age Age since the current loop started for the emitter
variable.emitter_random_1 A random from 0.0 to 1.0 that is constant for the current loop of the emitter
variable.emitter_random_2 Another random from 0.0 to 1.0 that is constant for the current loop of the emitter
variable.emitter_random_3 A third random from 0.0 to 1.0 that is constant for the current loop of the emitter
variable.emitter_random_4 A fourth random from 0.0 to 1.0 that is constant for the current loop of the emitter
variable.entity_scale When the effect is attached to an entity, this value is the scale of the entity
Back to top



Basic Structure Overview

Particle effects consist of basic render parameters, and a set of components. Components can be placed in any order.

Outline:

Back to top

Structure In Detail

Outline:

Back to top

Current Component List

For fields in these components, the following shorthand is used:

Back to top

Emitter Components

Initial State Components

Emitter Local Space component

This component specifies the frame of reference of the emitter. Applies only when the emitter is attached to an entity. When 'position' is true, the particles will simulate in entity space, otherwise they will simulate in world space. Rotation works the same way for rotation. Default is false for both, which makes the particles emit relative to the emitter, then simulate independently from the emitter. Note that rotation = true and position = false is an invalid option.



Back to top

Emitter Initialization component

This component allows the emitter to run some Molang at creation, primarily to populate any MoLang variables that get used later.



Back to top



Emitter Rate Components

Emitter Rate Instant component

All particles come out at once, then no more unless the emitter loops.



Back to top

Emitter Rate Steady component

Particles come out at a steady or MoLang rate over time.



Back to top

Emitter Rate Manual component

Particle emission will occur only when the emitter is told to emit via the game itself. This is mostly used by legacy particle effects.



Back to top



Emitter Lifetime Components

Emitter Lifetime Looping component

Emitter will loop until it is removed.



Back to top

Emitter Lifetime Once component

Emitter will execute once, and once the lifetime ends or the number of particles allowed to emit have emitted, the emitter expires.



Back to top

Emitter Lifetime Expression component

Emitter will turn 'on' when the activation expression is non-zero, and will turn 'off' when it's zero. This is useful for situations like driving an entity-attached emitter from an entity variable.



Back to top



Emitter Shape Components

Shape controls both where the particles are emitted from and the initial direction of the particles.

Emitter Shape Point component

All particles come out of a point offset from the emitter.



Back to top

Emitter Shape Sphere component

All particles come out of a sphere offset from the emitter.



Back to top

Emitter Shape Box component

All particles come out of a box of the specified size from the emitter.



Back to top

Emitter Shape Custom component

All particles are emitted based on a specified set of MoLang expressions.



Back to top

Emitter Shape Entity-AABB component

All particles come out of the axis-aligned bounding box (AABB) for the entity the emitter is attached to, or the emitter point if no entity.



Back to top





Particle Components

Particle Initial State Components

Particle Initial State component

Starts the particle with a specified orientation and rotation rate.



Back to top

Particle Initial Speed component

Starts the particle with a specified speed, using the direction specified by the emitter shape.



Back to top



Particle Motion Components

Particle Motion Dynamic component

This component specifies the dynamic properties of the particle, from a simulation standpoint what forces act upon the particle? These dynamics alter the velocity of the particle, which is a combination of the direction of the particle and the speed. Particle direction will always be in the direction of the velocity of the particle.



Back to top

Particle Motion Parametric component

This component directly controls the particle. Note that this component won't work for either manually-emitted particles, or entity-based particle emitters that aren't in local space.



Back to top

Particle Motion Collision component

This component enables collisions between the terrain and the particle. Collision detection in Minecraft consists of detecting an intersection, moving to a nearby non-intersecting point for the particle (if possible), and setting its direction to not be aimed towards the collision (usually perpendicular to the collision surface). Note that if this component doesn't exist, there will be no collision.



Back to top



Particle Appearance Components

Particle Appearance Billboard component

This component tells the particle system to render the particle as a billboard, a rectangle in the world facing a particluar direction.



Back to top

Particle Appearance Tinting component

Color tinting of the particle is controlled by this component:



Back to top

Particle Appearance Lighting

When this component exists, particle will be tinted by local lighting conditions in-game.



Back to top



Particle Lifetime Components

Particle Lifetime Expression component

Standard lifetime component. These expressions control the lifetime of the particle.



Back to top

Particle Expire If In Blocks component

Particles expire when in a block of the type in the list. Note: this component can exist alongside particle_lifetime_expression.



Back to top

Particle Expire If Not In Blocks component

Particles expire when in a block of the type not in the list. Note: this component can exist alongside particle_lifetime_expression.



Back to top







Examples

Flame particle

This particle is the little flame that appears on torches and furnaces to indicate fire. It is a simple particle, consisting of a non-moving flame, with some variations. Note the use of MoLang to create variations in the particle behavior.

In addition, the use of texturewidth/height in the UV section of the billboard component allows referencing of UVs via texels:



Back to top

Smoke particle

This particle is the general-purpose smoke puff. It appears on torches, furnaces, Blazes, etc. It is a simple particle with an upward motion consisting of an upwards acceleration tempered by drag.

The main feature of this particle different from the flame particle is the flipbook texture animation. See the details in the particle below, but the effect uses a flipbook subpart of the billboard appearance component to drive uv coordinates from frame to frame over time.

In addition, the use of texturewidth/height in the UV section of the billboard component allows referencing of UVs via texels for the flipbook:



Back to top

Mob Flame effect

The mob flame effect is used by the Blaze when it's charging up to hurl fireballs. This is a flipbook flame effect that rises over time.

Unlike the earlier particles, this is a regular emitter. It is tied to an entity, thus uses the entity_aabb shape, as we want the flames to appear all over the blaze. As the effect is tied to the charged state, the activation expression is used, tied to the EntityFlag::CHARGED entity variable. This causes the flames to appear when the Blaze is charging, then to disappear when it isn't.

In this case, we use the texturewidth/height to make the texel "resolution" be one frame of animation, thus allowing advancement of the frames to be just 1:



Back to top

Bouncing Bubbles

This particle effect generates a bunch of bubbles that bounce around.



Back to top



Particles Entity Integration


One of the primary uses for emitting particles in the Bedrock engine is particles associated with entities, such as mobs. Examples can be when the Blaze flames-up during it's attack sequence, or the Evoker's spell effect while summoning Vexes. The goal is to allow binding and management of particle effects attached to entities.

The following concepts are important for managing particles with entities via .json:
- Effect lists. These live in the resource definition of the entity's .json, along with textures, etc. These list the effects available to the entity, with an internal entity name for the effect, and the associated effect to play.
- Locators. These live in the geometry files, and specify a location in the geometry. These locators can be associated with bones, and thus follow the bone as it animates.
- Animation controller-based particle management. Using the Animation Controller state machine concept, one can trigger both fire-and-forget and sustained particle effects
- Animation timeline particle management. As part of an animation .json for the entity, one can set up a timeline that triggers particle effects at specified times while the animation is playing. Note that an actual physical animation is not needed, just the animation .json structure.

Particles that are attached to entities are intrinsically tied to those entities. If the entity ceases to exist, the particle effects cease as well. Emitters follow either the entity, or a locator on the entity.

Effect List

The effect list is a list of internal effect names to actual particle effects bindings. This is the general form for adding particle effects to an entity. The effect list consists of a list of shorthand names to actual effects. All references to effects will use the shorthand name in animations and animation controllers. Note that this by itself will not cause the particle effect to appear.



Back to top

This is an example of the flame-up effect for the Blaze. Inside the "description" section of an entity's resource definition we can add a "particle_effects" section that has a name/value pair. The name is the name that other .json in the entity will refer to, while the value is the name of the particle effect, as specified in the particle effect's .json.



Back to top

Effect Event


Particle events in the entity have the following properties:
- "effect" is the effect name specified in the entity's resource definition .json (the particle effect list), this specifies what particle effect to start/play
- "locator" is an optional parameter that maps to a locator of the same name in the resource definition. By specifying a locator, the emitter will follow that locator around as the entity animates, including orientation. If this is not specified, the effect will occur at the origin of the entity.
- "pre_effect_script" is an optional parameter that is a MoLang expression run at emitter startup time. This can set up MoLang variables, (for example 'particle color'), which can be then referred to inside the particle effect .json itself.



Back to top

Animation Controller effects


Animation controllers can specify effect events for their states. This allows for a list of particle effects to be started upon state entry, and for those particle effects to be automatically ended when leaving the state. For particles that don't terminate (or don't terminate prior to state transition), they will be terminated at state exit.

The schema is:
"particle_effects": [
// array of effect events
]
The array syntax allows for more than one effect to be triggered on state entry.

An example is the Blaze's flame-up effect in it's animation controller. This animation controller has two states, "default" and "flaming". It transitions between the two via the "query.is_charged" entity flag check. When in the "flaming" state, the "charged_flames" effect is started (with no locator or initialization MoLang expression), and is terminated when the state exits.



Back to top


Another example for the Evoker's spell effect. This causes the evoker to start up two "spell" effects, using the locator for the left and right hand. The spell effects themselves are continuous, so the emitters will emit particles until the evoker is no longer casting a spell.



Back to top

Animation Timeline effects

Animations can also trigger particle effects. These are fire-and-forget effects that are tied to a timeline, when the animation hits that time point, the effect(s) are fired.



Back to top

time1/time2/etc are numerical time points, e.g. "0.0".

In this example, when the cat sits down, after 3 seconds a smoke puff is generated:



Back to top