Implement grid based volume heirarchy, and compare the rendering rates with that of a bounding volume heirarchy on several different models.
Talking with Pete, we decided that I could try implementing a BSP (Binary Splitting Tree) instead of a Grid. My implementation devides space into two, then seperates all the geometry into the two halves. Geometries that span both regions are put into both. This can cause many duplicate hits if the same piece of geometry ends up in both sides of the tree. To help alleviate this problem, one can specify the min number of objects in a node. This way the subdivision stops at that level rather than trying to divide the geometry further. As well a maximum tree depth is usefull to make sure the recursion stops and you don't explode with memory.
All images are 500x500 and include shadows. Timing was done on an Origin 3k with R12k (400Mhz) processors.
This object has 4690 smooth triangles
| Depth | Min Objs Per Node | Number of Nodes | Build Time | Render Time |
| 20 | 5 | 108657 | 1.95 sec. | 57.5 sec. |
| 20 | 10 | 60329 | 1.34 sec. | 52.3 sec. |
| 25 | 10 | 1027312 | 22.9 sec. | 93.5 sec. |
| 15 | 10 | 6984 | 0.22 sec. | 36.0 sec. |
| 10 | 10 | 684 | 0.076 sec. | 59.2 sec. |
| 13 | 10 | 2969 | 0.14 sec. | 38.4 sec. |
| 14 | 10 | 4609 | 0.17 sec. | 37.4 sec. |
| 13 | 5 | 3318 | 0.14 sec. | 38.3 sec. |
| 14 | 5 | 5505 | 0.18 sec. | 37.1 sec. |
It seems there is an optimal configuration where you ballance the number of nodes and the number of objects at the leaves. The general winner is the one where you get the Number of nodes to be about equivalent to the number of primitives.
| Number of Nodes | Build Time | Render Time |
| 5283 | 0.038 sec. | 22.2 sec. |
Here without any parameter tweaking, BVH's results were far superior to BSP's.
| Depth | Min Objs Per Node | Number of Nodes | Build Time | Render Time |
| 20 | 10 | 36773 | 18.5 sec. | 131.6 sec. |
| 30 (only hit 27) | 10 | 457507 | 25.4 sec. | 68.7 sec. |
| 30 | 5 | 1083996 | 30.6 sec. | 67.2 sec. |
| 35 (only hit 34) | 5 | 1084062 | 30.5 sec. | 67.1 sec. |
Going off my previous subposition that the number of nodes needed to be similar to the number of objects I picked configurations that would give me those numbers. I managed to only sqeeze a runtime of about 67 seconds. This beats BVH, but the memory is much more (473 MB for BSP, and 378MB for BVH). With the wrong parameters BSP's memory could get much worse unlike BVH.
| Number of Nodes | Build Time | Render Time |
| 1048575 | 19.2 sec. | 74.7 sec. |
Here without any parameter tweaking, BVH's results were similar to BSP's.
In this scene there is a triangle mesh with 8512 polygons. What makes this scene different from the Galleon is the floor underneath. There are two triangles making up the floor whose dividing line goes directly underneath the model. This has a tendency to screw up BSPs. The image you see has one bounce indirect lighting and 100 samples per pixel. Simulations were run without indirect lighting and only one sample per pixel.
| Depth | Min Objs Per Node | Number of Nodes | Build Time | Render Time |
| 15 | 10 | 334 | 0.15 sec. | 37.8 sec. |
| 20 | 10 | 2416 | 0.23 sec. | 16.8 sec. |
| 25 | 10 | 11717 | 0.40 sec. | 15.2 sec. |
| 30 | 10 | 18819 | 0.52 sec. | 15.1 sec. |
| 35 | 10 | 30039 | 0.73 sec. | 15.1 sec. |
Well, the best time seemed to peak out around the point where we see the number of nodes equal the number of primitives. Increasing parameters to increase the number of nodes did not show much improvement, and of course consumes more memory.
| Number of Nodes | Build Time | Render Time |
| 8837 | 0.071 sec. | 26.7 sec. |
Here without any parameter tweaking, BVH's results were on the same order of magnitude, but about 60 percent slower. I didn't have tweak the values though.
While there are some models and some situations where BSP won over
BVH in regards to to render speed, BVH has consistantly shown
performance on the same order of magnitude. BVH is more stable in the
sense that it does not require any parameter tweaks as does BSP's.
In order for BSPs to perform well, paramters must be adjusted by the
user until the number of nodes in the tree equals approximately the
number of primitives. This is could possibly be automated, but why
bother when BVHs can do about as good and often beter job with out
this tuning.
Conclusion: BVH RULES!