BSP build and shared vertices

Axl

Newcomer
I'm trying to build an adequate axis aligned BSP tree for my raytracer that
only uses triangles. Usually the stop criteria for the build is when the
amount of triangles is less than a number (usually 2 or 3) or when the
maximum depth is reached. The problem is with triangles that share verices the build will only stop when reached maximum depth which is very sub-optimal. Usually one vertex is shared by 5 or 6 triangles which is
usually higher that you want in a node. The nodes that contains vertices
seem impossible to decompose any further.

I'm trying to solve this by with either when a node contains one or more
vertices recursion stops. Or, if a node contains only one vertex, set split
plane at the vertex and look at the other vertices to see what side the
triangle is on.

Do you have any better way to solve this? Because this is for a raytracer I
don't have to care about splitting the triangles.
 
Saem said:
I don't know much about raytracing, but shared vertices, makes me thinkg of KD-trees.

An axis aligned BSP is basically a KD-tree, just a another name for it. Some called it BSP some call it KD-tree.
 
Saem said:
Out of curiosity, why is 5 to 6 polys considered too many?

I think I have set the number a little too low. The reason I used 2 or 3 is because I got better performance for a few objects. On a second thought I think I have to raise that threshold a bit.
 
AFAICT, I don't think restricting the number of polygons per node is really necessary. One can only have so many polygons that have a common vertex divider.
 
Back
Top