Intel® Embree Ray Tracing Kernels
Discussion forum on the open source ray tracing kernels for fast photo-realistic rendering on Intel® CPU(s)
公告
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
288 討論

is there any way to limit the number of triangles per leaf to 4?

Bernie_BVH
初學者
2,266 檢視

i'm using Embree as a BVH generator, but i need to convert the results to my own BVH format which only supports 4 triangles per leaf.

currently i'm using code based off the the tutorial project "bvh_access". in this code, i get the triangles from the leaf as follows:

    embree::BVH4::NodeRef ref = ...;
    size_t num;
    const embree::Triangle4v* tris = (const embree::Triangle4v*)ref.leaf(num);

this gives me an array of Triangle4v's, each of which contains up to 4 triangles. in practice i've found that 'num' can range from 1-7 (i think). what i want is to limit the number of triangles per leaf to 4, hence 'num' would always be 1.

i've tried changing RTC_BUILD_MAX_PRIMITIVES_PER_LEAF to 4 (it is normally 32), and also setting maxLeafBlocks in bvh_node_ref.h to 1 (it is normally 7). neither of these changes appear to have any effect on the number of triangles per leaf.

0 積分
4 回應
SvenW_Intel
主席
2,256 檢視

You have to change some lines in the kernels/bvh/bvh_builder_sah.cpp. At the end of the file look for the block inside the EMBREE_GEOMETRY_TRIANGLE define. Just change all occurances of inf in this block to 4.

Bernie_BVH
初學者
2,243 檢視

that didn't work. even setting it to 1 didn't work.
how can i debug this?

SvenW_Intel
主席
2,235 檢視

That really should work. Can you add some print of settings.maxLeafSize at beginning of BVHNBuilderSAH::build function in bvh_builder_sah.cpp and verify that this value is 4.

Bernie_BVH
初學者
2,230 檢視

ah! it was user error. i was copying the exe to another location and calling that with system(), but i wasn't copying embree3.dll alongside it. changes i made in bvh_access.cpp were showing up in the exe, but changes to bvh_builder_sah.cpp were showing up in the dll ..

thank you

回覆