[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/vr/ - Retro Games

Search:


View post   

>> No.5925463 [View]
File: 31 KB, 900x480, bsp_portal.png [View same] [iqdb] [saucenao] [google]
5925463

Part 1 -

Basically, a BSP tree splits up space into halves.
If you look at the attached image, you’ll see an example of how a bsp tree could split up the space in a world. Imagine the three colored shapes are sectors that are connected to each other by the arrows.

If you are inside sector 0, left of split plane 0, you know that bsp node 1 is in front of bsp node 2, which also means that you know that sector 0 is in front of sector 1 and sector 2.

Traversing the bsp tree according to which half is in front of the other half according to your POV gives you a perfect front-to-back sort order of the sectors in the game world.

In a doom engine, sectors are convex, so we know that no wall in one sector will obscure another in that same sector. So as long as we draw sectors in a front-to-back order, and never redraw to the screen, we will have a correct output image.
Basically the only clipping you have to do is between sectors.

Say we’re in sector 0 and ignore the details of bsp traversal, we’ll be drawing sector 0, then 1, then 2.
We draw all the walls in sector 0, adding to a clipping buffer for each solid wall, so we know now to draw there again. Since doom doesn’t have arbitrary 3d geometry, this type of clipping is a 1D problem and very efficient.
Then we draw sector 1's walls, clipped by the walls already draw in sector 0, then we do sector 2's walls, clipped by sector 0 and sector 1.

Navigation
View posts[+24][+48][+96]