310 likes | 552 Views
Lecture 4 View Projection Taku Komura. Computer Graphics. Measuring the BRDF. Measured using a device called gonioreflectometer Casting light from various directions to the object, and capturing the light reflected back. Problems with Measured BRDF. Includes a lot of error
E N D
Lecture 4 View Projection Taku Komura Computer Graphics
Measuring the BRDF • Measured using a device called gonioreflectometer • Casting light from various directions to the object, and capturing the light reflected back
Problems with Measured BRDF • Includes a lot of error • Huge amount of time to capture • The data size is enormous • 18 hours acquisition time, 30GB raw data according to [Ngan et al. EGSR ’05] -> Fitting the acquired data into analytical models
Analytical models • Empirical 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
Microfacet Theory • [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]
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)
Transformations Screen coordinates Local coordinates Projection matrix World to camera matrix Local to world matrix 29/08/2014
Lecture 4 View Transformation (from lecture 2) • We want to know the positions in the camera coordinate system vw = Mc→wvc vc = Mc → w vw = Mw→cvw Point in the camera coordinate Camera-to-world transformation Point in the world coordinate -1
View Projection • We want to create a picture of the scene viewed from the camera • Two sorts of projection • Parallel projection • Perspective projection
Mathematics of Viewing • We need to generate the transformation matrices for perspective and parallel projections. • They should be 4x4 matrices to allow general concatenation. • And there’s still 3D clipping and more viewing stuff to look at.
Parallel projections (Orthographic projection) • Specified by a direction of projection, rather than a point. • Objects of same size appear at the same size after the projection
Parallel projection. Orthographic Projection onto a plane at z = 0. xp = x , yp = y , z = 0.
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
Projection Matrix • Here we will follow the projection transform method used in OpenGL • The camera facing the –z direction
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
Perspective projection – simplest case. x P(x,y,z) xp z d y d P(x,y,z) z Pp(xp,yp,-d) z yp P(x,y,z) d y x
Perspective projection. Trouble with this formulation : Centre of projection fixed at the origin.
Alternative formulation. d x z P(x,y,z) xp yp P(x,y,z) z y d Projection plane at z = 0 Centre of projection at z = d
Alternative formulation. d x z P(x,y,z) xp yp P(x,y,z) z y d Projection plane at z = 0, Centre of projection at z = d Now we can allow d
Problem • After projection, the depth information is lost • We need to preserve the depth information for hidden surface remove during rasterization
3D 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.
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
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)
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:
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. • 3D Clipping • The Canonical view volume is defined by: -1x1, -1 y1 , -1 z1 • Simply need to check the (x,y,z) coordinates and see if they are within the canonical view volume
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