Computer Graphics Inf 4MSc Computer Graphics Lecture 4

  • Slides: 30
Download presentation
Computer Graphics Inf 4/MSc Computer Graphics Lecture 4 View Projection Taku Komura 1

Computer Graphics Inf 4/MSc Computer Graphics Lecture 4 View Projection Taku Komura 1

Computer Graphics Measuring the BRDF Inf 4/MSc • Measured using a device called gonioreflectometer

Computer Graphics Measuring the BRDF Inf 4/MSc • Measured using a device called gonioreflectometer – Casting light from various directions to the object, and capturing the light reflected back

Computer Graphics Inf 4/MSc Problems with Measured BRDF • Includes a lot of error

Computer Graphics Inf 4/MSc Problems with Measured BRDF • Includes a lot of error • Huge amount of time to capture • The data size is enormous – 18 hours acquisition time, 30 GB raw data according to [Ngan et al. EGSR ’ 05] -> Fitting the acquired data into analytical models

Computer Graphics • Empirical models – • Analytical models Gouraud, Phong models or more

Computer Graphics • Empirical models – • Analytical models Gouraud, Phong models or more complex models Microfacet models – Assuming the surface is composed of a large number of micro mirrors – Each reflect light back to the specular direction Inf 4/MSc

Computer Graphics Microfacet Theory Inf 4/MSc • [Torrance & Sparrow 1967] – Surface modeled

Computer Graphics Microfacet Theory Inf 4/MSc • [Torrance & Sparrow 1967] – Surface modeled by tiny mirrors – Value of BRDF at • # of mirrors oriented halfway between and where is the incoming direction, is the out going direction Also considering the statistics of the shadowing/masking • Modulated by Fresnel, shadowing/masking [Shirley 97]

Computer Graphics Examples : Satin Inf 4/MSc

Computer Graphics Examples : Satin Inf 4/MSc

Computer Graphics Examples : velvet Inf 4/MSc

Computer Graphics Examples : velvet Inf 4/MSc

Computer Graphics Inf 4/MSc Implementation of viewing. • Transform into camera coordinates. • Perform

Computer Graphics Inf 4/MSc Implementation of viewing. • Transform into camera coordinates. • Perform projection into view volume or screen coordinates. • Clip geometry outside the view volume. • Remove hidden surfaces (next week) 8

Computer Graphics Inf 4/MSc Transformations Screen coordinates Projection matrix World to camera matrix Local

Computer Graphics Inf 4/MSc Transformations Screen coordinates Projection matrix World to camera matrix Local to world matrix Local coordin ates 10/27/2020

View Transformation (from lecture 2) Inf 4/MSc Computer Graphics We want to know the

View Transformation (from lecture 2) Inf 4/MSc Computer Graphics We want to know the positions in the camera coordinate system vw = Mc→w vc Point in the camera coordinate Camera-to-world Point in the world coordinate transformation vc = M -1 c→w vw = Mw→c vw Lecture 4 02/10/09 10

Computer Graphics View Projection Inf 4/MSc We want to create a picture of the

Computer Graphics View Projection Inf 4/MSc We want to create a picture of the scene viewed from the camera Two sorts of projection Parallel projection Perspective projection 11

Computer Graphics Inf 4/MSc Mathematics of Viewing • We need to generate the transformation

Computer Graphics Inf 4/MSc Mathematics of Viewing • We need to generate the transformation matrices for perspective and parallel projections. • They should be 4 x 4 matrices to allow general concatenation. • And there’s still 3 D clipping and more viewing stuff to look at. 12

Computer Graphics Parallel projections (Orthographic projection) Inf 4/MSc • Specified by a direction of

Computer Graphics Parallel projections (Orthographic projection) Inf 4/MSc • Specified by a direction of projection, rather than a point. • Objects of same size appear at the same size after the projection 13

Computer Graphics Inf 4/MSc Parallel projection. Orthographic Projection onto a plane at z =

Computer Graphics Inf 4/MSc Parallel projection. Orthographic Projection onto a plane at z = 0. xp = x , yp = y , z = 0. 14

Computer Graphics Inf 4/MSc Perspective Projection • Specified by a center of projection and

Computer Graphics Inf 4/MSc Perspective Projection • Specified by a center of projection and the focal distance (distance from the eye to the projection plane) Objects far away appear smaller, closer objects appear bigger 15

Computer Graphics Inf 4/MSc Projection Matrix • Here we will follow the projection transform

Computer Graphics Inf 4/MSc Projection Matrix • Here we will follow the projection transform method used in Open. GL • The camera facing the –z direction

Computer Graphics Inf 4/MSc Perspective projection – simplest case. Centre of projection at the

Computer Graphics Inf 4/MSc Perspective projection – simplest case. Centre of projection at the origin, Projection plane at z=-d. d: focal distance Projection Plane. y P(x, y, z) x Pp(xp, yp, -d) z d 17

Computer Graphics Inf 4/MSc Perspective projection – simplest case. x xp P(x, y, z)

Computer Graphics Inf 4/MSc Perspective projection – simplest case. x xp P(x, y, z) z d P(x, y, z) Pp(xp, yp, -d) z yp d x d z y P(x, y, z) y 18

Computer Graphics Inf 4/MSc Perspective projection. 19

Computer Graphics Inf 4/MSc Perspective projection. 19

Computer Graphics Inf 4/MSc Perspective projection. 20

Computer Graphics Inf 4/MSc Perspective projection. 20

Computer Graphics Inf 4/MSc Perspective projection. Trouble with this formulation : Centre of projection

Computer Graphics Inf 4/MSc Perspective projection. Trouble with this formulation : Centre of projection fixed at the origin. 21

Computer Graphics Inf 4/MSc Alternative formulation. d x z d P(x, y, z) z

Computer Graphics Inf 4/MSc Alternative formulation. d x z d P(x, y, z) z xp yp P(x, y, z) y Projection plane at z = 0 Centre of projection at z=d 22

Computer Graphics Inf 4/MSc Alternative formulation. d x z d P(x, y, z) z

Computer Graphics Inf 4/MSc Alternative formulation. d x z d P(x, y, z) z xp yp P(x, y, z) y Projection plane at z = 0, Centre of projection at z =d Now we can allow d 23

Computer Graphics Inf 4/MSc Problem • After projection, the depth information is lost •

Computer Graphics Inf 4/MSc Problem • After projection, the depth information is lost • We need to preserve the depth information for hidden surface remove during rasterization 24

Computer Graphics Inf 4/MSc 3 D View Volume • The volume in which the

Computer Graphics Inf 4/MSc 3 D View Volume • The volume in which the visible objects exist • For orthographic projection, view volume is a box. • For perspective projection, view volume is a frustum. • The surfaces outside the view volume must be clipped left Far clipping plane. Near clipping plane right Need to calculate intersection With 6 planes. 25

Computer Graphics Inf 4/MSc Canonical View Volume • We can transform the frustum view

Computer Graphics Inf 4/MSc Canonical View Volume • We can transform the frustum view volume into a normalized canonical view volume using the idea of perspective transformation • Much easier to clip surfaces and apply hidden surface removal 26

Computer Graphics Inf 4/MSc Transforming the View Frustum • Let us define parameters (l,

Computer Graphics Inf 4/MSc Transforming the View Frustum • Let us define parameters (l, r, b, t, n, f) that determines the shape of the frustum • The view frustum starts at z=-n and ends at z=-f, with 0<n<f • The rectangle at z=-n has the minimum corner at (l, b, -n) and the maximum corner at (r, t, -n) 27

Computer Graphics Inf 4/MSc Transforming View Frustum into a Canonical view-volume • The perspective

Computer Graphics Inf 4/MSc Transforming View Frustum into a Canonical view-volume • The perspective canonical view-volume can be transformed to the parallel canonical view-volume with the following matrix: 28

Computer Graphics Inf 4/MSc Final step. • Divide by W to get the 3

Computer Graphics Inf 4/MSc Final step. • Divide by W to get the 3 -D coordinates – Where the perspective projection actually gets done • Now we have a ‘canonical view volume’. – Don’t flatten z due to hidden surface calculations. • 3 D Clipping – The Canonical view volume is defined by: -1 x 1, -1 y 1 , -1 z 1 – Simply need to check the (x, y, z) coordinates and see if 29 they are within the canonical view volume

Computer Graphics Inf 4/MSc Reading for View Transformation • Foley et al. Chapter 6

Computer Graphics Inf 4/MSc Reading for View Transformation • Foley et al. Chapter 6 – all of it, – Particularly section 6. 5 • Introductory text, Chapter 6 – all of it, – Particularly section 6. 6 • Akenine-Moller, Real-time Rendering Chapter 3. 5 30