Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
6708 Discussions

Data structures for "Realistic Rendering" library (ippr.lib)

hapatrick
Beginner
290 Views

I am looking for some information on the data structures used in the ippr library, specificallyIpprTriangleAccel andIpprKDTreeNode. We are using this library to do ray casting on a model with > 28 million triangles. It takes over a minute to build the "triangle acceleration structure" and kd-tree. I would like to be able to write these to disk once, and load them for subsequent runs so I don't have to keep building them.

The triangle acceleration structure appears to just be a contiguous chunk of memory, so perhaps I could just write that to a file and read it back in.

However, I'm not sure where to start with the kd-tree. The function that builds the kd-tree (ipprKDTreeBuildAlloc) returns a pointer to the "root node," of typeIpprKDTreeNode. However, I can't tell from looking at the declaration ofIpprKDTreeNode how I would get to the next node. It doesn't appear to contain a pointer...maybe the nodes are laid out as an array in memory, instead of series of nodes linked by pointers?

Is there any more information or documentation about these data structures that could help me write them to disk and then re-load them?

0 Kudos
2 Replies
hapatrick
Beginner
290 Views

I think I have answered my own question, so I will post it here in case anyone else is ever interested.

Basically, I was making it too complicated. There is no need to understand the internals of these data structures. They are both (the triangle acceleration data and the kd tree) contiguous in memory, so it is easy to write them to a file.

The triangle acceleration structure is obvious, since you allocate the block of memory yourself and pass it toipprTriangleAccelInit().

For the kd-tree, IpprIntersectContext::pRootNode points to the beginning of the memory block, and the number of bytes is given by thepDstKDTreeSize parameter that you pass toipprKDTreeBuildAlloc().

For those interested in understanding the internals of theIpprKDTreeNode, I believe it works in a manner similar to theKdTreeNode class described on this page:http://www.devmaster.net/articles/raytracing_series/part7.php.

0 Kudos
Chao_Y_Intel
Moderator
290 Views
thanks for sharing it here.
0 Kudos
Reply