threejs-worldgen
    Preparing search index...

    A rendered wildfire: a FireSim drawn with threejs-particles GPU systems. Flames and embers come only from the active front (recently ignited cells, weighted by intensity), smoke from the front plus wisps from smouldering and freshly burnt ground; a coarse grid carries the fire's heat up into a plume that bends downwind and self-shadows. Also a flickering light at the front, a data texture of ground glow, burn scars and ash for other materials (Wildfire.node), burn scars written into a StateField, and a smoke-occlusion estimate for sky and lighting.

    const fire = new Wildfire({ world, weather, field, renderer, camera, center: [0, 0], size: 1024 })
    scene.add(fire.object)
    fire.ignite(30, -10)
    // each frame: fire.update(time); field.update()
    applyMaterialStatesTo(terrainMaterial, { ...field.node(), ...fire.node() })
    pipeline.outputNode = fire.bloom(pass(scene, camera)) // with look.bloom.enabled
    Index
    field: StateField | null

    State field receiving burn scars, if any.

    grid: ParticleGrid | null = null

    The plume grid, if look.grid.enabled.

    light: PointLight = ...

    Light at the front.

    lighting: ParticleLighting = ...

    Sun and sky light the smoke is lit by (filled from the scene every update).

    Resolved look.

    object: Group<Object3DEventMap> = ...

    Add this to your scene.

    sim: FireSim

    The simulation.

    The particle systems (rebuilt when counts or quality change).

    texture: DataTexture

    Per-cell data (R ground glow, G burn scar, B ash share, A front intensity), linear filtered.

    uniforms: {
        bounds: UniformNode<"vec4", Vector4>;
        smokeOcclusion: UniformNode<"float", number>;
        wind: UniformNode<"vec3", Vector3>;
    } = ...

    Shader uniforms.

    Type Declaration

    • bounds: UniformNode<"vec4", Vector4>

      Grid minimum relative to render zero (xy) and size (zw).

    • smokeOcclusion: UniformNode<"float", number>

      How much the plume dims the sun at the camera, 0…1 (see Wildfire.smokeOcclusionAt).

    • wind: UniformNode<"vec3", Vector3>

      Mean wind over the front, (x, 0, z) m/s.

    • Uses this renderer and camera for the particle passes (otherwise they are picked up from the first render).

      Parameters

      • renderer: Renderer | null
      • Optionalcamera: Camera | null

      Returns this

    • Adds bloom to a post-processing colour node when look.bloom.enabled (else returns it unchanged). Rebuild your pipeline's output node after toggling enabled; strength, radius and threshold are live.

      Parameters

      • color: Node<"vec4">

      Returns Node<"vec4">

    • Starts a fire at (x, z) (frame coordinates); see FireSim.ignite.

      Parameters

      • x: number
      • z: number
      • Optionalradius: number
      • Optionaltime: number

      Returns this

    • burn, heat and ash as TSL nodes at a render-space XZ position (default positionWorld.xz), zero outside the grid. Sampled with a smooth, slightly warped filter so cell edges never show.

      Parameters

      • xz: Node<"vec2"> = positionWorld.xz

      Returns FireNodes

    • Sets the frame position at render-space zero (floating origin), [x, y, z].

      Parameters

      • origin: readonly number[]

      Returns this

    • How much the smoke plume dims the sun at frame position (x, z), 0…1 (a Gaussian plume from the front, bent downwind). Sky and lighting can read it, or the live Wildfire.uniforms smokeOcclusion at the camera.

      Parameters

      • x: number
      • z: number

      Returns number

    • Sunlight transmittance (linear RGB) through the plume at (x, z): dims and reddens.

      Parameters

      • x: number
      • z: number
      • out: [number, number, number] = ...

      Returns [number, number, number]

    • Runs the simulation towards time seconds, refreshes the sources, texture, light and field, and advances the GPU particles by dt real seconds (default: measured). Spends at most budget milliseconds simulating per call; a big fire or a fast clock catches up over the next frames.

      Parameters

      • time: number
      • budget: number = 8
      • Optionaldt: number

      Returns void