11.11.2014 Views

Clipping and Hidden Surfaces Clipping Basic Line Clipping Cohen ...

Clipping and Hidden Surfaces Clipping Basic Line Clipping Cohen ...

Clipping and Hidden Surfaces Clipping Basic Line Clipping Cohen ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Building Example<br />

Building Example<br />

• We will build a BSP<br />

tree, in 2D, for a 3<br />

room building<br />

– Ignoring doors<br />

• Splitting edge order<br />

is shown<br />

– “Back” side of edge<br />

is side with the<br />

number<br />

5<br />

2<br />

3 4<br />

1<br />

6<br />

1<br />

- +<br />

3a, 4a, 6 2, 3b, 4b, 5<br />

3b<br />

3a<br />

5<br />

2<br />

1<br />

6<br />

4b<br />

4a<br />

31<br />

32<br />

Building Example<br />

Building Example<br />

1<br />

- +<br />

5b<br />

5a<br />

1<br />

- +<br />

5b<br />

5a<br />

3a, 4a, 6<br />

2<br />

- +<br />

4b, 5a 3b, 5b<br />

3b<br />

2<br />

4b<br />

3a<br />

+<br />

4a, 6<br />

-<br />

4b, 5a<br />

2<br />

+<br />

3b<br />

+<br />

3b<br />

2<br />

4b<br />

3a<br />

1<br />

4a<br />

5b<br />

3a<br />

1<br />

4a<br />

6<br />

6<br />

33<br />

34<br />

Building Example (Done)<br />

BSP-Tree Rendering<br />

3a<br />

+<br />

4a<br />

1<br />

- +<br />

6<br />

+<br />

4b<br />

-<br />

2<br />

+<br />

3b<br />

+ +<br />

5a<br />

5b<br />

3b<br />

3a<br />

5b<br />

1<br />

6<br />

2<br />

5a<br />

4b<br />

4a<br />

• Observation: Things on the opposite side of a splitting plane from<br />

the viewpoint cannot obscure things on the same side as the<br />

viewpoint<br />

• Rendering algorithm is recursive descent of the BSP Tree<br />

• At each node (for back to front rendering):<br />

– Recurse down the side of the sub-tree that does not contain the viewpoint<br />

Test viewpoint against the split plane to decide which tree<br />

– Draw the polygon in the splitting plane<br />

Paint over whatever has already been drawn<br />

– Recurse down the side of the tree containing the viewpoint<br />

35<br />

36<br />

6

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!