lighttransport / nanort

NanoRT, single header only modern ray tracing kernel.
MIT License
1.07k stars 90 forks source link

why does binbuffer store each primitives' bounding boxes' minimum and maximum separately? #14

Closed regrow1123 closed 7 years ago

regrow1123 commented 7 years ago

on 1114 th line,

There are 2 integers, left and right. Inside the for loop, based on each cell's right side we increase the left and decrease the right by one. The left integer will increase if the primitives' bounding box's minimum exists left to the cut position, however, the right integer will decrease if the maximum of it exists left to the cut position.

If there happens to be a triangle existing across the cut position, which means the primitive's bounding box's minimum is located left to the cut position and the maximum of it is located right to the cut position.

Then the summation of the left and the right must not be same to the total number of primitives, since this triangle belongs to the both left and right.

I think this is able to harm the right computation of SAH value and make it difficult to decide a good cut position although the building of child nodes is working well because the primitive's will be classified by its center.

syoyo commented 7 years ago

The code is based on binned SAH(I forgot the precise title of the paper I referred) and IIRC it computes SAH based on primitive's bbox.

Recently, some paper(I guess HPG 2015 ~ 2017 papers) shows using primitive's bbox work well for constructing BVH. Also, we are better to support spatial split BVH.

Contribution is always welcome!

regrow1123 commented 7 years ago

I guess the paper is Stich, Martin, Heiko Friedrich, and Andreas Dietrich. "Spatial splits in bounding volume hierarchies." Proceedings of the Conference on High Performance Graphics 2009. ACM, 2009.

After reading this paper, I understand why we need this kind of construction of spatial split BVH. Thank you for your comment.

syoyo commented 7 years ago

15