Top Banner
Visible-Surface Detection Methods
33

Computer Graphics: Visible surface detection methods

Dec 22, 2014

Download

Education

Joseph Charles

computer graphics: 3d viewing methods- visible surface detection methods - Z buffer or depth buffer method...
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Computer Graphics: Visible surface detection methods

Visible-Surface Detection Methods

Page 2: Computer Graphics: Visible surface detection methods

Outline of Presentation

1. Introduction2. Classification3. Depth-Buffer Algorithm

Page 3: Computer Graphics: Visible surface detection methods

1. Introduction

• A set of 3-D surfaces are to be projected onto a 2-D screen.

• To identify those parts of a scene that are visible from a chosen viewing position.

• Correct visibility – when multiple opaque polygons cover the same

screen space, only the closest one is visible.

Page 4: Computer Graphics: Visible surface detection methods

Visibility

Page 5: Computer Graphics: Visible surface detection methods
Page 6: Computer Graphics: Visible surface detection methods

• There are many algorithms developed and still being developed for visible surface detection or Hidden surface removal.

• Characteristics of approaches:– Require large memory size.– Require long processing time.– Applicable to which types of objects?

Page 7: Computer Graphics: Visible surface detection methods

• Considerations:– Complexity of the scene– Type of objects in the scene– Available equipment– Static or animated?

• Visible-surface detection methods and hidden-surface elimination methods are similar but distinct.

Page 8: Computer Graphics: Visible surface detection methods

2. Classification

• Visible-surface detection algorithms are broadly classified into 2 types.1. Object –space methods2. Image-space methods

Page 9: Computer Graphics: Visible surface detection methods

Object-space methods

• Deals with object definitions directly.• Compare objects and parts of objects to each

other within the scene definition to determine which surfaces, as a whole, we should label as visible.

• It is a continuous method.• Compare each object with all other objects to

determine the visibility of the object parts.

Page 10: Computer Graphics: Visible surface detection methods

Pros and Cons of Object-space Methods

• If there are n objects in the scene, complexity = O(n2)

• Calculations are performed at the resolution in which the objects are defined (only limited by the computation hardware).

• Process is unrelated to display resolution or the individual pixel in the image and the result of the process is applicable to different display resolutions.

Page 11: Computer Graphics: Visible surface detection methods

• Display is more accurate but computationally more expensive as compared to image space

• methods are typically more complex, due to the possibility of intersection between surfaces.

• Suitable for scene with small number of objects and objects with simple relationship with each other.

Page 12: Computer Graphics: Visible surface detection methods

Image Space methods

• Deals with the projected images of the objects and not directly with objects.

• Visibility is determined point by point at each pixel position on the projection plane.

• It is a discrete method.• Accuracy of the calculation is bounded by the

display resolution.• A change of display resolution requires re-

calculation

Page 13: Computer Graphics: Visible surface detection methods

Two main strategies

• 1. Sorting• 2. Coherence

1. Sorting– Sorting is used to facilitate depth comparisons by

ordering the individual surfaces in a scene according to their distance from the view plane.

Page 14: Computer Graphics: Visible surface detection methods

Coherence

• Making use of the results calculated for one part of the scene or image for other nearby parts.

• Coherence is the result of local similarity• As objects have continuous spatial extent,

object properties vary smoothly within a small local region in the scene.

• Calculations can then be made incremental.

Page 15: Computer Graphics: Visible surface detection methods

3. Depth-Buffer Method (Z-Buffer Method)

• It is a commonly used image-space approach to detecting visible surfaces proposed by Catmull in 1974.

• It compares the surface depths at each pixel position on the projection plane.

• Object depth is usually measured from the view plane along the z axis of a viewing system.

• Each surface of a scene is processed separately, one point at a time across the surface.

Page 16: Computer Graphics: Visible surface detection methods

• This method requires 2 buffers:1) Depth buffer or z-buffer: • To store the depth values for each (X, Y)

position, as surfaces are processed.• 0 ≤ depth ≤ 12) Refresh Buffer or Frame Buffer:• To store the intensity value or Color value at

each position (X, Y).

Page 17: Computer Graphics: Visible surface detection methods
Page 18: Computer Graphics: Visible surface detection methods

Algorithm

1. depthbuffer(x,y) = 0framebuffer(x,y) = background color

2. Process each polygon one at a time2.1. For each projected (x,y) pixel position of a polygon, calculate depth z.2.2. If z > depthbuffer(x,y)

compute surface color, set depthbuffer(x,y) = z, framebuffer(x,y) = surfacecolor(x,y)

Page 19: Computer Graphics: Visible surface detection methods

Example

• The Final Image

Z = 0.3

Z = 0.5

Page 20: Computer Graphics: Visible surface detection methods

• Step 1: Initialize the depth buffer

0 0 0 0

0 0 0 0

0 0 0 0

0 0 0 0

Page 21: Computer Graphics: Visible surface detection methods

• Step 2: Draw the polygon with depth 0.3 (2.2)

0 0 0 0

0 0 0 0

0.3 0.3 0 0

0.3 0.3 0 0

Page 22: Computer Graphics: Visible surface detection methods

• Step 3: Draw the polygon with depth 0.5

0 0 0 0

0 0.5 0.5 0

0.3 0.5 0.5 0

0.3 0.3 0 0

Page 23: Computer Graphics: Visible surface detection methods

Calculating Depth

• We know the depth values at the vertices. • we can calculate the depth at any other point

on the surface of the polygon using the polygon surface equation:

C

DByAxz

Page 24: Computer Graphics: Visible surface detection methods
Page 25: Computer Graphics: Visible surface detection methods

• For any scan line adjacent horizontal x positions or vertical y positions differ by 1 unit.

• The depth value of the next position (x+1,y) on the scan line can be obtained using

C

Az

C

DByxAz

)1(

Page 26: Computer Graphics: Visible surface detection methods

• For adjacent scan-lines we can compute the x value using the slope of the projected line and the previous x value.

C

BmAz

mxx

/z

1

Page 27: Computer Graphics: Visible surface detection methods

Pros and Cons

• Widely used• Simple to implement• Needs large amount of memory (uses 2

buffers)• Aliasing problem.• Handle only opaque surfaces• Problem when too many surfaces are there.

Page 28: Computer Graphics: Visible surface detection methods

Questions

2 marks• What is the task of visible detection methods?• What is correct visibility?• What are the types of visible detection

algorithms?• Difference between object space methods and

image space methods?

Page 29: Computer Graphics: Visible surface detection methods

• What are the two strategies used in visible surface detection algorithms?

• What is coherence in image space methods?• Mention two advantages of object space

method.• Mention two disadvantages of object space

method.• What are the disadvantages of Image space

method?

Page 30: Computer Graphics: Visible surface detection methods

• What are the buffers used in Depth buffer method?

• What is the content of Z-buffer?• What is the content of refresh buffer?• What are the initial values of depth buffer and

refresh buffer?• What is the range of depth used in depth

buffer method?

Page 31: Computer Graphics: Visible surface detection methods

• What is the equation to calculate depth value z at (x,y) for a polygon surface?

• Mention any two disadvantages of depth buffer method.

10 marks• Explain depth buffer method in detail.

Page 32: Computer Graphics: Visible surface detection methods

Quote

If you have a ‘why’ to live for, you can cope with any ‘how’.

Page 33: Computer Graphics: Visible surface detection methods

Thank you!