bsp

23
BSP (Binary Space Partitioning) Lee SangHoon

Upload: sanghoon-lee

Post on 22-Nov-2014

752 views

Category:

Technology


2 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Bsp

BSP (Binary Space Partitioning)

Lee SangHoon

Page 2: Bsp

Contents

Introduction

BSP Generation

PVS (Potential Visibility Sets)

Generating Lightmap

Collision detection

Introduction of Fake III

Page 3: Bsp

Introduction

Fast collision detection

What is not seen, is not drawn

Lightning calculations of the map

Can be used to optimize networking

Page 4: Bsp

BSP Generation

GENERATE-BSP-TREE (Node, PolygonSet) ◦ 1 if (IS-CONVEX-SET (PolygonSet)) ◦ 2 Tree ← BSPTreeNode (PolygonSet) ◦ 3 Divider ← CHOOSE-DIVIDING-POLYGON (PolygonSet) ◦ 4 PositiveSet ← {} ◦ 5 NegativeSet ← {} ◦ 6 for each polygon P1 in PolygonSet ◦ 7 Value ← CALCULATE-SIDE (Divider, P1) ◦ 8 if (Value = INFRONT) ◦ 9 PositiveSet ← PositiveSet U P1 ◦ 10 else if (Value = BEHIND) ◦ 11 NegativeSet ← NegativeSet U P1 ◦ 12 else if (Value = SPANNING) ◦ 13 Split_Polygon (P1, Divider, Front, Back) ◦ 14 PositiveSet ← PositiveSet U Front ◦ 15 NegativeSet ← NegativeSet U Back ◦ 16 GENERATE-BSP-TREE (Tree.RightChild, PositiveSet) ◦ 17 GENERATE-BSP-TREE (Tree.LeftChild, NegativeSet)

Page 5: Bsp

BSP Generation

Convex set

Page 6: Bsp

BSP Generation

CHOOSE-DIVIDING-POLYGON

Page 7: Bsp

BSP Generation

CHOOSE-DIVIDING-POLYGON

◦ Loop to find the polygon that best divides the set.

Count the number of polygons on the positive side, negative side.

Compare the results given by the current polygon to the best this far & set the new candidate.

◦ return BestPolygon

Page 8: Bsp

BSP Generation

Page 9: Bsp

BSP Generation

Page 10: Bsp

BSP Generation

Page 11: Bsp

BSP Generation

Page 12: Bsp

Portal Rendering

Page 13: Bsp

Portal Rendering

◦ RENDER-PORTAL-ENGINE (Sector, ViewFrustum)

for each polygon P1 in Sector ◦ if (P1 is a portal and INSIDE-FRUSTUM (ViewFrustum,

P1))

NewFrustum ← CLIP-FRUSTUM (ViewFrustum, P1)

NewSector ← Get the sector that is connected with the current sector through portal P1

◦ RENDER-PORTAL-ENGINE (NewSector, NewFrustum)

◦ else if (P1 has not been drawn yet)

draw

Page 14: Bsp

Portal Rendering

Portal Rendering Problem ◦ Occurs calculation and clipping when drawing the scene

Solution ◦ PVS (Potentially Visible Set)

Calculation is done in the pre-rendering of the map

Page 15: Bsp

PVS

Distribute sample points along the splitting planes in the

tree

Page 16: Bsp

PVS

RAY-INTERSECTS-SOMETHING-IN-TREE (Node, Ray)

If the ray spans the splitting plane of this node or if the ray is coinciding with the plane, send it down to both children

If the ray is only on the positive side of the splitting plane send the ray down the right child. The or in the if statement is because one of the points might be coinciding with the plane.

If the ray is only on the positive side of the splitting plane send the ray down the right child. The or in the if statement is because one of the points might be coinciding with the plane.

There was no intersection anywhere, pass that upwards

Page 17: Bsp

PVS

CurrentCluster = FindCluster(vPosCamera);

TurnAllFacesOff();

for(int i=0; i<NumVisibleLeaves; i++)

{

for(int f = 0; f < m_pLeaves[i].NumFaces; f++) ◦ TurnFaceOn(pLeafFaces);

}

Page 18: Bsp

Radiosity

Page 19: Bsp

Radiosity

Page 20: Bsp

Radiosity

Radiosity using PVS

◦ RADIOSITY (Tree)

for(each leaf L in Tree)

◦ for(each light S in L)

for(each leaf V that is in L’s PVS)

◦ Send S’s energy to the patches in V

Page 21: Bsp

Collision detection

Page 22: Bsp

Fake III

Page 23: Bsp

Q/A & IDEA