Urgent.News

What's breaking now, across thousands of outlets.

Tech

Footstep dust in Three.js with a pool of four effects

A footstep effect has two separate rates: how often the character asks for a puff, and how many particles each puff emits. Keeping those separate makes it possible to budget a repeated effect without tying it to the display refresh rate. This NixieFX tutorial uses an intentionally simple character proxy, a moving box, with a dust request every 15 simulation frames. At a fixed step of 1/60 second,…

Footstep dust in Three.js is demonstrated using a pool of four effects to manage emissions without allocating new instances after setup. The tutorial utilizes an intentionally simple character proxy, a moving box, with a dust request every 15 simulation frames, equating to four requests per simulated second. Each request restarts one of the available effects containing a 12-particle burst, lasting 0.7 seconds with a brief 0.05-second emission duration.

A pool of four effects is implemented to handle the requested cadence, retaining instances no longer than necessary and dropping extra puffs when the pool is full to avoid visible interruption of existing particles. Testing on a macOS Chrome browser yielded 12 requests, 12 effect reuses, zero dropped requests, and four retained effect instances in one three-second demonstration.

The pool's capacity should be determined through testing various scenarios such as faster characters, more characters, longer particle lifetimes, or slower completion conditions. Once the owning scene is released, any retained instances should be removed to prevent memory leaks.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Wednesday 14 October →