BSP Implemented

After reading more about BSP from scientific articles, it dawned on me that the BSP tree is supposed to be traversed repeatedly for each ray from the camera, as opposed to being traversed once before the actual rendering.

The BSP algorithm is now implemented. It does have some minor glitches, but for the purposes of this study, fixing them is not worth the effort.

Slightly glitchy BSP render

The particular BSP algorithm that I have implemented partitions the scene based on the planes in which the triangles reside. Triangles that intersect these planes are split. From what I can tell so far, this method seems quite horrible for most scenes, because the original triangles are split into so many smaller pieces when the BSP tree is compiled. One of my test scenes consists of 132 triangles, but the resulting BSP tree contains 1902 triangles, and the scene takes significantly longer to render with BSP than with brute force.

I am currently in the process of creating scenes for the study, and among them I will attempt to construct a scene that benefits from this kind of BSP. I believe such a scene would be one in which triangles generally are aligned to a 3D grid. This would mimic the other BSP approaches which partition the space into predetermined cubes, regardless of where the scene’s triangles are. In hindsight, such an algorithm is probably much more efficient in most cases.