Particle systems
An emitter, particles with a lifetime, forces, Euler integration step by step, recycling in an object pool and the loop that emits, updates, removes and draws.
- 28 cards
- 6 topics
- Free
The outline, topic by topic
Each topic is weighted the way the exam weighs it.
- Concepts
- Questions
- The numbers
- Predict, then see
- Scenarios
- Understand
A few cards from the deck
Particle system: what is it?
Show the answer
A set of many small, simple elements, each with a position, a velocity and a lifetime, updated together to imitate smoke, fire, sparks or rain.
Each particle follows very simple rules; it is their number and small differences at the start that create the overall effect.
What does this program print?
```python
x, v = 0.0, 2.0
g = -1.0
for _ in range(3):
v += g
x += v
print(x, v)`0.0 -1.03.0 -1.06.0 2.0-1.0 0.0
Show the answer
0.0 -1.0At each step the velocity first becomes 1, 0, −1, and the position adds these new velocities: 1 + 0 + (−1) = 0.
3.0 -1.0is the result if the position uses the old velocity (2, 1, 0);6.0 2.0ignores gravity.On each frame, a particle system's loop follows the order: …, apply the forces and …, age and remove the dead ones, then ….
Show the answer
On each frame, a particle system's loop follows the order: emit, apply the forces and integrate, age and remove the dead ones, then draw.
Drawing last guarantees the frame shows the up-to-date state; removing the dead ones before drawing avoids showing a particle already at the end of its life.
Emitter: what is it?
Show the answer
The source that creates the particles at a given rate (particles per second), from a position, with a direction and a starting speed, often drawn at random within a range.
Drawing the starting direction and speed at random avoids a regular column: without it, all the particles would follow the same path.