跳到正文
网页珍奇柜Web Curio

黑洞光线追踪

Black Hole,Otto Seiskari,2015 年

正在布展…

本柜的现场复刻:按原作的技术思路从零编写,不含原作的代码和素材。原作请点上方「去看原作」。

它是怎么做的

  1. 第 1 步每个像素发射一条光线,在其轨道平面内用 u=1/r 关于角度的二阶方程积分
  2. 第 2 步步进过程中检测光线是否穿过吸积盘平面或落入事件视界
  3. 第 3 步吸积盘颜色按黑体温度计算,并叠加多普勒与引力红移
  4. 第 4 步没有被捕获的光线最终方向用于采样银河星空贴图
  5. 第 5 步dat.GUI 面板可切换观察者运动、各种相对论效应和画质

复刻配方

一段技术配方,可以直接交给 AI 编程助手,也可以自己照着写。想指定技术栈、位置和性能预算,就把它加入实现方案。

For each pixel, build a ray from the camera and reduce it to a 2D problem in the plane containing the ray and the black hole centre. Integrate the Schwarzschild photon orbit equation d²u/dφ² = -u + 1.5u² (with u = 1/r and Schwarzschild radius 1) using a fixed-step RK4 or leapfrog loop of a few hundred steps in the fragment shader. At each step check for crossing the disk plane between inner and outer radii and for r < 1 (captured, black). Shade disk hits with blackbody colour adjusted by Doppler and gravitational redshift, and sample a sky cubemap or equirectangular texture with the final direction for escaped rays.

档案

能不能拿来用

原作以 MIT (COPYRIGHT.md; Milky Way texture is CC-BY-NC) 许可开源:可以阅读源码学习,按许可证条款使用;在自己的项目里引用时保留原作者署名。

性能开销

视觉强度

实现难度

尺度为策展判断(1 到 5),用于比较和推荐。

核实记录:Opened https://oseiskar.github.io/black-hole/ (200, title 'Black Hole'); repo oseiskar/black-hole exists; read COPYRIGHT.md (MIT for the project, third-party notes).