Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Graphics Inf4/MSc 1 Computer Graphics Lecture 4 View Projection Taku Komura.

Similar presentations

Presentation on theme: "Computer Graphics Inf4/MSc 1 Computer Graphics Lecture 4 View Projection Taku Komura."— Presentation transcript:

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

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

3 Computer Graphics Inf4/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, 30GB raw data according to [Ngan et al. EGSR ’05] -> Fitting the acquired data into analytical models

4 Computer Graphics Inf4/MSc 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

5 Computer Graphics Inf4/MSc 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]

6 Computer Graphics Inf4/MSc Examples : Satin

7 Computer Graphics Inf4/MSc Examples : velvet

8 Computer Graphics Inf4/MSc 8 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)

9 Computer Graphics Inf4/MSc Transformations 02/09/2014 Local to world matrix World to camera matrix Projection matrix Local coordin ates Screen coordinates

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

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

12 Computer Graphics Inf4/MSc 12 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.

13 Computer Graphics Inf4/MSc 13 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

14 Computer Graphics Inf4/MSc 14 Parallel projection. Orthographic Projection onto a plane at z = 0. x p = x, y p = y, z = 0.

15 Computer Graphics Inf4/MSc 15 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

16 Computer Graphics Inf4/MSc Projection Matrix Here we will follow the projection transform method used in OpenGL The camera facing the –z direction

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

18 Computer Graphics Inf4/MSc 18 Perspective projection – simplest case. d x y z P(x,y,z)‏ P p (x p,y p,-d)‏ z P(x,y,z)‏ d z d y x xpxp ypyp

19 Computer Graphics Inf4/MSc 19 Perspective projection.

20 Computer Graphics Inf4/MSc 20 Perspective projection.

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

22 Computer Graphics Inf4/MSc 22 Alternative formulation. z P(x,y,z)‏ d x xpxp z d y ypyp Projection plane at z = 0 Centre of projection at z = d

23 Computer Graphics Inf4/MSc 23 Alternative formulation. z P(x,y,z)‏ d x xpxp z d y ypyp Projection plane at z = 0, Centre of projection at z = d Now we can allow d 

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

25 Computer Graphics Inf4/MSc 25 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 Far clipping plane. Near clipping plane left right Need to calculate intersection With 6 planes.

26 Computer Graphics Inf4/MSc 26 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

27 Computer Graphics Inf4/MSc 27 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

28 Computer Graphics Inf4/MSc 28 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:

29 Computer Graphics Inf4/MSc 29 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: -1  x  1, -1  y  1, -1  z  1 –Simply need to check the (x,y,z) coordinates and see if they are within the canonical view volume

30 Computer Graphics Inf4/MSc 30 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

Download ppt "Computer Graphics Inf4/MSc 1 Computer Graphics Lecture 4 View Projection Taku Komura."

Similar presentations

Ads by Google