API

Fire Procedural Texture

Fire Procedural texture

Using the Fire procedural texture

Fire procedural texture can be found here:

A demo can be found here: Fire Procedural Texture

This texture has several parameters:

  • time can be set manually (float) if autoGenerateTime(boolean) is set to false. It is used inside the fire shader for animation
  • speed controls the velocity (speed and direction) of the flames (BABYLON.Vector2)
  • fireColors is an array of 6 (BABYLON.Color3/4) values defining the different colors of the fire. You can define them manually or use presets available as static properties of the class (PurpleFireColors, GreenFireColors, RedFireColors, BlueFireColors)
import { StandardMaterial } from "@babylonjs/core/Materials/standardMaterial";
import { FireProceduralTexture } from "@babylonjs/procedural-textures/fire/fireProceduralTexture";
var fireMaterial = new StandardMaterial("fireMat", scene);
var fireTexture = new FireProceduralTexture("fireTex", 256, scene);
fireMaterial.diffuseTexture = fireTexture;
fireMaterial.opacityTexture = fireTexture;