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 = ...;
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.
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.
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.