---
title: "Additive blending for a three.js fire flipbook"
description: "Make a three.js fire flipbook look emissive: THREE.AdditiveBlending, transparent true and depthWrite false, with the flame decoded in a ShaderMaterial."
canonical: https://appliedmanifold.com/guides/threejs-additive-fire/
site: "Applied Manifold: The spatial compute cloud for 3D reality"
---

1.  [Home](https://appliedmanifold.com/)
2.  [Guides](https://appliedmanifold.com/guides/)
3.  Additive fire

GUIDE // THREE.JS

# How to make a three.js fire flipbook look emissive with additive blending

Set blending to THREE.AdditiveBlending on your fire's material, with transparent set to true and depthWrite set to false, so each flame pixel adds its color to whatever is behind it and black parts disappear. Keep smoke on normal blending in a separate material, because additive smoke turns into glowing fog.

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

**FIRE\_WHIRLFINAL**

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

Fire whirl, 4.4 x 7.1 m, compiled with Spatial Compiler. [Spec →](https://appliedmanifold.com/docs/pyrofx/examples/#ex-fire_whirl)

01 // WHAT YOU NEED

## Two sheets make the flame

In a Spatial Compiler compile the flame color is the RGB of `main_colour.png`, and its brightness is the alpha of `main_neg.png`, stored as a square root against a per-clip maximum so the white-hot core keeps detail in 8 bits. `layout.json` records that maximum as `scales.emit_max_hdr`.

The flame is the color times the squared brightness times that maximum. A `ShaderMaterial` can read both sheets and do the decode, so you skip combining images.

02 // HOW TO

## Build the fire material

1.  Load `main_colour.png` and `main_neg.png`, and leave their `colorSpace` at the default so the shader gets the stored values.
2.  Make a `ShaderMaterial` with both textures, the frame and `emitMax` as uniforms, and the blending settings in `fireMaterial.js`.
3.  Put it on a `PlaneGeometry` mesh and turn the mesh toward the camera each tick, as in [the camera-facing guide](https://appliedmanifold.com/guides/threejs-sprites-face-camera/).
4.  Set `uniforms.frame.value` each tick from elapsed time times 32, wrapped at 64.
5.  For a glow around the flames, add a bloom pass from the three.js postprocessing addons. Without it, values above 1 clip to white.

fireMaterial.js

```
const fireMaterial = new THREE.ShaderMaterial({
  uniforms: {
    colourMap: { value: colourTexture }, // main_colour.png
    negMap: { value: negTexture },       // main_neg.png
    frame: { value: 0 },
    emitMax: { value: 4.39 },            // scales.emit_max_hdr from layout.json (2 s fire)
  },
  vertexShader: `
    varying vec2 vUv;
    void main() {
      vUv = uv;
      gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
    }`,
  fragmentShader: `
    uniform sampler2D colourMap;
    uniform sampler2D negMap;
    uniform float frame;
    uniform float emitMax;
    varying vec2 vUv;
    void main() {
      vec2 cell = vec2(mod(frame, 8.0), 7.0 - floor(frame / 8.0));
      vec2 uv = (vUv + cell) / 8.0;
      float b = texture2D(negMap, uv).a;
      vec3 flame = texture2D(colourMap, uv).rgb * b * b * emitMax;
      gl_FragColor = vec4(flame, 1.0);
    }`,
  transparent: true,
  depthWrite: false,
  blending: THREE.AdditiveBlending,
});
```

03 // REAL OUTPUT

## A steadier flame

The 2 s fire has a lower, wider core than the whirl, and the same material plays it.

**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)

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.

04 // RELATED

## Related pages

-   [Fire that lights the scene Godot 4Light the area around a fire in Godot 4 with a flickering OmniLight3D and make the flame bloom with WorldEnvironment glow.](https://appliedmanifold.com/guides/godot-fire-light-nearby-objects/)
-   [Fire glow in Roblox Roblox StudioMake flipbook fire glow in Roblox Studio with LightEmission, Brightness, a BloomEffect and a PointLight.](https://appliedmanifold.com/guides/roblox-fire-glow/)
-   [Smoke blending three.jsBlend flipbook smoke over a three.js scene with normal blending, no depth writes and a small shader that reads the sheet.](https://appliedmanifold.com/guides/threejs-smoke-blending/)
-   [three.js fire whirl three.jsA fire whirl that spins flames into a 7 m column and loops every 2 seconds, played in three.js with a documented snippet.](https://appliedmanifold.com/effects/threejs-fire-whirl/)
-   [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/)
-   [HDR emissive fireHDR emissive fire stores flame brightness above white, so bloom makes the core glow while the smoke stays lit by the scene.](https://appliedmanifold.com/learn/hdr-emissive-fire/)
-   [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/)

[← Random start frame](https://appliedmanifold.com/guides/threejs-random-start-frame/)[Smoke blending →](https://appliedmanifold.com/guides/threejs-smoke-blending/)

05 // FAQ

## three.js additive fire questions

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

**README.THREEJS\_ADDITIVE\_FIRE**

### How do I blend flame and smoke in three.js?

Use two sprites. Put the flame on a SpriteMaterial with THREE.AdditiveBlending and the smoke on normal blending, both with depthWrite false.

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

### How do I make a fire flipbook glow without lighting the smoke?

Keep flame on an unlit additive or emissive material and smoke on a lit alpha blended material so only flame triggers bloom.

### How do compression, color space and HDR affect PNG and EXR VFX textures?

Compression can smear data channels, color space controls sRGB versus linear reads and HDR requires float EXR or encoded alpha.

## 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/)
