Sign in to follow this  
ehsan2004

Portal-and-BSP tree scene management

Recommended Posts

In chapter 12 of the book "More OpenGL Game Programming", Wael has explained the portal-and-BSP scene management. He has written a 3DSMax script to subtract portals from occluders mesh( So deviding occluders mesh to independent sectors). Then he assigns an ID for each sector.He has used Solid Node BSP trees to save the sector's ID. As each portal intersects 2 sectors, he finds two appropriate sector IDs for each portal. Then for each portal if it's visible, he draws its sectors: DoOcclusionQueryForAllPortals(); GetQueryResults(); for each portal if( portal.isVisible == true ) { render( portal.sector[0] ); render( portal.sector[1] ); } Is anyone familiar with this method? I can not understand some codes of his tutorial. Is it a good scene management? -Ehsan-

Share this post


Link to post
Share on other sites
Hi ehsan2004,

First of all i must say, i haven't read the book so i'm not familiar with the approach presented in there.

In the code snippet you posted, i think something is missing. Doesn't he render anything before doing occlusion testing on portals? AFAIK doing occlusion tests on an empty depth buffer isn't going to help a lot. I mean the result would be exactly as if you did frustum culling, which must be faster than an occlusion query.

Another thing i would like to ask is what you mean by "Solid Node BSP"? Do you mean a leafy BSP (all polygons are on the leafs) and each leaf is a convex set? If yes then i'd expect the number of portals to be too high in order to be useful. You may need of a way to reduce the amount of portals and merge convex leafs into bigger convave ones. If "Solid Node BSP" doesn't mean what i said, just ignore this.

AFAIK, a cell and portal graph is supposed to be traversed recursively from front to back. First you find the sector the viewpoint is in. You render this sector. Then you check each portal connected to that sector, if it's visible. You can use simple frustum culling, screen space bounding rectangle culling or occlusion culling for that. If a portal is visible, you render the other sector it connects. And you continue recursively with the other portals in the new sector. This way, when performing e.g. an occlusion query for a portal, you have a bigger chance of it to fail (portal invisible), than when you render the portals in an empty depth buffer.

Again, i must say i haven't read the book so i don't know you he does exactly. So forgive me if i'm wrong on something. :) I hope someone familiar with the specific algorithm could help more.

HellRaiZer

Share this post


Link to post
Share on other sites
Hi
Wael El Oraiby has written that leafy and solid nodes are like eachother.
I can not understand how we use these nodes. It seems that his algorithm doesn't consider objects of each sector( Maybe I'm wrong ). I guess he recursively moves through the polygons of each sector and assign the same ID for them( as an example all the polygons of sector one have ID 0, all the polygons of sector two have ID 1, etc. ).So I thinks he works with sector's polygons, not with object's polygons(If our sector has 4 polygons and there are 3 objects inside this sector, SNBSP assignes an ID for 4 polygons of this sector, but it have no knowledge about the 3 objects of this sector ).
Am I correct?
-Ehsan-

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this