Top Banner
Chapter 14 Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14: The Camera
30

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.

Dec 21, 2015

Download

Documents

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: Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.

Chapter 14

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer

Chapter 14: The Camera

Page 2: Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.

Chapter 14

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer

This Chapter: we will learn about Requirements of a Computer Graphics

Camera

Visible Volumes Perspective vs Orthorgraphics

Coordinate Systems Eye (Camera) Coordinate System 3D Normalized Device Coordinate System

3D to 2D Perspective Projection

Page 3: Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.

Chapter 14

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer

A Computer Graphics Camera

Camera position Look at position Up direction Related terms:

Image Plane Viewing Direction View Vector

Page 4: Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.

Chapter 14

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer

The Up Direction (Up Vector):

Also referred to as: Twist Angle Cannot be parallel to viewing direction Does not need to be normalized Does not need to be perpendicular to

viewing direction

Page 5: Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.

Chapter 14

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer

Tut 14.1: Viewing Parameters

All viewing parameterscontrolled by slider bars

Page 6: Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.

Chapter 14

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer

z=slider:

Twist angle:

not perpendicularto View Vector!

Tut 14.1: Controlling the Up Vector

Page 7: Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.

Chapter 14

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer

The Visible Volume

Only geometries (primitives) inside the volume are visible

All geometries (primitives) outside are ignored

Primitives straddle the volume are Clipped!

Page 8: Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.

Chapter 14

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer

The Rectangular Visible Volume

Volume defined by: Near Plane (n) Far Plane (f) Width (W) Height (H)

For Orthographic Projection

Page 9: Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.

Chapter 14

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer

Tut 14.2: Rectangular Visible Volume

Experiment with

RectangularVisibleVolume

Page 10: Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.

Chapter 14

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer

Tut 14.2: Orthographic Projection

Page 11: Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.

Chapter 14

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer

The Viewing Frustum Volume

Volume defined by: Near Plane (n) Far Plane (f) Fields of view (fov)

For Orthographic Projection

Page 12: Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.

Chapter 14

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer

Near Plane and Aspect Ratio

Aspect Ratio

Near Plane Height (nh) Width (nw)

Page 13: Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.

Chapter 14

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer

Tut 14.3: Viewing Frustum

Experiment with

Viewing Frustum

Page 14: Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.

Chapter 14

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer

Tut 14.3: Perspective Projection

Page 15: Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.

Chapter 14

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer

Orthographic vs Perspective Projection

Orthographic Projection Parallel projection Preserve size

Good for determining relative size

Perspective Projection Projection along rays Closer objects appears larger Human vision!

Only work with: Perspective Projection

Page 16: Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.

Chapter 14

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer

Near-to-Far Plane distance Fixed number of bits to resolve distance E.g.: 16-bits: Unique positions:

If (f-n)=18: resolve distances larger than:

If (f-n) = 106: resolve distance larger than:

Rule of Thumb: Minimize f and maximize n f-n – As tight as possible

Page 17: Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.

Chapter 14

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer

Tut 14.4: Near/Far Distance

Two squares very closeto each other:

Set n/f values to see errors!!

Page 18: Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.

Chapter 14

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer

Coordinate Transformation Pipeline

Recall:

Transforms

World Transform (MW) Object Space (OC) To World Space (WC)

View Transform (MV) WC to Eye (Camera) Space (EC)

Projection Transform (MP) EC To NDC (Normalize Device)

Page 19: Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.

Chapter 14

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer

The MW: World Transform

Transformation: From Object Space to World Space

Identical to 2D! Refer to discussions:

In Chapter 11: World Coordinate System

Library Implementation: SceneNode’s Transform operator! DrawHelper: Matrix Stack Manipulations!

Page 20: Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.

Chapter 14

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer

The MV: View Transform

Transformation From World to Eye Space Referred to as:

Eye, or View, or Camera Transform Topics:

Eye Coordinate Orthonormal Basis The Eye Coordinate (EC) Space Aligning EC and WC Orthonormal Basis The WC to EC Transform

Page 21: Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.

Chapter 14

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer

The EC Orthonormal Basis Viewing Parameters: Eye Position

At PositionUp Vector

View Vector Side Vector Adjusted Up Vector:

Page 22: Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.

Chapter 14

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer

Example:

Page 23: Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.

Chapter 14

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer

The Eye Coordinate Space

Origin: eye position Axes Directions

View: -z Up: y Side: x

Visible Volume Near: z=-n Far: z=-f

Page 24: Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.

Chapter 14

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer

Align EC and WC Orthonormal Basis

Page 25: Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.

Chapter 14

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer

MV: Mw2e WC To EC Transform

Page 26: Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.

Chapter 14

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer

Inverse Transform: Me2w

Row-4 is: The Eye Position!!

Page 27: Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.

Chapter 14

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer

The MP: Projection Transform

Transform from EC to NDC Recall NDC Range:

Transform: Squeeze the View Frustum into NDC

Cube

Page 28: Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.

Chapter 14

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer

View Frustum to NDC Cube

Page 29: Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.

Chapter 14

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer

3D NDC to 2D Image (Near) Plane

Resulting image on the near plane

Page 30: Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.

Chapter 14

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer

Re-Examine Tutorial 13.1

GrfxWindow::OnPaint()