使用 three.js 无纹理的体积光线追踪

Volume ray tracing using three.js without textures

我正在尝试可视化氢波函数,并想使用体积射线 tracing/casting 来实现。所有用于创建体绘制的在线指南都基于来自某些医学成像的 2D 纹理。就我而言,我没有任何图像数据,但 3D 数据已经在内存中 (I'm using them to generate particles right now)。

我真的需要将所有 3D 数据转换为 2D 纹理,然后再次加载它们,然后伪造 3D 纹理吗?如果没有,没有贴图怎么办?

是的,从你的 link 我了解到你有一个函数,它接受 3D 坐标和 returns 0 到 1 之间的概率。你可以在评估每条射线时直接使用它.

For each ray, 
    for each distance ∆ along the ray
        calculate the coordinates at distance ∆ from the camera
        calculate the propability at those coordinates using your function
        add the probability to the ray's accumulated color

使用此方法,您可以跳过在 linked 示例中渲染的粒子位置,并直接使用该函数。