Embree has various different acceleration structures.
Is there any documentation about these structures
and various triangle intersection algorithms?
In particular, there are various global settings
(g_top_accel, g_tri_accel, g_builder, etc.) that are used in
'embree/kernels/common/scene.cpp', but there appears
little or no documentation about what various options
are, when one might want to use them and trade-offs.
It would be very useful to better understand what these are.
The Embree API defines scene flags that are used by Embree to select the optimal acceleration structure and build algorithm. E.g. if as compact memory saving data structure the bvh4.triangle4i is used, which indexes into the vertex array, instead of reformatting the data.
One can also select the desired algorithm from the command line, but this mode is mainly available to compare different versions explicitely.
./tutorial03_ispc -i model.obj -rtcore verbose=2,accel=bvh4.triangle4,builder=objectsplit
As acceleration structure you can select at the command line:
bvh4.triangle1 (good for coherent ray packets and performance)
bvh4.triangle1v (good for ray packets, stores vertex positions and uses triangle tests that are consistent along edges)
bvh4.triangle4 (fast good for single ray queries on SSE)
bvh4.triangle8 (fast good for single ray queries on AVX)
bvh4.triangle4i (uses less memory, uses also edge consistent intersection)
Select a specific acceleration structures only if there is a need for. We might remove specific acceleration structures in future releases if we find better performing alternatives.
I am also having trouble understanding how to use the acceleration, build and intersector structures. According to the above post, I used "bvh4.triangle1" as the acceleration structure when creating a triangle mesh and I got the following error:
Acceleration structure "bvh4" is not registered
What is the proper way to use these structures and is there a list of the different algorithms that are available?
I am using 16 core (Intel Xeon CPU E5-2687W) - I checked and it seems its using AVX instruction set. So when I use "bvh8" as the acceleration structure, I still get - Acceleration structure is not registered.
Simply pass NULL as type to rtcQueryIntersector and you will get the default intersector which will work.
I recommend using the latest Embree Version 2.3.2, as this new version has some clever logic to select the best acceleration structure for your CPU.
hi I used NULL as the accel type for creating a new mesh
embree::rtcNewTriangleMesh(totalTriangles, totalVertices, NULL);
but I got this error:
basic_string::_S_construct NULL not valid
I am aware of the existence of Embree 2.3.2 but, I think I mentioned this before, there is a reason beyond my power which does not let me use it.
Now, passing the accel type while creating a triangle mesh like above is where I am stuck. No matter what I use I end up with "Acceleration structure not registered" error and all the tutorial codes are useless since they are all in ispc and none of them even pass this parameter. Any help in this would be greatly appreciated.
Check in examples/renderer/device_singleray/api/scene_flat.h for a C++ example of how to setup the scene. This file is part of the Embree Example renderer, which you can also invoke through ./renderer -c models/cornell_box.ecs.
Try to pass "default" to rtcQueryIntersector, this should also work.
I checked the scene_flat.h file which you mentioned and creates a new mesh like this:
RTCGeometry* mesh = rtcNewTriangleMesh(numAllocatedTriangles, numAllocatedVertices, accelTy.c_str());
I took a look at the scene.h also and it seems like the accel structures are default initialized to "default". This is exactly the same thing I am doing too, but this is the error I am getting:
what(): No default acceleration structure defined.
I am not sure what I am missing, the rtcInit() should have registered the appropriate acceleration structures.
Thanks for your help.