slide1 n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
ICS 415 Computer Graphics Rendering Geometric Primitives PowerPoint Presentation
Download Presentation
ICS 415 Computer Graphics Rendering Geometric Primitives

Loading in 2 Seconds...

play fullscreen
1 / 60

ICS 415 Computer Graphics Rendering Geometric Primitives - PowerPoint PPT Presentation


  • 90 Views
  • Uploaded on

ICS 415 Computer Graphics Rendering Geometric Primitives. Dr. Muhammed Al-Mulhem March 1, 2009. Rendering geometric primitives. Describe objects with points, lines, and surfaces Compact mathematical notation Operators to apply to those representations Render the objects

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'ICS 415 Computer Graphics Rendering Geometric Primitives' - isabelle-duncan


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
slide1

ICS 415Computer Graphics Rendering Geometric Primitives

Dr. Muhammed Al-Mulhem

March 1, 2009

Dr. Muhammed Al-Mulhem

rendering geometric primitives
Rendering geometric primitives
  • Describe objects with points, lines, and surfaces
    • Compact mathematical notation
    • Operators to apply to those representations
  • Render the objects
    • The rendering pipeline
  • Reading:
    • Appendix A1-A5

Dr. Muhammed Al-Mulhem

rendering
Rendering
  • Generate an image from geometric primitives

Rendering

Geometric

Primitives

Raster

Image

Dr. Muhammed Al-Mulhem

3d rendering example
3D Rendering Example

What issues must be addressed by a 3D rendering system?

Dr. Muhammed Al-Mulhem

overview
Overview
  • 3D scene representation
  • 3D viewer representation
  • Visible surface determination
  • Lighting simulation

Dr. Muhammed Al-Mulhem

overview1
Overview
  • 3D scene representation
  • 3D viewer representation
  • Visible surface determination
  • Lighting simulation

How is the 3D scene

described in a computer?

Dr. Muhammed Al-Mulhem

3d scene representation
3D Scene Representation
  • Scene is usually approximated by 3D primitives
    • Point
    • Line segment
    • Polygon
    • Polyhedron
    • Curved surface
    • Solid object
    • etc.

Dr. Muhammed Al-Mulhem

3d point
3D Point
  • Specifies a location

Dr. Muhammed Al-Mulhem

3d point1
3D Point
  • Specifies a location
    • Represented by three coordinates

(x,y,z)

Dr. Muhammed Al-Mulhem

3d vector
3D Vector
  • Specifies a direction and a magnitude

Dr. Muhammed Al-Mulhem

3d vector1
3D Vector
  • Specifies a direction and a magnitude
    • Represented as the difference between two point positions by three coordinates (Vx, Vy, Vz).
    • Magnitude |V| = sqrt( Vx2 + Vy2 + Vz2)
    • Has no location

(Vx, Vy, Vz).

Dr. Muhammed Al-Mulhem

vector addition subtraction

u+v

Vector Addition/Subtraction
  • Operation u + v, with:
    • Identity 0 : v + 0 = v
    • Inverse - : v + (-v) = 0
  • Addition uses the “parallelogram rule”:

v

u

-v

v

-v

u-v

u

Dr. Muhammed Al-Mulhem

vector space
Vector Space
  • Vectors define a vector space
    • They support vector addition
      • Commutative and associative
      • Possess identity and inverse
    • They support scalar multiplication
      • Associative, distributive
      • Possess identity

Dr. Muhammed Al-Mulhem

affine spaces
Affine Spaces
  • Vector spaces lack position and distance
    • They have magnitude and direction but no location
  • Combine the point and vector primitives
    • Permits describing vectors relative to a common location
  • A point and three vectors define a 3-D coordinate system
  • Point-point subtraction yields a vector

Dr. Muhammed Al-Mulhem

coordinate systems

Y

Y

Z

X

Right-handed

coordinate

Left-handed

system

coordinate

system

Z

X

Coordinate Systems

Grasp z-axis with hand

Thumb points in direction of z-axis

Roll fingers from positive x-axis towards positive y-axis

Dr. Muhammed Al-Mulhem

points vectors

Q

v

P

Points + Vectors
  • Points support these operations
    • Point-point subtraction: Q - P = v
      • Result is a vector pointing fromPtoQ
    • Vector-point addition: P + v = Q
      • Result is a new point
    • Note that the addition of two points is not defined

Dr. Muhammed Al-Mulhem

3d line segment
3D Line Segment
  • Linear path between two points

Dr. Muhammed Al-Mulhem

3d line segment1
3D Line Segment
  • Use a linear combination of two points
    • Parametric representation:
      • P = P1 + t (P2 - P1), (0  t 1)

P2

P1

Dr. Muhammed Al-Mulhem

3d ray
3D Ray
  • Line segment with one endpoint at infinity
    • Parametric representation:
      • P = P1 + t V, (0<= t < )

V

P1

Dr. Muhammed Al-Mulhem

3d line
3D Line
  • Line segment with both endpoints at infinity
    • Parametric representation:
      • P = P1 + t V, (- < t < )

V

P1

Dr. Muhammed Al-Mulhem

3d line slope intercept

P = (x, y)

y

P2 = (x2, y2)

P1 = (x1, y1)

x

3D Line – Slope Intercept
  • Slope =m
  • = rise / run
  • Slope = (y - y1) / (x - x1) = (y2 - y1) / (x2 - x1)
  • Solve for y:
  • y = [(y2 - y1)/(x2 - x1)]x + [-(y2-y1)/(x2 - x1)]x1 + y1
  • or: y = mx + b

Dr. Muhammed Al-Mulhem

euclidean spaces
Euclidean Spaces
  • Q: What is the distance function between points and vectors in affine space?
  • A: Dot product
    • Euclidean affine space = affine space plus dot product
    • Permits the computation of distance and angles

Dr. Muhammed Al-Mulhem

dot product

v

θ

u

Dot Product
  • Thedot productor, more generally, inner productof two vectors is a scalar:

v1 • v2 = x1x2 + y1y2 + z1z2 (in 3D)

Dr. Muhammed Al-Mulhem

dot product1

v

θ

u

Dot Product
  • Useful for many purposes
    • Computing the length (Euclidean Norm) of a vector:
      • length(v) = ||v|| = sqrt(v • v)
    • Normalizing a vector, making it unit-length: v = v / ||v||
    • Computing the angle between two vectors:
      • u • v = |u| |v| cos(θ)
    • Checking two vectors for orthogonality
      • u • v = 0.0

Dr. Muhammed Al-Mulhem

dot product2

w

v

u

Dot Product
  • Projecting one vector onto another
    • If v is a unit vector and we have another vector, w
    • We can project w perpendicularly onto v
    • And the result, u, has length w • v

Dr. Muhammed Al-Mulhem

dot product3
Dot Product
  • Is commutative
    • u • v = v • u
  • Is distributive with respect to addition
    • u • (v + w) = u • v + u • w

Dr. Muhammed Al-Mulhem

cross product
Cross Product
  • The cross product or vector product of two vectors is a vector:
  • The cross product of two vectors is orthogonal to both
  • Right-hand rule dictates direction of cross product

Dr. Muhammed Al-Mulhem

cross product right hand rule
Cross Product Right Hand Rule
  • See: http://www.phy.syr.edu/courses/video/RightHandRule/index2.html
  • Orient your right hand such that your palm is at the beginning of A and your fingers point in the direction of A
  • Twist your hand about the A-axis such that B extends perpendicularly from your palm
  • As you curl your fingers to make a fist, your thumb will point in the direction of the cross product

Dr. Muhammed Al-Mulhem

cross product right hand rule1
Cross Product Right Hand Rule
  • See: http://www.phy.syr.edu/courses/video/RightHandRule/index2.html
  • Orient your right hand such that your palm is at the beginning of A and your fingers point in the direction of A
  • Twist your hand about the A-axis such that B extends perpendicularly from your palm
  • As you curl your fingers to make a fist, your thumb will point in the direction of the cross product

Dr. Muhammed Al-Mulhem

slide30

Cross Product Right Hand Rule

  • See: http://www.phy.syr.edu/courses/video/RightHandRule/index2.html
  • Orient your right hand such that your palm is at the beginning of A and your fingers point in the direction of A
  • Twist your hand about the A-axis such that B extends perpendicularly from your palm
  • As you curl your fingers to make a fist, your thumb will point in the direction of the cross product

Dr. Muhammed Al-Mulhem

slide31

Cross Product Right Hand Rule

  • See: http://www.phy.syr.edu/courses/video/RightHandRule/index2.html
  • Orient your right hand such that your palm is at the beginning of A and your fingers point in the direction of A
  • Twist your hand about the A-axis such that B extends perpendicularly from your palm
  • As you curl your fingers to make a fist, your thumb will point in the direction of the cross product

Dr. Muhammed Al-Mulhem

slide32

Cross Product Right Hand Rule

  • See: http://www.phy.syr.edu/courses/video/RightHandRule/index2.html
  • Orient your right hand such that your palm is at the beginning of A and your fingers point in the direction of A
  • Twist your hand about the A-axis such that B extends perpendicularly from your palm
  • As you curl your fingers to make a fist, your thumb will point in the direction of the cross product

Dr. Muhammed Al-Mulhem

other helpful formulas
Other helpful formulas
  • Length = sqrt (x2 - x1)2 + (y2 - y1)2
  • Midpoint, p2, between p1 and p3
    • p2 = ((x1 + x3) / 2, (y1 + y3) / 2))
  • Two lines are perpendicular if:
    • M1 = -1/M2
    • cosine of the angle between them is 0
    • Dot product = 0

Dr. Muhammed Al-Mulhem

3d plane
3D Plane
  • A linear combination of three points

P2

P3

P1

Dr. Muhammed Al-Mulhem

3d plane1

Origin

3D Plane
  • A linear combination of three points
    • Implicit representation:
      • ax + by + cz + d = 0, or
      • P·N + d = 0
    • N is the plane “normal”
      • Unit-length vector
      • Perpendicular to plane

N = (a,b,c)

P2

P3

P1

d

Dr. Muhammed Al-Mulhem

3d sphere

r

3D Sphere
  • All points at distance “r” from point “(cx, cy, cz)”
    • Implicit representation:
      • (x - cx)2 + (y - cy)2 + (z - cz)2 = r 2
    • Parametric representation:
      • x = r cos() cos() + cx
      • y = r cos() sin() + cy
      • z = r sin() + cz

Dr. Muhammed Al-Mulhem

3d geometric primitives
3D Geometric Primitives
  • More detail on 3D modeling later in course
    • Point
    • Line segment
    • Polygon
    • Polyhedron
    • Curved surface
    • Solid object
    • etc.

Dr. Muhammed Al-Mulhem

H&B Figure 10.46

take a breath
Take a breath
  • We’re done with the primitives
  • Now we’re moving on to study how graphics uses these primitives to make pretty pictures

Dr. Muhammed Al-Mulhem

rendering 3d scenes

Transform

Illuminate

Transform

Clip

Project

Rasterize

Model & CameraParameters

Rendering Pipeline

Framebuffer

Display

Rendering 3D Scenes

Dr. Muhammed Al-Mulhem

camera models
Camera Models
  • The most common model is pin-hole camera
    • All captured light rays arrive along paths toward focal point without lens distortion (everything is in focus)
    • Sensor response proportional to radiance
  • Other models consider ...Depth of field, Motion blur, Lens distortion

View plane

Eye position

(focal point)

Dr. Muhammed Al-Mulhem

camera parameters
Camera Parameters
  • What are the parameters of a camera?

Dr. Muhammed Al-Mulhem

camera parameters1
Camera Parameters
  • Position
    • Eye position (px, py, pz)
  • Orientation
    • View direction (dx, dy, dz)
    • Up direction (ux, uy, uz)
  • Aperture
    • Field of view (xfov, yfov)
  • Film plane
    • “Look at” point
    • View plane normal

View

Plane

Up direction

“Look at”

Point

back

Viewdirection

Eye

Position

right

Dr. Muhammed Al-Mulhem

moving the camera
Moving the camera

Up

Back

Towards

Right

View Frustum

Dr. Muhammed Al-Mulhem

the rendering pipeline

Transform

Illuminate

Transform

Clip

Project

Rasterize

Model & CameraParameters

Rendering Pipeline

Framebuffer

Display

The Rendering Pipeline

Dr. Muhammed Al-Mulhem

rendering transformations
Rendering: Transformations
  • We’ve learned about transformations
  • But they are used in three ways:
    • Modeling transforms
    • Viewing transforms (Move the camera)
    • Projection transforms (Change the type of camera)

Dr. Muhammed Al-Mulhem

the rendering pipeline 3 d
The Rendering Pipeline: 3-D

Scene graphObject geometry

  • Result:
  • All vertices of scene in shared 3-D “world” coordinate system
  • Vertices shaded according to lighting model
  • Scene vertices in 3-D “view” or “camera” coordinate system
  • Exactly those vertices & portions of polygons in view frustum
  • 2-D screen coordinates of clipped vertices

ModelingTransforms

LightingCalculations

ViewingTransform

Clipping

ProjectionTransform

Dr. Muhammed Al-Mulhem

slide47

Scene graphObject geometry

  • Result:
  • All vertices of scene in shared 3-D “world” coordinate system

ModelingTransforms

LightingCalculations

ViewingTransform

Clipping

ProjectionTransform

The Rendering Pipeline: 3-D

Dr. Muhammed Al-Mulhem

rendering transformations1

Y

X

Z

Rendering: Transformations
  • Modeling transforms
    • Size, place, scale, and rotate objects and parts of the model w.r.t. each other
    • Object coordinates -> world coordinates

Y

Z

X

Dr. Muhammed Al-Mulhem

slide49

Scene graphObject geometry

  • Result:
  • All geometric primitives are illuminated

ModelingTransforms

LightingCalculations

ViewingTransform

Clipping

ProjectionTransform

The Rendering Pipeline: 3-D

Dr. Muhammed Al-Mulhem

lighting simulation

N

N

Lighting Simulation

Light

Source

  • Lighting parameters
    • Light source emission
    • Surface reflectance
    • Atmospheric attenuation
    • Camera response

Surface

Camera

Dr. Muhammed Al-Mulhem

lighting simulation1

N

N

Lighting Simulation

Light

Source

  • Direct illumination
    • Ray casting
    • Polygon shading
  • Global illumination
    • Ray tracing
    • Monte Carlo methods
    • Radiosity methods

Surface

N

Camera

Dr. Muhammed Al-Mulhem

slide52

The Rendering Pipeline: 3-D

Scene graphObject geometry

  • Result:
  • Scene vertices in 3-D “view” or “camera” coordinate system

ModelingTransforms

LightingCalculations

ViewingTransform

Clipping

ProjectionTransform

Dr. Muhammed Al-Mulhem

rendering transformations2

Y

X

Right-handed

coordinate

system

Z

Rendering: Transformations
  • Viewing transform
    • Rotate & translate the world to lie directly in front of the camera
      • Typically place camera at origin
      • Typically looking down -Z axis
    • World coordinatesaView coordinates

Dr. Muhammed Al-Mulhem

slide54

The Rendering Pipeline: 3-D

Scene graphObject geometry

  • Result:
  • Remove geometry that is out of view

ModelingTransforms

LightingCalculations

ViewingTransform

Clipping

ProjectionTransform

Dr. Muhammed Al-Mulhem

slide55

The Rendering Pipeline: 3-D

Scene graphObject geometry

  • Result:
  • 2-D screen coordinates of clipped vertices

ModelingTransforms

LightingCalculations

ViewingTransform

Clipping

ProjectionTransform

Dr. Muhammed Al-Mulhem

rendering transformations3
Rendering: Transformations
  • Projection transform
    • Apply perspective foreshortening
      • Distant = small: the pinhole camera model
    • View coordinates a Screen coordinates

Dr. Muhammed Al-Mulhem

rendering transformations4
Rendering: Transformations
  • Perspective Camera
  • Orthographic Camera

Dr. Muhammed Al-Mulhem

rendering 3d scenes1

Transform

Illuminate

Transform

Clip

Project

Rasterize

Model & CameraParameters

Rendering Pipeline

Framebuffer

Display

Rendering 3D Scenes

Dr. Muhammed Al-Mulhem

rasterize
Rasterize
  • Convert screen coordinates to pixel colors

Dr. Muhammed Al-Mulhem

summary
Summary
  • Geometric primitives
    • Points, vectors
  • Operators on these primitives
    • Dot product, cross product, norm
  • The rendering pipeline
    • Move models, illuminate, move camera, clip, project to display, rasterize

Dr. Muhammed Al-Mulhem