The bvh_node class takes well over 6 hours to build when operating over a list including 2 million triangles. #1127
Unanswered
robertpfine
asked this question in
Q&A
Replies: 1 comment
-
I tried making an OBJ loader with the version of RTWeekend that uses shared_ptr and it was unusable, but works fine with raw pointers. If you are careful, you can use raw pointers much more efficiently. |
Beta Was this translation helpful? Give feedback.
0 replies
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
-
I am trying to create a hittable list of 2 million triangles structured within a bounding volume hierarchy structure.
I am using the "bvh_node" class from branch "bvh-optimization-890-B".
Looping over the 2 million triangles (which have been parsed from a .obj file) I wrap each triangle with a shared pointer and then push it to a vector of shared pointers.
shared_ptr tri3DVect;
tri3DVect = make_shared(vertices[idx[1] - 1],
vertices[idx[2] - 1],
vertices[idx[3] - 1],
mat_ptr);
std::vector<shared_ptr> triangleList;
triangleList.push_back(tri3DVect);
I am pushing triangles into the vector because there are other shared pointer objects coming from sources other than the vector of triangle objects and I'm assuming that all scene objects should be in a single hittable list.
Next, I push the Triangle shared pointers along with the other scene objects into a hittable list called called "geometry".
hittable_list geometry;
for (int i = 0; i < objloader.triangleList.size(); i++){
geometry.add(objloader.triangleList[i]);}
Finally, I push "geometry" contained all scene objects into a hittable list "world" wrapped as a shared pointer to a bvh structure.
hittable_list world;
world.add(make_shared<bvh_node>(geometry));
This final step running "world.add" is where the bottle neck starts. At the at the end of 6 hours running for the "world.add" function, the bvh object had still not completed building.
Any thoughts would be greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions