简单的 C/C++三角形交叉加速结构库
我正在进行光线追踪,并希望通过一些加速结构(kd-tree、BVH 等等)来加速它。我不想自己编码。到目前为止我已经尝试过:
将 kd 树从 pbrt 中拉出。有如此多的内部依赖关系,如果不将所有 pbrt 拉入我的代码中,我就无法成功。
CGAL 的 AABB 树。令人沮丧的是,这似乎只返回交点。在不知道该点来自哪个三角形的情况下,我无法有效地在三角形上插值颜色。我很想用颜色来扩展“点”的概念,但是如果不从头开始编写大量模板代码,这似乎是不可能的。
我自己写的。好吧,我编写了自己的网格加速类,它可以工作,但它很糟糕且效率低下。
因此,如果有人可以建议一个我可以用于此目的的简单库,我将非常感激!我所需要的只是给出一个三角形汤和光线,找到最近的交点并返回该三角形的索引。
I'm raytracing and would like to speed it up via some acceleration structure (kd-tree, BVH, whatever). I don't want to code it up myself. What I've tried so far:
Yanking the kd-tree out of pbrt. There are so many intra-dependencies that I couldn't succeed at this without pulling all of pbrt into my code.
CGAL's AABB tree. Frustratingly, this seems to return only the point of intersection. Without knowing which triangle the point came from, I can't efficiently interpolate color over the triangle. I'd love to just extend the notion of "Point" with color, but this doesn't seem possible without writing a lot of template code from scratch.
Writing my own. Okay so I wrote my own grid acceleration class, and it works, but it's nasty and inefficient.
So, if anyone can suggest a simple library that I can use for this purpose I'd really appreciate it! All I need is given a triangle soup and ray, find the closest intersection and return the index of that triangle.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Jaco Bikker 编写了本系列教程: http://www.devmaster.net/articles/ raytracing_series/part7.php
它们非常有帮助,他在最后包含了使用 kd 树的光线追踪器的代码。
你也许可以用它。
Jaco Bikker wrote this series of tutorials: http://www.devmaster.net/articles/raytracing_series/part7.php
They're very helpful and he includes code at the end for a ray tracer using a kd-tree.
You might be able to use that.
G3D 引擎 具有光线追踪实现。但不确定它的效率如何。在没有库的其余部分的情况下使用 Tree 实现应该不会太麻烦。
The G3D engine has a ray tracing implementation. Not sure how efficient it is though. It shouldn't bee too much trouble to use the Tree implementation without the rest of the library.