TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 -...

56
TIEA311 Tietokonegrafiikan perusteet kev ¨ at 2017 (“Principles of Computer Graphics” – Spring 2017) Copyright and Fair Use Notice: The lecture videos of this course are made available for registered students only. Please, do not redistribute them for other purposes. Use of auxiliary copyrighted material (academic papers, industrial standards, web pages, videos, and other materials) as a part of this lecture is intended to happen under academic ”fair use” to illustrate key points of the subject matter. The lecturer may be contacted for take-down requests or other copyright concerns (email: paavo.j.nieminen@jyu.fi).

Transcript of TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 -...

Page 1: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

TIEA311Tietokonegrafiikan perusteetkevat 2017

(“Principles of Computer Graphics” – Spring 2017)

Copyright and Fair Use Notice:

The lecture videos of this course are made available forregistered students only. Please, do not redistribute them forother purposes. Use of auxiliary copyrighted material(academic papers, industrial standards, web pages, videos,and other materials) as a part of this lecture is intended tohappen under academic ”fair use” to illustrate key points of thesubject matter. The lecturer may be contacted for take-downrequests or other copyright concerns (email:[email protected]).

Page 2: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

TIEA311 Tietokonegrafiikan perusteet – kevat 2017(“Principles of Computer Graphics” – Spring 2017)

Adapted from: Wojciech Matusik, and Fredo Durand : 6.837 ComputerGraphics. Fall 2012. Massachusetts Institute of Technology: MITOpenCourseWare, https://ocw.mit.edu/.

License: Creative Commons BY-NC-SA

Original license terms apply. Re-arrangement and new contentcopyright 2017 by Paavo Nieminen and Jarno Kansanaho

Frontpage of the local course version, held during Spring 2017 at theFaculty of Information technology, University of Jyvaskyla:http://users.jyu.fi/˜nieminen/tgp17/

Page 3: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

TIEA311 - Course Status in Jyvaskyla

I Assignment 1 discussion – now is a good time to wrap thisup, self-evaluate, and move on! There are further topicsyet to come!

I Assignment 2 discussion – how to start with Joints andJoint*’s?

(Technical things about C++ were supposed to be covered, too,but there was a technical glitch at the lecture room this time.)

Page 4: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

1 MIT EECS 6.837 – Matusik

MIT EECS 6.837 Computer Graphics Part 2 – Rendering

NVIDIA

Today: Intro to Rendering, Ray Casting

© NVIDIA Inc. All rights reserved. This content is excluded from our Creative Commonslicense. For more information, see http://ocw.mit.edu/help/faq-fair-use/.

Page 5: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

• Modeling – splines, hierarchies, transformations, meshes, etc.

• Animation

– skinning, ODEs, masses and springs

• Now we’ll to see how to generate

an image given a scene description!

4

The Story So Far

Page 6: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

TIEA311 - Rest of the Course in Jyvaskyla

The next slide is verbatim from the MIT OCW course. Here is thecurrent plan for the remaining part of our adapted short version:

I Ray Casting: cover fully. Ray Tracing: cover the basic idea, skipdetails → possible to continue as a “hobby project”; NOTE:teachers of “TIEA306 Ohjelmointityo” may be contactedregarding the possibility of receiving credit for hobby projects.

I Shading, texture mapping: Cover the principles up to Phongmodel and texture coordinates.

I Rasterization, z-buffering: cover basic ideasI Global Illumination, Monte Carlo techniques: skip this → could

be suitable for bachelor thesis (introductory topics) or evenmaster thesis (current state-of-the-art techniques)

I Image-based rendering: skip → defer to advanced courses (e.g.“TIES411 Konenako ja kuva-analyysi”)

I Sampling and antialiasing: mostly skip → defer theory to“TIES324 Signaalinkasittely” and techniques (possibly) to“TIES471 Reaaliaikainen renderointi”.

I Shadow techniques, Graphics Hardware → defer to TIES471.

Page 7: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

• Ray Casting and Ray Tracing • Intro to Global Illumination

– Monte Carlo techniques, photon mapping, etc. • Shading, texture mapping

– What makes materials look like they do? • Image-based Rendering • Sampling and antialiasing • Rasterization, z-buffering • Shadow techniques • Graphics Hardware

5

The Remainder of the Term

[Lehtinen et al. 2008] © ACM. All rights reserved. This content is excluded from our Creative Commonslicense. For more information, see http://ocw.mit.edu/help/faq-fair-use/.

Page 8: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

• What does rendering mean?

• Basics of ray casting

6

Today

Page 9: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

Scene 7

© source unknown. All rights reserved. This content is excluded from our CreativeCommons license. For more information, see http://ocw.mit.edu/help/faq-fair-use/.

© Oscar Meruvia-Pastor, Daniel Rypl. All rights reserved. This content is excluded from our CreativeCommons license. For more information, see http://ocw.mit.edu/help/faq-fair-use/.

Page 10: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

8

Scene Camera

This image is in the public domain.Source: openclipart

© source unknown. All rights reserved. This content is excluded from our CreativeCommons license. For more information, see http://ocw.mit.edu/help/faq-fair-use/.

© Oscar Meruvia-Pastor, Daniel Rypl. All rights reserved. This content is excluded from our CreativeCommons license. For more information, see http://ocw.mit.edu/help/faq-fair-use/.

Page 11: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

9

Scene

Camera Image plane

Pixels

© source unknown. All rights reserved. This content isexcluded from our Creative Commons license. For moreinformation, see http://ocw.mit.edu/help/faq-fair-use/.

© Oscar Meruvia-Pastor, Daniel Rypl. All rights reserved.

This content is excluded from our Creative Commons

license. For more information, seehttp://ocw.mit.edu/help/faq-fair-use/.

This image is in the public domain.Source: openclipart

Page 12: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

10

Scene

Camera Image plane

Image

Pixels

Rendering = Scene to Image

© source unknown. All rights reserved. Thiscontent is excluded from our Creative

Commons license. For more information, seehttp://ocw.mit.edu/help/faq-fair-use/.

© Oscar Meruvia-Pastor, Daniel Rypl. All rights reserved.

This content is excluded from our Creative Commons

license. For more information, seehttp://ocw.mit.edu/help/faq-fair-use/.

This image is in the public domain.Source: openclipart

Page 13: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

11

Scene

Image

Each pixel corresponds to

one ray. We need to figure

out which scene point each

one hits.

Pixels

Rendering – Pinhole Camera

© source unknown. All rights reserved. Thiscontent is excluded from our Creative Commons license. For more information,see http://ocw.mit.edu/help/faq-fair-use/.

© Oscar Meruvia-Pastor, Daniel Rypl. All rights reserved.This content is excluded from our Creative Commonslicense. For more information, see http://ocw.mit.edu/help/faq-fair-use/.

This image is in the public domain.Source: openclipart

Page 14: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

12

Scene

Image

Pixels

Rendering

What’s the

color you put

in each pixel?

© source unknown. All rights reserved. Thiscontent is excluded from our Creative Commons license. For more information,see http://ocw.mit.edu/help/faq-fair-use/.

© Oscar Meruvia-Pastor, Daniel Rypl. All rights reserved.This content is excluded from our Creative Commonslicense. For more information, see http://ocw.mit.edu/help/faq-fair-use/.

This image is in the public domain.Source: openclipart

Page 15: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

13

Scene

Image

Pixels

Rendering

Pixel Color

Determined by

Lighting/Shading

© source unknown. All rights reserved. Thiscontent is excluded from our Creative Commons license. For more information,see http://ocw.mit.edu/help/faq-fair-use/.

© Oscar Meruvia-Pastor, Daniel Rypl. All rights reserved.This content is excluded from our Creative Commonslicense. For more information, see http://ocw.mit.edu/help/faq-fair-use/.

This image is in the public domain.Source: openclipart

Page 16: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

• “Rendering” refers to the entire process that produces color values for pixels, given a 3D representation of the scene

• Pixels correspond to rays; need to figure out the visible scene point along each ray – Called “hidden surface problem” in older texts – “Visibility” is a more modern term – Also, we assume (for now) a single ray per pixel

14

Rendering

Page 17: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

• “Rendering” refers to the entire process that produces color values for pixels

• Pixels correspond to rays; need to figure out the visible scene point along each ray – Called “hidden surface problem” in older texts – “Visibility” is a more modern term – Also, we assume (for now) a single ray per pixel

• Major algorithms: Ray casting and rasterization

• Note: We are assuming a pinhole camera (for now) 15

Rendering

Page 18: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

16

Questions?

Page 19: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

• Ray Casting Basics

• Camera and Ray Generation

• Ray-Plane Intersection

• Ray-Sphere Intersection

17

Ray Casting

Page 20: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

For every pixel

Construct a ray from the eye

For every object in the scene

Find intersection with the ray

Keep if closest

18

Ray Casting

Page 21: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

For every pixel

Construct a ray from the eye

For every object in the scene

Find intersection with the ray

Keep if closest

Shade

19

Shading

Page 22: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

• Surface/Scene Properties – surface normal – direction to light – viewpoint

• Material Properties – Diffuse (matte) – Specular (shiny) – …

• Light properties – Position – Intensity, ...

• Much more! 20

Shading = What Surfaces Look Like

Diffuse sphere Specular spheres

N

L V

Page 23: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

• Let’s think about shadows...

21

Ray Casting vs. Ray Tracing

This image is in the public domain.Source: openclipart

Page 24: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

22

“camera rays” are rays from the

camera to the scene

?

Ray Casting vs. Ray Tracing

This image is in the public domain.Source: openclipart

Page 25: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

23

X

ray from light to hit point is blocked, i.e., point is in shadow

Ray Casting vs. Ray Tracing

This image is in the public domain.Source: openclipart

Page 26: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

• Ray casting = eye rays only, tracing = also secondary

24

X Secondary rays are used for

testing shadows, doing

reflections, refractions, etc.

We’ll do all this a little

later!

Ray Casting vs. Ray Tracing

This image is in the public domain.Source: openclipart

Page 27: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

Secondary Rays Indirect illumination

Shadows

Reflections Refractions

Caustics

Hen

rik W

ann

Jens

en

25 Courtesy of Henrik Wann Jensen. Used with permission.

Page 28: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

26

Ray Tracing

Reflections, refractions

Caustics

Reflections

© source unknown. All rights reserved. This content is excluded from our CreativeCommons license. For more information, see http://ocw.mit.edu/help/faq-fair-use/.

Courtesy of Henrik Wann Jensen. Used with permission.

© Turner Whitted, Bell Laboratories. All rights reserved. This content isexcluded from our Creative Commons license. For more information,see http://ocw.mit.edu/help/faq-fair-use/.

Page 29: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

27

Questions?

Page 30: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

For every pixel

Construct a ray from the eye

For every object in the scene

Find intersection with the ray

Keep if closest

Shade depending on light and normal vector

28

Ray Casting

N Finding the

intersection point

and normal is the

central part of ray

casting

Page 31: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

• Origin – Point • Direction – Vector

– normalized is better • Parametric line

– P(t) = origin + t * direction

29

Ray Representation

origin direction

P(t)

How would you

represent a ray?

Page 32: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

• Origin – Point • Direction – Vector

– normalized is better • Parametric line

– P(t) = origin + t * direction

30

Ray Representation

origin direction

P(t)

Another way to put

the ray casting

problem statement:

Find smallest t > 0

such that P(t) lies

on a surface in the

scene

Page 33: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

• Albrecht Dürer, 16th century

31

Dürer’s Ray Casting Machine

© source unknown. All rights reserved. This content is excluded from our CreativeCommons license. For more information, see http://ocw.mit.edu/help/faq-fair-use/.

Page 34: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

• Albrecht Dürer, 16th century

32

Dürer’s Ray Casting Machine

© source unknown. All rights reserved. This content is excluded from our CreativeCommons license. For more information, see http://ocw.mit.edu/help/faq-fair-use/.

Page 35: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

• Ray Casting Basics

• Camera and Ray Generation

• Ray-Plane Intersection

• Ray-Sphere Intersection

33

Ray Casting

Page 36: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

For every pixel

Construct a ray from the eye

For every object in the scene

Find intersection with ray

Keep if closest

34

Cameras

© source unknown. All rights reserved. This content is excluded from our CreativeCommons license. For more information, see http://ocw.mit.edu/help/faq-fair-use/.

Page 37: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

35

Pinhole Camera • Box with a tiny hole • Inverted image • Similar triangles

• Perfect image if hole infinitely small

• Pure geometric optics • No depth of field issue

(everything in focus)

Page 38: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

• From Gemma Frisius, 1545

36

Oldest Illustration

© source unknown. All rights reserved. This content is excluded from our CreativeCommons license. For more information, see http://ocw.mit.edu/help/faq-fair-use/.

Page 39: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

37

Also Called “Camera Obscura”

Image courtesy of Wellcome Library, London. License: CC-BY-NC. This content is excluded fromour Creative Commons license. For more information, see http://ocw.mit.edu/help/faq-fair-use/.

Page 40: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

38

Camera Obscura Today

Abelardo Morell www.abelardomorell.net

Images removed due to copyright restrictions -- please seehttp://www.abelardomorell.net/photography/cameraobsc_01/cameraobsc_17.htmlhttp://www.abelardomorell.net/posts/camera-obscura/http://www.abelardomorell.net/photography/cameraobsc_49/cameraobsc_63.html for further details.

Page 41: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

38

Camera Obscura Today

Abelardo Morell www.abelardomorell.net

Images removed due to copyright restrictions -- please seehttp://www.abelardomorell.net/photography/cameraobsc_01/cameraobsc_17.htmlhttp://www.abelardomorell.net/posts/camera-obscura/http://www.abelardomorell.net/photography/cameraobsc_49/cameraobsc_63.html for further details.

Page 42: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

• Eye-image pyramid (view frustum) • Note that the distance/size of image are arbitrary

39

Simplified Pinhole Camera

same image

will result on

this image plane

Page 43: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

40

Camera Description?

Page 44: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

• Eye point e (center)

• Orthobasis u, v, w (horizontal, up, direction)

41

Camera Description?

Object coordinates World coordinates View

coordinates

Image coordinates

u w

v

Page 45: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

42

Camera Description?

Object coordinates World coordinates View

coordinates

Image coordinates

u w

v

• Eye point e (center)

• Orthobasis u, v, w (horizontal, up, direction)

• Field of view angle

• Image rectangle aspect ratio

Page 46: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

43

Camera

Image plane

Image Coordinates

-1 ≤ x ≤ 1

-1 ≤ y ≤ 1

Convenient to define “normalized image coordinates” such that the x, y

coordinates run

from -1 to 1

regardless of the

dimensions and

aspect ratio of the

image rectangle.

This image is in the public domain.Source: openclipart

Page 47: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

44

field of view α right u

view direction w

image plane -1 < x < 1

x

eye point e

p

p is point on image plane at coordinate x, we want to know the direction of the ray r

r?

Ray Generation in 2D

This image is in the public domain. Source: openclipart

Page 48: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

45

field of view α

image plane -1 < x < 1

1

right u

view direction w

Ray Generation in 2D

What is the distance D to the screen so that the normalized coordinates go to 1?

This image is in the public domain. Source: openclipart

Page 49: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

46

field of view α

image plane -1 < x < 1

D

1

right u

view direction w

Ray Generation in 2D

This image is in the public domain. Source: openclipart

Page 50: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

47

field of view α right u

view direction w

image plane -1 < x < 1

x

D

r = p-e = (x*u, D*w)

eye point e

r

p

Ray Generation in 2D

This image is in the public domain. Source: openclipart

Page 51: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

48

Ray Generation in 2D

field of view α right u

view direction w

image plane -1 < x < 1

x

D

eye point e

r

p

then we just normalize r to get the ray

r = p-e = (x*u, D*w)

This image is in the public domain. Source: openclipart

Page 52: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

• y coordinate is treated just like x, except accounting for aspect ratio – r = (x*u, aspect*y*v, D*w) – Again, u, v, w are the basis vectors

of the view coordinate system – Aspect ratio handles non-square viewports

• Think of your 16:9 widescreen TV

• The point of the exercise with computing D was to allow us to use the [-1,1] image coordinate system regardless of field of view.

49

That was 2D, 3D is just as simple

Page 53: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

50

Perspective vs. Orthographic

• Parallel projection • No foreshortening • No vanishing point

perspective orthographic

Page 54: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

• Ray Generation? – Origin = e + x*size*u + y*size*v – Direction is constant: w

51

Orthographic Camera

Page 55: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

• E.g. fish eye, omnimax, parabolic

52

Other Weird Cameras

CAVE Columbia University

© source unknown. All rights reserved. This content is excludedfrom our Creative Commons license. For more information, seehttp://ocw.mit.edu/help/faq-fair-use/.

© CAVE Lab, Columbia University. All rights reserved. Thiscontent is excluded from our Creative Commons license. Formore information, see http://ocw.mit.edu/help/faq-fair-use/.

Page 56: TIEA311 Tietokonegraikan perusteetusers.jyu.fi/~nieminen/tgp17/tiea311_2017_lec12.pdfTIEA311 - Course Status in Jyv askyl¨ a¨ I Assignment 1 discussion now is a good time to wrap

53

Questions? Even Funkier

Multiperspective Imaging

Courtesy of Paul Rademacher. Used with permission.