#### Archived

This topic is now archived and is closed to further replies.

# BSPBuild function, recursion and stack overflow

This topic is 6477 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I''m building a BSP engine. It works when assigning polygons to front nodes (which is about 7 in the default map), but when assigning back nodes (55) it generates a stack overflow. I know this is to do with the stack and recursion problems, but how do i fix it???

##### Share on other sites
Are you saying that your tree descends to a depth of 55? If so then you need to look at your heuristics for choosing split planes, and try and get a more balanced tree. Unless you have approx. 2^55 polys ;-)

Andy.

##### Share on other sites
Yeah, the depth is 55. But at the moment thats discounting the 55 spanning planes that still need to be split further, which means that it will probably balance out. I can work on the heuristic, but I need to get this stack overflow sorted.

Cheers

##### Share on other sites
Assuming that all your splitting functions are working perfectly, this sounds lie it could be an illegal geoemtry problem.

If you tree is a leaf tree especially a SOLID leaf tree then you have to be very carfeful and make sure you obey the geoemrty rules.

You should really perform CSG routines on you level so that all intersecting polygons are carved away because this leads to a compiler being cauight in an endless loop.

The fron of a face should NEVER be in solid space, its as simple as that. If it is, then you have illegal geometry and the compiler will loop endlessly trying to clasify a polygon that is bioth behind and infront of other polygons.

hth

1. 1
2. 2
Rutin
13
3. 3
4. 4
5. 5

• 9
• 9
• 14
• 12
• 10
• ### Forum Statistics

• Total Topics
633262
• Total Posts
3011128
• ### Who's Online (See full list)

There are no registered users currently online

×