GUIDE // THREE.JS

How to orient three.js fire and smoke sprites toward the camera

Use THREE.Sprite with a SpriteMaterial, and three.js turns the quad to face the camera on every render with no code from you. For fire and smoke filmed from the side, a plane that turns only around its vertical axis often looks better, because it keeps the flames upright when the camera looks down from above.

  • 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.

FIREFINAL
First frame of the fire bake
Fire, 4.1 x 7.0 m, compiled with Spatial Compiler. Spec →

01 // THE OPTIONS

Two ways to face the camera

  • THREE.Sprite: always square to the camera, from any angle. Rotate it in its own plane with material.rotation, and move its pivot with sprite.center, for example sprite.center.set(0.5, 0) to stand it on its bottom edge.
  • A plane mesh turned around the Y axis only (a cylindrical billboard) stays upright while it swivels toward the camera. It suits the side-on sheets from Spatial Compiler, whose camera is orthographic and level by default.

02 // HOW TO

Keep a fire upright from any angle

  1. Make a PlaneGeometry the size of one frame and move it up by half its height with geometry.translate, so its origin sits on the ground.
  2. Give it your flipbook material and add it to the scene at the fire's base.
  3. Each tick, before rendering, call faceCameraUpright so the plane swivels toward the camera around Y.
faceCamera.js
const geometry = new THREE.PlaneGeometry(4, 4);
geometry.translate(0, 2, 0); // origin at the bottom edge
const fire = new THREE.Mesh(geometry, fireMaterial);
scene.add(fire);

function faceCameraUpright(mesh, camera) {
  const dx = camera.position.x - mesh.position.x;
  const dz = camera.position.z - mesh.position.z;
  mesh.rotation.set(0, Math.atan2(dx, dz), 0);
}

03 // REAL OUTPUT

Smoke from the side

The smoke plume leans with the wind. A Y-axis billboard keeps that lean pointing the same way however the camera circles.

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

04 // SIZE

Match the frame's shape

Scale the sprite or plane in the same ratio as one frame of the sheet, or the fire stretches. Every tile from Spatial Compiler is square and framed to fit the whole clip, so x and y scale stay equal, set from metres_per_tile in layout.json.

Godot 4 gets a ready scene that relights the smoke. three.js uses the documented snippet. A native six-way material is not built yet.

06 // FAQ

three.js camera-facing sprite questions

All questions →

README.THREEJS_SPRITES_FACE_CAMERA
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.

Does three.js support sprite sheets?

Yes, through texture.repeat and texture.offset, which crop a texture to one cell. Nothing built in animates it, so your code updates the offset each tick.

How do I prevent texture bleeding between adjacent frames in a three.js sprite sheet?

Leave transparent padding around each frame or disable mipmaps with texture.generateMipmaps = false and texture.minFilter = THREE.LinearFilter so small sprites do not average neighboring cells.

How do I orient three.js fire and smoke sprites toward the camera?

Use THREE.Sprite with SpriteMaterial to face the camera automatically or rotate a plane mesh around its Y axis toward the camera each frame.

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 →