Torch Fire

The museum’s volumetric raymarched fire, extracted as a scene-independent mesh with procedural texture, configurable color/scale/seed and explicit update and disposal.

Exact preview of Torch Fire
Type
Component
Category
WebGL
Source license
MIT
Collection
Open Source Experiences

View source in the repository

Usage

<!doctype html>
<html lang="en">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Frontfield component</title>
<style>html,body{margin:0;background:#121418;color:#eee;font:14px system-ui}canvas{display:block}button{padding:10px 16px}</style>
<!-- Serve the included public/experiences/museum/ directory alongside this file. -->

<script type="importmap">{
  "imports": {
    "three": "/experiences/museum/lib/three.module.js"
  }
}</script>
<script type="module">
import * as THREE from 'three';
import {createTorchFire} from '/experiences/museum/parts/torch-fire.js';
const scene=new THREE.Scene();
const camera=new THREE.PerspectiveCamera(45,innerWidth/innerHeight,.1,100);camera.position.z=7;
const renderer=new THREE.WebGLRenderer({antialias:true});renderer.setSize(innerWidth,innerHeight);document.body.append(renderer.domElement);
const fire=createTorchFire({scale:[.8,2.7,.8]});scene.add(fire.mesh);
const clock=new THREE.Clock();renderer.setAnimationLoop(()=>{fire.update(clock.getElapsedTime());renderer.render(scene,camera);});
addEventListener('resize',()=>{renderer.setSize(innerWidth,innerHeight);camera.aspect=innerWidth/innerHeight;camera.updateProjectionMatrix();});
// fire.dispose() releases its generated texture, geometry, and material.
</script>
</html>

License and credits

Codrops Fan Museum by Andrew Woan. Original upstream source

Read the original MIT license

Credits and asset notices

Third-party assets and dependencies

vendor/experiences/museum/ASSET-NOTICES.md

Keep the original source and media notices with your copy.

Explore more

  • Liquid FormExact preview of Liquid Form

    A centered silver ray-marched liquid form with authored studio reflections and pointer-responsive camera drift.

  • Boarding PassExact preview of Boarding Pass

    A live flight pass whose changed gate and times roll over like a departures board.

  • Aurora TextExact preview of Aurora Text

    Multi-colour aurora motion within a large type specimen.

Frontfield homepage