# This is a forum thread about building and using BVH(Bounding Volume Hierarchy) in OCCT.

#### jianbaoxia

I recently read some articles about constructing BVH and can't wait to implement it myself.
In lesson 17 on Quoar, I found the code for constructing BVH and calculating the intersection points of rays and triangles using the BVH_PrimitiveSet class in OCCT. This is exactly the code I want to learn.
I understand the "ModelBvh" class in general, but I want to learn specifically about how the OCCT BVH_BinnedBuilder is implemented in the next step. I encountered some difficulties when reading the "MeshDist" class, mainly because I'm not familiar with the algorithm used in it. It's difficult for me to understand the algorithm principles by reading the code. So I would like to ask what algorithm is used in it. I want to understand the algorithm first and then learn how to implement the code. Are there any related books, literature, or posts that I can refer to?
I found that although OCCT has implemented BVH, there is very little information available on the topic. I hope to discuss and learn about this area with those who share the same interest.

#### jianbaoxia

I found a paper of the creater of "BVH_BinnedBuilder" Denis BOGOLEPOV, it's about SAH BVH, share with you.

#### Attachments

• [J_11](OCCT_BVH)Real-Time SAH BVH Construction for Ray Tracing Dynamic Scenes.pdf
214.7 KB · Views: 8

#### jianbaoxia

I find the Möller Trumbore Algorithm to get the intersect point bettwen ray and triangle.
But I'm still curious about what algorithm is used in MeshDist::intersectTriangle() on lesson 17, but I lack relevant knowledge to determine it.

#### Quaoar

Staff member
Denis Bogolepov is exactly the author of BVH implementation in OpenCascade, and you're referring to the right paper (well, to the right author). He has got PhD in ray tracing, and his implementation of BVH is performant and accurate, although it's indeed quite hard to comprehend as it usually happens with highly optimized code.