Divooka Reference

Particles

16 nodes

On this page 16

Add Particle Burst

Function

The scene with a burst: particles thrown from a ball all at once at a moment, in every direction, glowing or solid. Debris from an impact, a firework's shell.

Signature
AddParticleBurst -> Particle Scene Description
    scene: Particle Scene Description
    name: Text
    position: Vector3d
    radius: Number
    count: Integer
    speed: Number
    time: Number
    lifetime: Number
    glowing: Truth
ParticleSceneDescription AddParticleBurst(
    ParticleSceneDescription scene,
    string name,
    Vector3d position,
    double radius = 0.1,
    int count = 20000,
    double speed = 6,
    double time = 0,
    double lifetime = 3,
    bool glowing = true)

Parameters

nametypedefaultdescription
sceneParticle Scene Description—The scene.
nameText—The emitter's name.
positionVector3d—The ball's centre (m).
radiusNumber0.1Its radius (m).
countInteger20000How many particles.
speedNumber6How fast they are thrown (m/s).
timeNumber0When (s).
lifetimeNumber3How long they last (s).
glowingTruthTrueGlowing sparks; off, solid grey debris.

Returns

resultParticle Scene Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Particles
Package
Physics Simulation

Add Particle Emitter

Function

The scene with a ball that gives off particles of one's own making: solid specks lit by the sun, or glowing ones when Glow is above 0.

Signature
AddParticleEmitter -> Particle Scene Description
    scene: Particle Scene Description
    name: Text
    position: Vector3d
    radius: Number
    rate: Number
    velocity: Vector3d
    spread: Number
    lifetime: Number
    size: Number
    colour: Color
    glow: Number
ParticleSceneDescription AddParticleEmitter(
    ParticleSceneDescription scene,
    string name,
    Vector3d position,
    double radius,
    double rate,
    Vector3d velocity,
    double spread,
    double lifetime,
    double size,
    ColorElement colour,
    double glow = 0)

Parameters

nametypedefaultdescription
sceneParticle Scene Description—The scene.
nameText—The emitter's name.
positionVector3d—Its centre (m).
radiusNumber—Its radius (m).
rateNumber—Particles born per second.
velocityVector3d—The velocity they are born with (m/s).
spreadNumber—The speed of the random part of that velocity (m/s).
lifetimeNumber—How long a particle lives (s).
sizeNumber—A particle's radius (m).
colourColor—A particle's colour.
glowNumber0How brightly it glows; 0 is a solid speck.

Returns

resultParticle Scene Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Particles
Package
Physics Simulation

Add Particle Obstacle Box

Function

The scene with a solid box that particles bounce off.

Signature
AddParticleObstacleBox -> Particle Scene Description
    scene: Particle Scene Description
    name: Text
    position: Vector3d
    size: Vector3d
ParticleSceneDescription AddParticleObstacleBox(
    ParticleSceneDescription scene,
    string name,
    Vector3d position,
    Vector3d size)

Parameters

nametypedefaultdescription
sceneParticle Scene Description—The scene.
nameText—The solid's name.
positionVector3d—Its centre (m).
sizeVector3d—Its size (m) along X, Y and Z.

Returns

resultParticle Scene Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Particles
Package
Physics Simulation

Add Particle Obstacle Sphere

Function

The scene with a solid ball that particles bounce off.

Signature
AddParticleObstacleSphere -> Particle Scene Description
    scene: Particle Scene Description
    name: Text
    position: Vector3d
    radius: Number
ParticleSceneDescription AddParticleObstacleSphere(
    ParticleSceneDescription scene,
    string name,
    Vector3d position,
    double radius)

Parameters

nametypedefaultdescription
sceneParticle Scene Description—The scene.
nameText—The solid's name.
positionVector3d—Its centre (m).
radiusNumber—Its radius (m).

Returns

resultParticle Scene Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Particles
Package
Physics Simulation

Add Snowfall

Function

The scene with snow falling from a slab of air: white flakes that drift with the wind and the turbulence and settle. Snow wants an air that carries it: New Particles with Drag about 6, Turbulence about 0.7 and Bounce 0.

Signature
AddSnowfall -> Particle Scene Description
    scene: Particle Scene Description
    name: Text
    position: Vector3d
    size: Vector3d
    rate: Number
    lifetime: Number
ParticleSceneDescription AddSnowfall(
    ParticleSceneDescription scene,
    string name,
    Vector3d position,
    Vector3d size,
    double rate = 8000,
    double lifetime = 9)

Parameters

nametypedefaultdescription
sceneParticle Scene Description—The scene.
nameText—The emitter's name.
positionVector3d—The middle of the slab the flakes are born in (m).
sizeVector3d—The slab's size (m) along X, Y and Z.
rateNumber8000Flakes per second.
lifetimeNumber9How long a flake lasts (s): long enough to reach the ground and lie there a while.

Returns

resultParticle Scene Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Particles
Package
Physics Simulation

Add Spark Fountain

Function

The scene with a fountain of sparks: glowing streaks thrown from a point, yellow turning red as they cool, which fall and bounce.

Signature
AddSparkFountain -> Particle Scene Description
    scene: Particle Scene Description
    name: Text
    position: Vector3d
    direction: Vector3d
    rate: Number
    spread: Number
    lifetime: Number
ParticleSceneDescription AddSparkFountain(
    ParticleSceneDescription scene,
    string name,
    Vector3d position,
    Vector3d direction,
    double rate = 30000,
    double spread = 1.1,
    double lifetime = 2.6)

Parameters

nametypedefaultdescription
sceneParticle Scene Description—The scene.
nameText—The emitter's name.
positionVector3d—Where the sparks come from (m).
directionVector3d—The velocity they are thrown with (m/s): (0, 0, 6) is straight up, to about two metres.
rateNumber30000Sparks per second.
spreadNumber1.1The speed of the random part of their velocity (m/s): what opens the jet into a fountain.
lifetimeNumber2.6How long a spark glows (s).

Returns

resultParticle Scene Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Particles
Package
Physics Simulation

Export Particle Flipbook

Function

Runs the scene and writes a flipbook of its particles as a PNG with transparency, with its layout beside it as a text file. Returns the PNG's path.

Signature
ExportParticleFlipbook -> Text
    scene: Particle Scene Description
    path: Text
    duration: Number
    eye: Vector3d
    target: Vector3d
    columns: Integer
    rows: Integer
    frameSize: Integer
    fieldOfView: Number
    showGlow: Truth
string ExportParticleFlipbook(
    ParticleSceneDescription scene,
    string path,
    double duration,
    Vector3d eye,
    Vector3d target,
    int columns = 8,
    int rows = 8,
    int frameSize = 256,
    double fieldOfView = 40,
    bool showGlow = true)

Parameters

nametypedefaultdescription
sceneParticle Scene Description—The scene.
pathText—The PNG to write; its folder is created if missing.
durationNumber—How long to run (s).
eyeVector3d—Where the camera stands (m).
targetVector3d—What it looks at (m).
columnsInteger8Frames in a row.
rowsInteger8Rows of frames.
frameSizeInteger256A frame's width and height in pixels.
fieldOfViewNumber40The camera's vertical field of view in degrees.
showGlowTruthTrueGive glowing particles an alpha as bright as they are; off, they are colour without alpha, for a game that adds the sheet. The text file says which.

Returns

resultText
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Particles
Package
Physics Simulation

New Particles

Function

Empty air for particles to fly in, over a ground at height 0.

Signature
NewParticles -> Particle Scene Description
    gravity: Number
    wind: Vector3d
    drag: Number
    turbulence: Number
    bounce: Number
    ground: Truth
    dusk: Truth
ParticleSceneDescription NewParticles(
    double gravity = 9.81,
    Vector3d wind,
    double drag = 0.5,
    double turbulence = 0,
    double bounce = 0.4,
    bool ground = true,
    bool dusk = false)

Parameters

nametypedefaultdescription
gravityNumber9.81Gravity (m/s²), pointing down along -Z.
windVector3d—The wind (m/s).
dragNumber0.5How fast a particle takes the air's velocity (per second): 0 flies free of the air, 0.5 is a spark, 6 drifts like snow.
turbulenceNumber0The speed of the air's own swirls (m/s); 0 is still air.
bounceNumber0.4The share of its speed a particle keeps when it bounces: 0 lands and stays.
groundTruthTrueWhether there is a ground at height 0 to land on.
duskTruthFalseTake pictures under a dark sky, against which glowing particles show.

Returns

resultParticle Scene Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Particles
Package
Physics Simulation

Particle Count

Function

How many particles are alive in a recorded frame.

Signature
ParticleCount -> Integer
    result: Particle Result
    frame: Integer
int ParticleCount(ParticleResult result, int frame)

Parameters

nametypedefaultdescription
resultParticle Result—The run.
frameInteger—The recorded frame, from 0.

Returns

resultInteger
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Particles
Package
Physics Simulation

Particle Flipbook

Function

Runs the scene and takes frames of the particles by themselves, evenly over the run, into one picture with transparency: a flipbook, the sprite sheet a game plays sparks back from. Frames run from the left, rows from the top. A solid particle is opaque. A glowing one adds light and hides nothing, so exactly it is colour with no alpha at all, and a sheet of sparks so made shows as nothing wherever pictures are blended by their alpha: Show Glow gives the light an alpha as bright as it is.

Signature
ParticleFlipbook -> Pixel Image
    scene: Particle Scene Description
    duration: Number
    eye: Vector3d
    target: Vector3d
    columns: Integer
    rows: Integer
    frameSize: Integer
    fieldOfView: Number
    showGlow: Truth
PixelImage ParticleFlipbook(
    ParticleSceneDescription scene,
    double duration,
    Vector3d eye,
    Vector3d target,
    int columns = 4,
    int rows = 4,
    int frameSize = 128,
    double fieldOfView = 40,
    bool showGlow = true)

Parameters

nametypedefaultdescription
sceneParticle Scene Description—The scene.
durationNumber—How long to run (s).
eyeVector3d—Where the camera stands (m).
targetVector3d—What it looks at (m).
columnsInteger4Frames in a row.
rowsInteger4Rows of frames.
frameSizeInteger128A frame's width and height in pixels.
fieldOfViewNumber40The camera's vertical field of view in degrees.
showGlowTruthTrueGive glowing particles an alpha as bright as they are, so that they show in a viewer and in tools that blend by alpha. Off, they are colour without alpha: exact, for a game that adds the sheet to its picture.

Returns

resultPixel Image
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Particles
Package
Physics Simulation

Particle Frame Count

Function

How many frames a run recorded.

Signature
ParticleFrameCount(result: Particle Result) -> Integer
int ParticleFrameCount(ParticleResult result)

Parameters

nametypedefaultdescription
resultParticle Result—

Returns

resultInteger
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Particles
Package
Physics Simulation

Particle Frame Time

Function

The simulated time of a recorded frame (s).

Signature
ParticleFrameTime -> Number
    result: Particle Result
    frame: Integer
double ParticleFrameTime(ParticleResult result, int frame)

Parameters

nametypedefaultdescription
resultParticle Result—
frameInteger—

Returns

resultNumber
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Particles
Package
Physics Simulation

Particle Picture

Function

Runs the scene for a time and takes a picture of it: the ground, the solids and the particles.

Signature
ParticlePicture -> Pixel Image
    scene: Particle Scene Description
    time: Number
    eye: Vector3d
    target: Vector3d
    width: Integer
    height: Integer
    fieldOfView: Number
PixelImage ParticlePicture(
    ParticleSceneDescription scene,
    double time,
    Vector3d eye,
    Vector3d target,
    int width = 640,
    int height = 480,
    double fieldOfView = 40)

Parameters

nametypedefaultdescription
sceneParticle Scene Description—The scene.
timeNumber—How long to run before the picture (s).
eyeVector3d—Where the camera stands (m).
targetVector3d—What it looks at (m).
widthInteger640The picture's width in pixels.
heightInteger480The picture's height in pixels.
fieldOfViewNumber40The camera's vertical field of view in degrees.

Returns

resultPixel Image
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Particles
Package
Physics Simulation

Particle Points

Function

Where the particles of a recorded frame are (m): a point per live particle, which the 3D view draws.

Signature
ParticlePoints -> Vector3d Array
    result: Particle Result
    frame: Integer
Vector3d[] ParticlePoints(ParticleResult result, int frame)

Parameters

nametypedefaultdescription
resultParticle Result—The run.
frameInteger—The recorded frame, from 0.

Returns

resultVector3d Array
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Particles
Package
Physics Simulation

Particle Velocities

Function

How the particles of a recorded frame move (m/s): a velocity per live particle, in the order of Particle Points.

Signature
ParticleVelocities -> Vector3d Array
    result: Particle Result
    frame: Integer
Vector3d[] ParticleVelocities(ParticleResult result, int frame)

Parameters

nametypedefaultdescription
resultParticle Result—The run.
frameInteger—The recorded frame, from 0.

Returns

resultVector3d Array
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Particles
Package
Physics Simulation

Simulate Particles

Function

Runs the scene for a time and records its particles at every frame, for the point nodes to read. A frame of a hundred thousand particles is 2.4 MB, so record few frames of a busy scene (Keep Every).

Signature
SimulateParticles -> Particle Result
    scene: Particle Scene Description
    duration: Number
    framesPerSecond: Number
    keepEvery: Integer
ParticleResult SimulateParticles(
    ParticleSceneDescription scene,
    double duration = 2,
    double framesPerSecond = 30,
    int keepEvery = 1)

Parameters

nametypedefaultdescription
sceneParticle Scene Description—The scene.
durationNumber2How long to run (s).
framesPerSecondNumber30Frames per second of simulated time.
keepEveryInteger1Record every frame (1), every second one (2) and so on; the last frame is always recorded.

Returns

resultParticle Result
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Particles
Package
Physics Simulation