浏览器光线追踪
WebGL Path Tracing,Evan Wallace,2011 年

正在布展…
它是怎么做的
- 第 1 步整个场景(球、盒子、光源)被拼成 GLSL 代码字符串并编译
- 第 2 步每帧在片元着色器中为每个像素随机发射光线并多次弹射
- 第 3 步结果与历史帧按 1/(n+1) 权重累积,噪点逐渐收敛
- 第 4 步交互时重置累积缓冲区
复刻配方
一段技术配方,可以直接交给 AI 编程助手,也可以自己照着写。想指定技术栈、位置和性能预算,就把它加入实现方案。
Describe a small scene of analytic primitives (spheres, axis-aligned boxes) in JavaScript and generate a fragment shader that intersects rays with them. Each frame, trace one randomized path per pixel with a few diffuse bounces and a hash-based random seed that changes with the frame number. Blend the new frame into an accumulation texture with weight 1/(frameCount+1) using ping-pong render targets and display the average. Reset frameCount whenever the camera or an object moves so the image re-converges.


