Homogeneous Coordinates and 3D Computer Graphics, Study notes of Computer Graphics

The concept of homogeneous coordinates, its application in representing data and transforming objects in 3d computer graphics. It covers topics such as representing numbers, defining objects and transformations, perspective projection, and vertex transformation. The document also discusses techniques like culling, clipping, and projection matrices.

Typology: Study notes

Pre 2010

Uploaded on 07/31/2009

koofers-user-t4l
koofers-user-t4l 🇺🇸

10 documents

1 / 19

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Homogeneous Coordinates
A way of representing data
Representing n−d space by n+1 dimensions
1. representing big integer numbers
for example,
16bit word for an integer between
−32768 and 32767
How to represent a number > 32767 ?
a position [ 60000, y, z ]
homogeneous coordindates:
[ 30000, y/2, z/2, 1/2 ]
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13

Partial preview of the text

Download Homogeneous Coordinates and 3D Computer Graphics and more Study notes Computer Graphics in PDF only on Docsity!

Homogeneous Coordinates

A way of representing data

Representing n−d space by n+1 dimensions

  1. representing big integer numbers

for example,

16bit word for an integer between −32768 and 32767

How to represent a number > 32767?

a position [ 60000, y, z ]

homogeneous coordindates:

[ 30000, y/2, z/2, 1/2 ]

  1. defining an object and its transformation

Homogeneous Coordinates (cont’d)

− distinguish between a vector and a point

− modify the position of the origin of the coordinate system

there is no room in the 3x3 matrix to specify translation!

3x

x 1

1x3 1x

linear transformation (^) translation

perspective transformation

overall scaling

(rotation, scaling, reflection, shearing, ...)

− there is no unique homegeneous coordinate representation! −

h

h = 0?

View Volume

back clip plane

front clip plane

view plane window

COP

(View Frustum)

front clip plane back clip plane

view plane

COP (^) h

Perspective Projection

− foreshortening

− line width is not preserved, so are angles

− irreversible

COP

What happens if we move COP to infinitely far away?

Expressed in Homogeneous Coordindates

X/w Y/w Z/w w/w

xs ys zs 1

xs =

d zv

xv ys^ =^

d zv

yv

X xv Y yv Z zv w 1

= M

0 0 1/d 0

where M =

X x v Y yv Z zv w zv/d

that is, =

after perspective divide

xv/w yv/w d 1

0 0 1/d 0

M =

M =

For parallel projection:

For perspective projection:

x s = x v ys = y v zs = 0 (with projection plan at z=0)

P’ = M proj Mview P

An overall transformatin from World to Screen space can be expressed as:

model−view maxtrix

projection matrix

perspective division

viewport transformation

Vertices

Stages of Vertex Transformation

view coordinates

clip coordinates

normalized device coordinates

window coordinates

Clipping

  1. Point clipping
  2. Line segment clipping
  3. Polygon clipping
  4. Clipping in three dimensions

Point Clipping

xmin < x < xmax ymin < y < ymax

(xmin, ymin)

(xmax,ymax)

Otherwise, do not draw the point

Line Clipping

A

B

C

D

E

Brute Force Line Clipping

Compute intersections of line with every window boundary −> expensive

clip window

A

C

B D

E

E 0010 0010

C 0000 0000

B 0001 1000

A 0001 1000

D 0000 0010

Code(P0)&Code(P1) = 0

Code(P0)&Code(P1) = 0

Code(P0) = Code(P1) = 0

Code(P0) =0, Code(P1) = 0; or vice versa

Cohen−Sutherland Algorithm (cont’d)

Algorithm:

  1. Compute the binary region code for P0 and P
  2. Loop

− Test for trivial reject or accept (exit?)

− If ( code(P0)!=0 and code(P1)=0 )

One point is inside and the other is outside. The line must be shortened. One or two intersections must be computed. else if ( code(P0)&code(P1)=0 )

Both endpoints are outside. Intersect with one of the sides of the window, and check the code of the resulting point

A

C

B D

E

(A,B)

(D)

(C,E)

p 1 = −dx, q 1 = x1 − xmin p 2 = dx, q 2 = x max − x 1 p 3 = −dy, q 3 = y1 − ymin p 4 = dy, q 4 = y max − y 1

Liang−Barsky Line Clipping (cont’d)

pk = 0

q k < 0 the line is completely outside the boundary

the line is parallel to one of the clipping boundaries

q1< p 1=

q 2> p 4>

pk > 0

q k > 0 the line is inside the parallel clipping boundary

the line proceeds from the inside to the outside

Sutherland−Hodgeman Polygon Clipping

− clip the polygon to each of the window boundaries in succession − edge and vertex defintions of the polygon are updated accordingly

Polygon Clipping

The output of a polygon clipper should be a sequence of vertices that defines the clipped polygon boundaries

Concave case:

clipped

tessellation