Jump to content
  • Advertisement

Archived

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

Cosmos

BSP Trees & PVS

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m trying to build a 3d engine based on bsp-trees. The bsp trees basic engine is already working, and now I''m looking for some kind of information on how to calculate the PVS on the tree nodes in order to speed-up the renderer. All the information that i''ve found is very abstract, and I need some kind of tutorials with some portion of code and explanation to find out how it really works. Can anyone help me?? Thanx, Cosmos

Share this post


Link to post
Share on other sites
Advertisement
Your in luck. I was writeing a tutorial on this today so I might as well repeat it here.

PVS is a tought subject. The first thing you need to do pvs with BSP trees is a set of portals. Well, what's a portal? For that I need some gfx.

A Simple Case It's BSP Tree

Above is a simple room and it's BSP tree. Each area where a node crosses into the room is a portal. We will say that the space between walls 1 and 5 on node split A is portal A. The area between 11 and 7 on split B is portal B. When you store the portal you need to include what leaf's they are between. For example, portal A is on split A so we go down the front and find it's on leaf 1, 2, 3, 4, and 5. We go back to the root node (A). We go down the back. We look at B, we are behind B so we go down the back. We that it's the leaf of 12 and 6. So portal A is in between 1, 2, 3, 4, 5, and 12, 6. To save time I will tell you portal B is between 10, 11, 7, 8, 9 and 12 and 6.

Now we get to PVS. I am not EXACTY sure how sensitive to curves and things this method is in the real world so if/when someone impilments it please drop me a mail (My email is on top of the BSP page at www.grandus.com) Anyway, here is the system. I assume that your useing a engine where the smallest unit you can use is 1. Cast a ray from every point (the smaller the distence between the points the better, the smaller the slower the vis program will run) on the portal to every point on every other portal on the map. If the ANY of those rays reach a portal, then that portal is visible (there is 1 execption to this rule, it has to do with portals on the same node split. It should not take you long to figure it out.) In our simple case portals A and B can see each other. This means that when you touch portal A you load portal A's leafs and Portal B's leafs.

Now to better explain how this works lets say you have a level where Portal A can see B , B can see A and C. C can see B but NOT A. So if you touch portal A load A's Leafs and B's Leafs. You touch B, Load A, B, and C's leafs. You touch C and load B and C's Leafs.

Oi! That help?

Correction the above method is slightly flawed. Check out grandus.com for th corrected method.

------------------------------------------------------------
I wrote the best video game ever, then I woke up...

Grandus.Com

Edited by - Galileo430 on December 14, 2000 4:56:31 PM

Share this post


Link to post
Share on other sites
Ok...that helped a lot!

I''ve captured all the thing about portals & PVS''s, but now I have another problem: I was using node based tree''s (somehow very similar with the ones described in mr. gamemaker bsp tree tutorial). Looks like I can''t use them anymore since they can''t support portals, so I need to build a new leaf based tree compiler and I have some doubts that I wish to clear:
Is there some kind of tutorial with code that show how to build a leafed tree from a set of polygons?
How can I find out where a portal lies within a set of polygons:

|--------|
| |------|
| Portal |
| |------|
|--------|

Thanx,
Cosmos

Share this post


Link to post
Share on other sites
OOppps

that ascii image was screwed...forget it

At the tree compiling time, how do I find out that a portal lies in A and another in B???

Share this post


Link to post
Share on other sites
Hi!
Nate has a very easy to understand source for a leaf-based bsp compiler\viewer....
Get it here:
http://nate.scuzzy.net/

Greets,XBTC!

Share this post


Link to post
Share on other sites
There is a new tutorial on mr-gamemaker.com that covers PVS calculation and creating a solid leaf tree.

Maybe of some use to you

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!