## Wednesday, June 18, 2008

### BSP Portal generation some thoughts

Recently i started to learn something more about portal and PVS (potential visible set) , and decided to write a my own engine. Everyone who are going to write a BSP tree and portal generation system would get some pain in their eyes . I am sure about it.  It is not as easy as we think , BSP tree is ok , but an efficient automatic Portal generation is algorithm is difficult .

I am looking some methods to do it . BSP tree helps to divide the input geometry data in to convex polygons , that means the leaf of the node will contain the convex polygons. If the input data is not a suitable one the bsp will be an unbalanced one , and also cause to split many polygons. So an efficient BSP tree algorithm is needed ,
Which should do the following things.
1. It should select the best splitter polygon from the given polygon set
2. The criteria may be the ratio between the split count and balanced leaf count  ( Right leaf Poly count/Left leaf poly count , if it is 1 this is ideal , and you are lucky).
The next thing is to generate portals . I am stopping now .   i will update this page soon (i have no idea ),
I am thinking about an algorithm currently which can generate portals efficiently. ..
Contd...

4-7-2008
I started BSP tree works , it is not much complicated,  i need to avoid recursion to avoid stack overflow during the creation of tree.. In case of small low poly models the triangle count are normally less and i can use recursion to create tree.. anyway it is not a big problem.. The Big problem is generating the portals , it may be impossible to 100% generate correct portals automatically.. hmm..Let me see.. I want to keep the current momentum.
I just completed BSP tree works.. It works!!... I have some few problems now , like calculating the texture coordinates when triangles got cut . My friend decided to implement Sutherland-Hodgman clipping algorithm for creating portals. Now I am waiting for his results..