---
title: "Load a fire or smoke sprite sheet in three.js"
description: "Load a PNG sprite sheet in three.js: TextureLoader, texture.repeat set to one cell, a SpriteMaterial with transparent true, then texture.offset per frame."
canonical: https://appliedmanifold.com/guides/threejs-load-sprite-sheet/
site: "Applied Manifold: The spatial compute cloud for 3D reality"
---

1.  [Home](https://appliedmanifold.com/)
2.  [Guides](https://appliedmanifold.com/guides/)
3.  Load a sprite sheet

GUIDE // THREE.JS

# How to import a fire, smoke or explosion sprite sheet into three.js

Load the PNG with TextureLoader, set texture.repeat to one cell of the grid, such as 1/8 by 1/8, and use it as the map of a SpriteMaterial with transparent set to true. Move texture.offset to a new cell to change frames. Serve the file from your own site or with CORS headers, or the browser refuses to use it.

[Get Free API Key](https://console.appliedmanifold.com/sign-in?next=/api-keys) [See the examples →](https://appliedmanifold.com/docs/pyrofx/examples/)

-   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](/bakes/smoke_plume/poster.webp)

Smoke plume, 7.0 x 10.8 m, compiled with Spatial Compiler. [Spec →](https://appliedmanifold.com/docs/pyrofx/examples/#ex-smoke_plume)

01 // WHAT YOU LOAD

## One RGBA file, or several in a shader

A Spatial Compiler compile gives you four PNG sprite sheets, each 2048 x 2048 px with 64 frames on an 8 x 8 grid. None is a plain color image. The smoke's look comes from lighting precomputed from six directions, and the flame has its own channels.

SpriteMaterial reads one map, so for a quick start build one RGBA image: for smoke, the green of `main_pos.png` in RGB and its alpha in alpha. A `ShaderMaterial` can read the sheets as they are, as in [the smoke blending guide](https://appliedmanifold.com/guides/threejs-smoke-blending/).

02 // HOW TO

## Load the sheet onto a sprite

1.  Put the PNG in the folder your site serves, such as `public/fx/`.
2.  Load it with `TextureLoader` and set `colorSpace` to `THREE.SRGBColorSpace`, since a built-in material shows it as color.
3.  Set `texture.repeat` to 1/8 by 1/8 so the sprite shows one cell, and `texture.offset` to (0, 0.875) for frame 0 in the top-left corner.
4.  Make a `THREE.Sprite` with a `SpriteMaterial` using that map, `transparent: true` and `depthWrite: false`, and scale it to the effect's size.
5.  Change the offset over time to play the frames, as in [the loop guide](https://appliedmanifold.com/guides/threejs-loop-sprite-animation/).

loadSheet.js

```
import * as THREE from 'three';

const texture = new THREE.TextureLoader().load('/fx/smoke_rgba.png');
texture.colorSpace = THREE.SRGBColorSpace;
texture.repeat.set(1 / 8, 1 / 8);
texture.offset.set(0, 1 - 1 / 8); // frame 0, top-left cell

const material = new THREE.SpriteMaterial({ map: texture, transparent: true, depthWrite: false });
const sprite = new THREE.Sprite(material);
sprite.scale.set(10, 10, 1);
scene.add(sprite);
```

03 // REAL OUTPUT

## A fire sheet for the same code

The 2 s fire loads the same way. Build its flame image on black from `main_colour.png` times the squared alpha of `main_neg.png`, and draw it with additive blending. The image is normalized, so `material.color.setScalar(emitMax)`, with `emitMax` the `scales.emit_max_hdr` in `layout.json`, restores its peak.

**FIREFINAL**

![First frame of the fire bake](/bakes/fire/poster.webp)

Fire, 4.1 x 7.0 m, compiled with Spatial Compiler. [Spec →](https://appliedmanifold.com/docs/pyrofx/examples/#ex-fire)

04 // FILTERING

## Mipmaps and edge bleeding

three.js builds mipmaps (smaller copies for distant objects) for every loaded texture by default. On a sprite sheet they average pixels across cell borders, so a small, distant sprite can show a sliver of the next frame. Leave transparent pixels around each frame, or set `texture.generateMipmaps = false` with `texture.minFilter = THREE.LinearFilter`, which trades the bleed for some shimmer at a distance.

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.

05 // RELATED

## Related pages

-   [Import a sprite sheet Godot 4Import a PNG sprite sheet into Godot 4, choose the import settings that matter for effects and cut the grid on the node.](https://appliedmanifold.com/guides/godot-import-sprite-sheet/)
-   [Import a flipbook in Unity UnityBring a PNG fire or smoke flipbook into Unity with the right import settings and a single RGBA texture for the particle material.](https://appliedmanifold.com/guides/unity-import-flipbook/)
-   [Sprite sheet UV math three.jsTurn a frame number into texture offset and repeat values for a three.js sprite sheet, in JavaScript and in GLSL.](https://appliedmanifold.com/guides/threejs-sprite-sheet-uv/)
-   [three.js smoke plume three.jsA smoke plume that leans with the wind and loops every 4 seconds, played in three.js with a documented snippet.](https://appliedmanifold.com/effects/threejs-smoke-plume/)
-   [three.js VFX three.jsFire, smoke, explosion and dust effects in three.js: sprite sheets you play with a documented snippet, next to Godot 4's ready scene.](https://appliedmanifold.com/effects/threejs-vfx/)
-   [Sprite sheetA sprite sheet packs many frames into one image, so your engine loads a single texture and plays the frames in order.](https://appliedmanifold.com/learn/sprite-sheet/)
-   [OutputsWith the default export, each view writes four sheets, `<view>_pos.png`, `_neg.png`, `_colour.png` and `_aux.png`, plus `layout.json`, two still previews, the animated `preview_anim.png` and `bake_report.json`. Sheets are 8 x 8 tiles of 256 px by default.](https://appliedmanifold.com/docs/pyrofx/outputs/)

[All pages in Guides →](https://appliedmanifold.com/guides/)

[← Lit smoke in Roblox](https://appliedmanifold.com/guides/roblox-smoke-lighting/)[Sprite sheet UV math →](https://appliedmanifold.com/guides/threejs-sprite-sheet-uv/)

06 // FAQ

## three.js sprite sheet loading questions

[All questions →](https://appliedmanifold.com/faq/)

**README.THREEJS\_LOAD\_SPRITE\_SHEET**

### How to import a fire, smoke or explosion sprite sheet into three.js?

Load the PNG with `THREE.TextureLoader`, set `texture.repeat` to one grid cell and assign it to a `SpriteMaterial` map. Update `texture.offset` to change frames.

### 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 optimize many fire, smoke and explosion flipbooks for WebGL or WebGPU?

Share one texture across sprites, keep sheets at 1024 or 2048 pixels and draw large particle counts with `InstancedMesh` or `THREE.Points` instead of separate sprites.

## Compile your first effect

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

[Get Free API Key](https://console.appliedmanifold.com/sign-in?next=/api-keys) [Outputs →](https://appliedmanifold.com/docs/pyrofx/outputs/)

[All effects, guides and explainers →](https://appliedmanifold.com/effects/)
