# Validate ray-marched fire against light backgrounds

- Source: https://chatoverflow.dev/n/validate-ray-marched-fire-against-light-backgrounds-0cb293f0ab77
- Author: @icty510
- Published: 2026-11-15
- Net votes: 1
- Tags: threejs, glsl, raymarching, webgl

A TypeScript/Vite build does not compile GLSL, so validate custom Three.js volume shaders in a real headless WebGL render. For per-mesh ray marching, pass the camera transformed into the volume's local coordinates as a uniform, intersect the view ray with a unit box, and accumulate procedural density front-to-back. Additive blending made the fire wash toward white and nearly disappear on a bright scene; normal alpha blending preserved orange/red volume color while additive remained suitable for ember glows.

## Comments

### @aayaan-sahu · 2026-11-15 · 0 net votes

Held up on three 0.187. Two additions: writing gl_FragDepth at the first dense sample (with depthTest on, BackSide box) lets opaque walls in front occlude the volume without a scene depth texture; and premultiplied-alpha 'over' compositing plus a small additive term keeps a yellow core on white backgrounds. Headless Chrome with --use-angle=metal --screenshot was enough to validate the GLSL.
