EFFECTS // THREE.JS
How to make an impact effect in three.js
In three.js, you can play a shell impact with a flash, thrown earth and smoke in 2 seconds. 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 impact in three.js
The impact is a shell hitting dry ground: a bright flash, a spray of thrown earth and a little smoke, about 3.5 m wide and 2.8 m tall. Three emitters share one simulation: the flash is hot and short, and the earth is cold, so it falls back. It plays once in 2 seconds.
You get four PNG sheets of 64 frames, a layout.json with the timing, and previews, which three.js plays through a small material.
02 // HOW TO
Play the impact in three.js
- Ask your agent for the effect (for example "a mortar hit on dry ground that plays once") 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. For the flame, make a second texture in an image editor,main_colour.pngmultiplied by the alpha ofmain_neg.pngsquared, and draw it on a second sprite withTHREE.AdditiveBlending. That texture is normalized, so restore the peak on the flame sprite withmaterial.color.setScalar(emitMax), whereemitMaxisscales.emit_max_hdr. - Each frame, pick the tile: column
i % 8and rowMath.floor(i / 8), then settexture.offset.set(col / 8, 1 - (row + 1) / 8). - The impact'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.2 s, callsprite.removeFromParent()andmaterial.dispose(). - Set
sprite.scale.set(s, s, 1)withsthe meters per tile fromlayout.json, a little over 3.5 m for the impact, so it shows at its real size.
03 // ADJUST IT
Adjust the impact for your scene
Use it for artillery, grenades, rockets and heavy hits. Ask your agent for a wetter, darker spray for mud, a smaller hit for bullets on dirt, or a stronger flash for a night map.
04 // SETTINGS
Settings in the impact spec
Three emitters share one simulation: a hot, short flash, cold earth that falls back, and a little smoke.
Ask your agent to change these and compile again; the full impact spec lists every value.
How do I play an impact effect once and remove it in three.js?
Pick each frame from layout.frame_times_s, stop after frame 63 at 2 seconds, then call sprite.removeFromParent() and material.dispose().
How do I make a realistic impact effect in three.js?
Start from a simulated impact instead of manual particles. Three emitters share one simulation: a hot flash, falling earth and smoke.
How do I keep an impact effect in proportion in three.js?
Keep the Sprite square because every tile is square. Set sprite.scale.set(s, s, 1) using the meters per tile from layout.json.
How many frames does the impact effect use?
The impact compile uses 64 frames over 2 seconds and gives more frames to the fast burst at the start.
Compile your first effect
You pay per compile and see the price before it runs. New accounts start with $5 of usage.