如何使用光线相干性来提高光线追踪速度,同时仍然看起来逼真?
我正在考虑在我的软件每像素实时光线投射器中利用光线相干性。
AFAICT,使用统一网格,如果我将光线相干性分配给 4x4 像素的补丁(目前每个像素有一个光线投射),给定 16 条具有不同起始(和结束)点的平行光线,这如何解决连贯的场景?我预见的是:
- 在一定距离内,相邻/相似光线的光线行进将完全相同。在这个距离内,我可以节省处理时间。 (我怎么知道这个距离是多少?)
- 由于某些光线没有在正确的时间发散,我最终会得到一个稍微到严重错误的图像。
鉴于我的光线是从单个点而不是平面投射的,我想我将需要根据遍历的距离进行某种分割函数,以便所有光线的集合在向外移动时形成一棵树。我担心的是,当靠近观察者时,更精细的细节将会丢失。
我想我只是不明白这是如何使用的。
I'm considering exploiting ray coherence in my software per-pixel realtime raycaster.
AFAICT, using a uniform grid, if I assign ray coherence to patches of say 4x4 pixels (where at present I have one raycast per pixel), given 16 parallel rays with different start (and end) point, how does this work out to a coherent scene? What I foresee is:
- There is a distance within which the ray march would be exactly the same for adjacent/similar rays. Within that distance, I am saving on processing. (How do I know what that distance is?)
- I will end up with a slightly to seriously incorrect image, due to the fact that some rays didn't diverge at the right times.
Given that my rays are cast from a single point rather than a plane, I guess I will need some sort of splitting function according to distance traversed, such that the set of all rays forms a tree as it move outward. My concern here is that finer detail will be lost when closer to the viewer.
I guess I'm just not grasping how this is meant to be used.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果操作正确,光线相干性不会影响最终图像。因为光线非常接近,所以有一个很好的变化,即它们在穿过加速结构(kd 树、aabb 树等)时都会采取相似的路径。您必须沿着任何光线可能击中的每个分支走下去,但希望这不会增加太多分支数量,并且可以节省内存访问。
另一个优点是您可以使用 SIMD(例如 SSE)来加速某些测试,无论是在加速结构中还是针对三角形。
If done correctly, ray coherence shouldn't affect the final image. Because the rays are very close together, there's a good change that they'll all take similar paths when traversing the acceleration structure (kd-tree, aabb tree, etc). You have to go down each branch that any of the rays could hit, but hopefully this doesn't increase the number of branches much, and it saves on memory access.
The other advantage is that you can use SIMD (e.g. SSE) to accelerate some of your tests, both in the acceleration structure and against the triangles.