cg unit 7 full

Post on 10-Apr-2018

224 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

8/8/2019 Cg Unit 7 Full

http://slidepdf.com/reader/full/cg-unit-7-full 1/24

object-space methods and image-space methods.

 An object-space method compam objects and parts of objects to each

other within the scene definition to determine which surfaces, as a whole, we

should label as visible.

In an image-space algorithm, visibility is decided point by

point at each pixel position on the projection plane.

8/8/2019 Cg Unit 7 Full

http://slidepdf.com/reader/full/cg-unit-7-full 2/24

BACK-FACE DETECTION

 A point (x , y,z) is "inside" a polygon surface

if Ax+By+Cz+D < 0

If V.N > 0 then this polygon is back faced

8/8/2019 Cg Unit 7 Full

http://slidepdf.com/reader/full/cg-unit-7-full 3/24

BACK-FACE DETECTION

8/8/2019 Cg Unit 7 Full

http://slidepdf.com/reader/full/cg-unit-7-full 4/24

DEPTH-BUFFER METHOD

(Z-Buffer)

With object descriptions converted to projection coordinates, each (x, y, z )

position on a polygon surface corresponds to the orthographic projection point

(x, y) on the view plane.

8/8/2019 Cg Unit 7 Full

http://slidepdf.com/reader/full/cg-unit-7-full 5/24

DEPTH-BUFFER METHOD

Plane Value of Z

Back plane 0

Front plane Zmax

Types of Buffers

Depth Buffer 

Refresh Buffer 

8/8/2019 Cg Unit 7 Full

http://slidepdf.com/reader/full/cg-unit-7-full 6/24

 Algorithm

1. Initialize the depth buffer and refresh buffer so that for all buffer positions(x , y),

depth(x,y)=0 and refresh(x,y)=Ibground

2. For each position on each polygon surface, compare depth values to previously stored values in the depth buffer to determine visibility.

- Calculate the depth t  for each (x , y) position on the polygon.

- If z > depth(x, y), then set

depth(x,y)=Z and refresh(x,y)=Isurface(x,y).

where Ibground is the value for the background intensity, and Isurface(x,y) isthe projected intensity value for the surface at pixel position (x,y).

 After all surfaces have been processed, the depth buffer contains

depth values for the visible surfaces and the refresh buffer contains

the corresponding intensity values for those surfaces.

8/8/2019 Cg Unit 7 Full

http://slidepdf.com/reader/full/cg-unit-7-full 7/24

Depth values for a surface position (x , y) 

are calculated from the plane equation for 

each surface:

8/8/2019 Cg Unit 7 Full

http://slidepdf.com/reader/full/cg-unit-7-full 8/24

A-BUFFER METHOD

 An extension of the ideas in the depth-buffer method is the A-buffer method.

it deals only with opaque surfaces and cannot accumulate intensity values

for more than one surface.

Each position in the A-buffer has two fields:

1.depth field - stores a positive or negative real number 2. intensity field - stores surface-intensity information or a pointer value.

Foreground

Transprent

surface

Backgroundopaque

surface

8/8/2019 Cg Unit 7 Full

http://slidepdf.com/reader/full/cg-unit-7-full 9/24

Data for each surface in the linked list includes

RGB intensity components opacity parameter (percent of transparency)

depth

percent of area coverage

surface identifier 

other surface-rendering parameters

pointer to next surface

A-BUFFER METHOD

8/8/2019 Cg Unit 7 Full

http://slidepdf.com/reader/full/cg-unit-7-full 10/24

SC AN-LINE METHOD

It is an image-space technique.

It is an extended form of the scan-line fill alg.

Visible surface can be calculated by finding

the intersection between scan line and polygon surface.

Two tables are maintained ± Edge table

 ± Polygon table

8/8/2019 Cg Unit 7 Full

http://slidepdf.com/reader/full/cg-unit-7-full 11/24

For positions along this scan line between edges  AB and BC, onlythe flag for surface Sl is on.

Similarly, between edges EH and FG, only the flag for surface S2 ison.

For scan lines 2 and 3 the active edge list contains edges  AD, EH ,BC , and FG.

But between edges EH and BC , the flags for both surfaces are on.

SC AN-LINE METHOD

8/8/2019 Cg Unit 7 Full

http://slidepdf.com/reader/full/cg-unit-7-full 12/24

DEPTH-SORTING METHOD

Using both image-space and object-space

operations, the depth-sorting method

performs the following basic functions:

1. Surfaces are sorted in order of decreasing

depth.

2. Surfaces are scan converted in order,

starting with the surface of greatest depth.

8/8/2019 Cg Unit 7 Full

http://slidepdf.com/reader/full/cg-unit-7-full 13/24

DEPTH-SORTING METHOD

Triangle Behind counter List of triangles in f r ont of it

1 2 5

2 0 4,3,1

3 2 1,5

4 1 3

5 2

6 0

8/8/2019 Cg Unit 7 Full

http://slidepdf.com/reader/full/cg-unit-7-full 14/24

DEPTH-SORTING METHODTriangle Fr ont List Behind counter  output New Behind

counter 

1 5 2 1

2 4,3,1 0 -1

3 1,5 2 1

4 3 1 0

5 2

2

6 0 -1

8/8/2019 Cg Unit 7 Full

http://slidepdf.com/reader/full/cg-unit-7-full 15/24

DEPTH-SORTING METHODTriangle Fr ont List Behind counter  output New Behind

counter 

1 5 1 1

2 4,3,1 -1 -1

3 1,5 1 0

4 3 0 -1

5

2 2

6 -1 -1

8/8/2019 Cg Unit 7 Full

http://slidepdf.com/reader/full/cg-unit-7-full 16/24

DEPTH-SORTING METHODTriangle Fr ont List Behind counter  output New Behind

counter 

1 5 1 0

2 4,3,1 -1 -1

3 1,5 0 -1

4 3 -1 -1

5

2 1

6 -1 -1

8/8/2019 Cg Unit 7 Full

http://slidepdf.com/reader/full/cg-unit-7-full 17/24

DEPTH-SORTING METHODTriangle Fr ont List Behind counter  output New Behind

counter 

1 5 0 -1

2 4,3,1 -1 -1

3 1,5 -1 -1

4 3 -1 -1

5

1 0

6 -1 -1

8/8/2019 Cg Unit 7 Full

http://slidepdf.com/reader/full/cg-unit-7-full 18/24

DEPTH-SORTING METHODTriangle Fr ont List Behind counter  output New Behind

counter 

1 5 -1 -1

2 4,3,1 -1 -1

3 1,5 -1 -1

4 3 -1 -1

5 0 -1

6 -1 -1

8/8/2019 Cg Unit 7 Full

http://slidepdf.com/reader/full/cg-unit-7-full 19/24

BSP-TREE METHOD

binary space-partitioning (BSP)

8/8/2019 Cg Unit 7 Full

http://slidepdf.com/reader/full/cg-unit-7-full 20/24

 ARE A-SUBDIVISION b1ETHOD

No further sub division is needed if 

1. All surfaces are outside surface with

respect to the area.

2. Only one inside , overlapping, or surrounding surface is in the area.

3. A surrounding surface obscures all

other surfaces within the area

boundaries.

8/8/2019 Cg Unit 7 Full

http://slidepdf.com/reader/full/cg-unit-7-full 21/24

Surr ounding sur f ace-One that

completely encloses the area.

Overlapping sur f ace-One that is partlyinside and partly outside the area.

Inside sur f ace-One that is completely

inside the area.

Outside sur f ace-One that is completely

outside the area.

 ARE A-SUBDIVISION METHOD

8/8/2019 Cg Unit 7 Full

http://slidepdf.com/reader/full/cg-unit-7-full 22/24

 ARE A-SUBDIVISION METHOD

Surr ounding sur f ace

Overlapping sur f ace

Outside sur f ace

inside sur f ace

8/8/2019 Cg Unit 7 Full

http://slidepdf.com/reader/full/cg-unit-7-full 23/24

OCTREE METHODS

8/8/2019 Cg Unit 7 Full

http://slidepdf.com/reader/full/cg-unit-7-full 24/24

RAY-CASTING METHOD

top related