Skip to content

Tutorials · Particle Effects · Chapter 7

Streaks

15 minutes Uses: ParticleEmitter

By the end

  • Rain that streaks: raindrop.png and Stretch, so each drop is long while it is fast
  • Sparks with a trail of three, ghosts of where each has just been
  • What Stretch and Trail cost, and which one costs nothing extra
On this page

Rain that streaks

Chapter 4’s rain is faint: each drop is a soft dot two units across, and a dot falling fast does not look fast. A real drop is too quick to see sharp, and the eye reads a streak. Stretch draws each particle long, in the direction it is flying, and longer the faster it goes.

  1. Select rain. Set Texture to raindrop.png, a small pale dash that came with the starter.
  2. In the same Sprite group, tick Stretch. A new one is Length Scale 1 and Speed Scale 0.005. Set Speed Scale to 0.012, and leave Length Scale at 1.
  3. Press Ctrl+S, then F5 to see the rain, and F5 again to stop.
rain selected, its Inspector narrowed with the search box to the rows that mention stretch: under Sprite, Stretch ticked, with Length Sc… 1.00 and Speed Scale 0.012; in the Viewport the node’s arrow runs down from the top edge of the picture
Stretch
Draws each particle stretched along its flight instead of square. A particle’s length is its size times (Length Scale plus Speed Scale times its speed), and its width stays its size. Off, every particle is a square. On, a still particle is square and a fast one a streak, so the shape itself says how fast it is going.
Length Scale
The length of a particle that is standing still, as a multiple of its size. 1 leaves it square, which is what makes a stretch read as speed and not as another picture. Above 1 a particle is long even at rest; 0 to 1 is where it looks right. Here 1.
Speed Scale
How much length each unit of speed adds, as a multiple of the size. It has no unit of its own: with Length Scale at 1 it is the reciprocal of the speed at which a particle doubles in length, so 0.005 doubles it at 200 units a second. Here 0.012: a drop falling at about 400 units a second is 1 + 0.012 × 400 times its size long, nearly six. 0.005 to 0.03 suits rain and sparks; 0 makes the stretch do nothing.
Close up of a patch of sky above the roofs at night, with its dark clouds and a few stars, in which chapter 6’s rain, soft dots two units across, can barely be seen
Close up, for comparison: chapter 6’s rain of soft dots. They are all but invisible.
The same patch of sky with the raindrop texture and no Stretch: a few small pale squares, each a short dash drawn into a square, scattered over the sky
Close up, for comparison: the raindrop texture with no Stretch. Each drop is a small square.
The same patch of sky with Stretch on, Speed Scale 0.012: pale thin streaks, each a short line leaning a little to the right as it falls
Close up: streaks.
The same patch of sky with Speed Scale 0.03: the same drops as much longer thin lines, each several times the length of the streaks before
Close up, for comparison, Speed Scale 0.03: long, thin lines.

Sparks that trail

A spark is quick, and a trail is the cheapest way to show where it has just been. A trail is not a ribbon: it is a few copies of the spark, left at the places it was in the last few steps of the game, each smaller and fainter than the one in front.

  1. Select forge_sparks. Set Trail to 3.
  2. Press Ctrl+S.
forge_sparks selected, its Inspector narrowed with the search box to the rows that mention trail: Trail on a slider with the number 3; in the Viewport the node sits just above the forge’s floor
Trail
How many past positions each particle draws behind it, from 0 to 4: 0 is none. Each is a copy one step older than the one in front, smaller and fainter by an equal share: at 3, three quarters, a half and a quarter of the spark’s size and alpha. A step is a sixtieth of a second, so a trail is a length of time, not of distance, and the faster a spark flies the longer its trail. Here 3. It is a different thing from the Trail component that chapter 14 puts on a bat, which draws one ribbon behind a node.
Close up of the forge’s mouth with its flames and sparks and no trail: the sparks are single small bright bars and dots, each on its own, some pointing along their flight
Close up, for comparison, Trail 0.
The same close up with Trail 3: each spark has a short line of small orange dots behind it, each smaller and fainter than the one before, like a dashed streak pointing back along where it came from
Close up: each spark trails three ghosts of where it was.

The rain and the forge sparks

The rain

FieldValue
Position320, -12
Rate120
Lifetime1.1
Speed340
Direction0.12, 1
Spread0.04
Gravity200
Start Color0.7, 0.82, 0.9, alpha 0.7
End Color0.7, 0.82, 0.9, alpha 0.5
Start Size2
End Size2
Capacity144
Sort Layer8
Textureraindrop.png
ShapeLine, Length 720
Stretchticked: Length Scale 1, Speed Scale 0.012

The forge sparks

FieldValue
Everything from chapter 6as in its table
Trail3

Every other field is as a new Particles node has it.

Check it works