1. Trang chủ
  2. » Giáo Dục - Đào Tạo

Lecture computer graphics and virtual reality slides lesson 11 hidden surface removal

40 0 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Hidden Surface Removal
Tác giả Trinh Thanh Trung
Trường học School of ICT, HUST
Thể loại Lecture Slides
Định dạng
Số trang 40
Dung lượng 1,13 MB

Nội dung

Trang 4 Why hidden surface removal■ A correct rendering requires correct visibility calculations■ When multiple opaque polygons cover the same screen space, only the closest one is visib

Trang 3

Overview

Trang 4

Why hidden surface removal

■ A correct rendering requires correct visibility

calculations

screen space, only the closest one is visible (remove the other hidden surfaces)

wrong visibility correct visibility

Trang 5

Why hidden surface removal

resources rendering primitives which don’t

contribute to the final image

CPU cycles

□ e.g Illumination

Trang 6

Hidden surface removal

Trang 7

Painter’s algorithm

Trang 8

Painter’s algorithm

polygons “paint” over farther ones

first

Trang 9

Painter’s algorithm: Problem

determination

□ see image at right

Trang 10

Painter’s algorithm: Problem

need to segment the

triangles and make

them sortable

Trang 11

Z Buffer

Trang 13

□ For every pixel in the polygon interior, calculate its corresponding z value (by interpolation)

□ Compare the depth value with the closest value from a different polygon (largest z) so far

□ Paint the pixel with the color of the polygon if it is closer

Trang 14

Z-Buffer example

Trang 15

−1.0 −1.0 −1.0 −1.0

−1.0 −1.0 −1.0 −1.0

−1.0 −1.0 −1.0 −1.0

−1.0 −1.0 −1.0 −1.0 Step 1: Initialise the depth buffer

Trang 16

Step 2: Draw the blue polygon (order does not affect the final result)

Trang 17

Step 2: Draw the yellow polygon

- If the depth value is greater than corresponding value in z-buffer, that pixel is coloured and the value in z-buffer will be updated

Trang 18

Step 2: Draw the red polygon

- Similarly, if the depth value is greater than corresponding value

in z-buffer, that pixel is coloured and the value in z-buffer will be updated

Trang 19

□ Memory for z-buffer is now not expensive

Trang 20

Disadvantages

Trang 21

BSP Tree

Trang 22

BSP Tree

□ Only draw those close to the viewer

□ Similar to the painter’s algorithm, but doing a detailed scene analysis

□ Suitable for a scene below

Trang 23

BSP Tree algorithm

(relative to normal) and back

half-spaces

both sides

each side – split scene again

side until each node contains

only 1 polygon

3

4 1

2

5

View of scene from above

Trang 24

BSP Tree algorithm

(relative to normal) and back

4 5b

back front

3

4 1

2

5 5a

5b

Trang 25

BSP Tree algorithm

each side & split scene again

3

4 1

2

5 5a

5b

3

4 5b

back front

2

1 5a

front

Trang 26

BSP Tree algorithm

side until each node contains

only 1 polygon

3

4 1

2

5 5a

5b

3 backfront

2

1 5a

front

5b 4

Trang 27

BSP Tree displaying

priority list for an arbitrary viewpoint

□ Back-to-front: same as painter’s algorithm

□ Front-to-back: more efficient

Trang 28

BSP Tree displaying

Back to front

□ If viewer is in front half-space, draw polygons behind root first, then the root polygon, then polygons in front.

□ If viewer is in back half-space, draw polygons in front of root first, then the root polygon, then polygons behind.

□ If polygon is on edge – either can be used.

□ Recursively descend the tree

■ If eye is in rear half-space for a polygon can back face cull

Trang 29

4 1

2

5 5a

5b

3 backfront

2

1 5a

front

5b 4

Trang 30

in

Trang 32

Use of BSP Tree

□ Need to produce a well balanced tree

□ Intersecting polygon splitting may also be costly

■ Cheap to check visibility once tree is set up

→Efficient when objects don’t change very often in the scene.

■ Render the static objects first (front-to-back)

with the Z-buffer on

Trang 33

Architectural scenes

Trang 34

Portal culling

Trang 35

Portal culling

□ Nodes: Cells (or rooms)

□ Edges: Portals (or doors)

□ Potentially visible set

2 If portal to the next room is visible, render the

connected room in the portal region

A B D

A

B C

D

E F

G

Trang 36

Additional techniques

Trang 37

Back face culling

other direction

If negative – cull, since normal points away from viewer

■ Or if N.V > 0 we are viewing the back face so polygon is obscured

Trang 38

are mapped to pixels

□ Painter’s algorithm, BSP trees, portal culling

vertices are rasterized

□ Z-buffering

▫ Z-buffer is easy to implement on hardware and is

a standard technique for hidden surface removal

▫ Need to combine it with an object-based method especially when there are too many polygons

Trang 39

Any questions?

Trang 40

Lecture notes provided by School of Information and

Communication Technology, Hanoi University of Science and

Technology.

Composed by Huynh Quyet Thang, Le Tan Hung, Trinh Thanh

Trung and others

Edited by Trinh Thanh Trung

Special thanks to all the people who made and released these awesome resources for free:

■ Presentation template by SlidesCarnival

■ Photographs by Death to the Stock Photo ( license )

■ Diverse device hand photos by Facebook Design Resources

Ngày đăng: 02/03/2024, 13:59

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN