EFFECTS // THREE.JS

How to make smoke in three.js

In three.js, you can play smoke that loops as a leaning plume or rises once after a blast. A snippet loads the packed RGBA sprite sheet on a THREE.Sprite, sets the texture repeat to one eighth, and loops it or removes it. 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.

SMOKE_PLUMEFINAL
First frame of the smoke_plume bake
Smoke plume, 7.0 x 10.8 m, compiled with Spatial Compiler. Spec →

01 // WHAT YOU GET

What you get for smoke in three.js

Two smoke examples cover steady and one-time smoke. The smoke plume leans with the wind and loops every 4 seconds, about 7 m wide and 10.8 m tall, like smoke from a chimney or a wreck. The smoke column climbs, spreads and thins over 5 seconds after a burst, about 8.2 by 9.9 m.

Each compile is three 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, not one painted color image, so three.js needs a small material to show them.

02 // HOW TO

Play the smoke in three.js

  1. Ask your agent for the effect (for example "dark smoke rising from a burning car, looping") with export.pack writing the light from above into RGB and opacity into alpha, so one PNG holds gray shading you can tint. (main_pos.png as it comes holds three light directions in RGB, not a color.) Load it with TextureLoader and set texture.repeat.set(1 / 8, 1 / 8).
  2. Put it on a THREE.Sprite with a SpriteMaterial (transparent: true, depthWrite: false) so it always faces the camera. Normal blending suits smoke; tint it with the material color.
  3. Each frame, pick the tile: column i % 8 and row Math.floor(i / 8), then set texture.offset.set(col / 8, 1 - (row + 1) / 8).
  4. Wrap the plume with i % 64 (64 frames in 4 s). The column's frames crowd its start, so pick its frame with layout.frame_times_s.findIndex((t) => t >= elapsed) and remove the sprite when that returns -1, at 6 s.
  5. Set sprite.scale.set(s, s, 1) with s the meters per tile from layout.json, a little over 10.8 m for the smoke, so it shows at its real size.

03 // REAL OUTPUT

Compare the smoke examples

SMOKE_COLUMNFINAL
First frame of the smoke_column bake
Smoke column, 8.2 x 9.9 m, compiled with Spatial Compiler. Spec →

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 smoke for your scene

Lighting matters most for smoke, because a flat sprite looks wrong the moment your sun moves. Ask your agent for thicker or thinner smoke, a different color, or more lean in the wind.

Put the plume where something keeps burning and play the column once after an explosion ends.

05 // WHICH ONE

Pick a smoke example

  • smoke_plume: Chimney or wreck smoke leaning with the wind. Loops, 7.0 x 10.8 m, 4 s loop.
  • smoke_column: Smoke left after a burst. It climbs, spreads and thins. Plays once, 8.2 x 9.9 m, 5.0 s.

Each one has its own page: Smoke plume, Smoke column.

07 // FAQ

Questions about smoke in three.js

All questions →

README.THREEJS_SMOKE
Is there a smoke effect for three.js?

Yes. Ask your agent for dark smoke rising from a burning wreck, starting from the smoke_plume or smoke_column example.

How do I import a smoke 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 smoke 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 make smoke sprites blend cleanly over a three.js scene?

Set transparent true and depthWrite false on the material, draw smoke after opaque objects and sort overlapping sprites back to front.

How many frames does a smoke effect use?

The smoke compiles use 64 frames: the plume loops every 4 seconds and the column plays over 5 seconds.

Compile your first effect

You pay per compile and see the price before it runs. New accounts start with $5 of usage.

All effects, guides and explainers →