EFFECTS // THREE.JS
How to make a dust effect in three.js
In three.js, you can play a dust burst that plays once, a landing ring or thrown earth. A snippet loads the packed RGBA sprite sheet on a THREE.Sprite, sets the texture repeat to one eighth, and removes it after the last frame. Godot 4 gets a ready scene that relights the smoke.
- Godot 4 Available
- Unity Manual setup
- Unreal Engine Manual setup
- Roblox Studio Manual setup
- three.js Available
A draft compile is from $0.05, and new accounts start with $5 of usage.
01 // WHAT YOU GET
What you get for dust in three.js
Two examples carry dust. The dust ring spreads out low along the ground for 2.1 seconds, about 10.5 m wide and only 2.2 m tall, like a blast wave or a heavy landing. The impact throws earth up with a flash and a little smoke in 2 seconds.
Each compile is four 2048 px PNG sheets of 64 frames on an 8 x 8 grid, a layout.json with the timing, and previews. The sheets carry lighting from six directions and the flame separately, not one painted color image, so three.js needs a small material to show them.
02 // HOW TO
Play the dust in three.js
- Ask your agent for the effect (for example "a dust puff about 2 m wide when a character lands") with
export.packwriting the light from above into RGB and opacity into alpha, so one PNG holds gray shading you can tint. (main_pos.pngas it comes holds three light directions in RGB, not a color.) Load it withTextureLoaderand settexture.repeat.set(1 / 8, 1 / 8). - Put it on a
THREE.Spritewith aSpriteMaterial(transparent: true,depthWrite: false) so it always faces the camera. Normal blending suits smoke; tint it with the material color. - Each frame, pick the tile: column
i % 8and rowMath.floor(i / 8), then settexture.offset.set(col / 8, 1 - (row + 1) / 8). - The dust's frames crowd its fast start, so pick
ifrom the clock:i = layout.frame_times_s.findIndex((t) => t >= elapsed). When that returns -1, after 3 s, callsprite.removeFromParent()andmaterial.dispose(). - Set
sprite.scale.set(s, s, 1)withsthe meters per tile fromlayout.json, a little over 10.5 m for the dust, so it shows at its real size.
03 // REAL OUTPUT
Compare the dust examples
These clips are final-quality compiles of the shipped examples, played from their own sheets. Your agent can start from any of them.
04 // ADJUST IT
Adjust the dust for your scene
Dust reads best close to the ground, so line the bottom of the effect up with your terrain. Ask your agent for a smaller ring for a character landing, a sandier color for a desert map, or a taller spray for a vehicle.
Both are one-shots that end once the dust has settled.
05 // WHICH ONE
Pick a dust example
How do I import a dust sprite sheet into three.js?
Load the PNG with TextureLoader, set repeat to one eighth on both axes and put it on a SpriteMaterial with transparent true.
How do I randomize the starting frame of several three.js dust sprites?
Give each sprite its own texture with texture.clone() and start its frame counter at a random integer from 0 to 63.
How do I play a dust burst once and remove it in three.js?
Pick each frame from layout.frame_times_s, stop after frame 63, then call sprite.removeFromParent() and material.dispose().
What resolution does each dust frame use?
Each frame is 256 px square on a 2048 px sheet by default, which is plenty for dust seen from a few meters away.
Compile your first effect
You pay per compile and see the price before it runs. New accounts start with $5 of usage.