首先理解阴影的本质,光照被其他体素遮挡了。
Adding shadows to the volume lighting model means that light gets attenuated through the volume before being reflected back to the eye.
体渲染(volume rendering)算法包括ray casting、Texture-based technique等。今天介绍Texture-based technique里的half-angle slicing技术。
如下图:
网上的代码有误,修正后代码在这里。结果如下: