Computer Graphics Inf4/MSc. Computer Graphics. Lecture 6 View Projection Taku Komura

Similar documents
Hidden surface removal. Computer Graphics

Computer Graphics Chapter 7 Three-Dimensional Viewing Viewing

Computer Graphics 7 - Rasterisation

Motivation. What we ve seen so far. Demo (Projection Tutorial) Outline. Projections. Foundations of Computer Graphics

To Do. Demo (Projection Tutorial) Motivation. What we ve seen so far. Outline. Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 5: Viewing

Rasterization Overview

COMP Computer Graphics and Image Processing. a6: Projections. In part 2 of our study of Viewing, we ll look at. COMP27112 Toby Howard

To Do. Motivation. Demo (Projection Tutorial) What we ve seen so far. Computer Graphics. Summary: The Whole Viewing Pipeline

Graphics Pipeline : Geometric Operations

Viewing Transformations I Comp 535

Projection: Mapping 3-D to 2-D. Orthographic Projection. The Canonical Camera Configuration. Perspective Projection

Announcements. Introduction to Cameras. The Key to Axis Angle Rotation. Axis-Angle Form (review) Axis Angle (4 steps) Mechanics of Axis Angle

The Graphics Pipeline. Interactive Computer Graphics. The Graphics Pipeline. The Graphics Pipeline. The Graphics Pipeline: Clipping

CS451Real-time Rendering Pipeline

Projections. Brian Curless CSE 457 Spring Reading. Shrinking the pinhole. The pinhole camera. Required:

Overview. By end of the week:

RASTERISED RENDERING

Graphics and Interaction Rendering pipeline & object modelling

Game Architecture. 2/19/16: Rasterization

3D Viewing. CS 4620 Lecture 8

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane

Chapter 5. Projections and Rendering

Chap 7, 2009 Spring Yeong Gil Shin

Raster Graphics Algorithms

Data Representation in Visualisation

Realtime 3D Computer Graphics Virtual Reality

Last Time. Correct Transparent Shadow. Does Ray Tracing Simulate Physics? Does Ray Tracing Simulate Physics? Refraction and the Lifeguard Problem

Viewing with Computers (OpenGL)

Rendering If we have a precise computer representation of the 3D world, how realistic are the 2D images we can generate? What are the best way to mode

Evening s Goals. Mathematical Transformations. Discuss the mathematical transformations that are utilized for computer graphics

Lecture 4. Viewing, Projection and Viewport Transformations

CS4620/5620: Lecture 14 Pipeline

Graphics 2009/2010, period 1. Lecture 6: perspective projection

Models and The Viewing Pipeline. Jian Huang CS456

3D Viewing. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 9

Animação e Visualização Tridimensional. Collision Detection Corpo docente de AVT / CG&M / DEI / IST / UTL

Topics and things to know about them:

CS452/552; EE465/505. Clipping & Scan Conversion

Notes on Assignment. Notes on Assignment. Notes on Assignment. Notes on Assignment

Viewing. Reading: Angel Ch.5

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

CS 4731/543: Computer Graphics Lecture 5 (Part I): Projection. Emmanuel Agu

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

CS 4204 Computer Graphics

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Scan Conversion- Polygons

Chapter 4. Chapter 4. Computer Graphics 2006/2007 Chapter 4. Introduction to 3D 1

Additional Divide and Conquer Algorithms. Skipping from chapter 4: Quicksort Binary Search Binary Tree Traversal Matrix Multiplication

CS602 Midterm Subjective Solved with Reference By WELL WISHER (Aqua Leo)

Transformation Pipeline

New Geometric Interpretation and Analytic Solution for Quadrilateral Reconstruction

Two basic types: image-precision and object-precision. Image-precision For each pixel, determine which object is visable Requires np operations

Lecture 3 Sections 2.2, 4.4. Mon, Aug 31, 2009

What is Perspective?

CSE328 Fundamentals of Computer Graphics

CS559 Computer Graphics Fall 2015

CS230 : Computer Graphics Lecture 6: Viewing Transformations. Tamar Shinar Computer Science & Engineering UC Riverside

COMP3421. Vector geometry, Clipping

CS184 : Foundations of Computer Graphics Professor David Forsyth Final Examination

Announcements. Tutorial this week Life of the polygon A1 theory questions

Fondamenti di Grafica 3D The Rasterization Pipeline.

COMP30019 Graphics and Interaction Perspective Geometry

Shadow Algorithms. CSE 781 Winter Han-Wei Shen

Virtual Cameras and The Transformation Pipeline

Einführung in Visual Computing

Computer Graphics 10 - Shadows

CS 106 Winter 2016 Craig S. Kaplan. Module 01 Processing Recap. Topics

Introduction to Computer Graphics 4. Viewing in 3D

CSE 167: Introduction to Computer Graphics Lecture #4: Vertex Transformation

CS184 : Foundations of Computer Graphics Professor David Forsyth Final Examination (Total: 100 marks)

COMP30019 Graphics and Interaction Rendering pipeline & object modelling

Lecture outline. COMP30019 Graphics and Interaction Rendering pipeline & object modelling. Introduction to modelling

COMP3421. Introduction to 3D Graphics

CSE 167: Lecture #4: Vertex Transformation. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

Reading for This Module. Viewing. Using Transformations. Viewing. University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2013

1 OpenGL - column vectors (column-major ordering)

Computer Graphics 7: Viewing in 3-D

Drawing in 3D (viewing, projection, and the rest of the pipeline)

Viewing and Projection

INTRODUCTION TO COMPUTER GRAPHICS. It looks like a matrix Sort of. Viewing III. Projection in Practice. Bin Sheng 10/11/ / 52

CS 543: Computer Graphics. Projection

Triangle Rasterization

CSC 305 The Graphics Pipeline-1

Chap 3 Viewing Pipeline Reading: Angel s Interactive Computer Graphics, Sixth ed. Sections 4.1~4.7

Drawing in 3D (viewing, projection, and the rest of the pipeline)

Viewing in 3D (Chapt. 6 in FVD, Chapt. 12 in Hearn & Baker)

Clipping & Culling. Lecture 11 Spring Trivial Rejection Outcode Clipping Plane-at-a-time Clipping Backface Culling

COMP3421. Introduction to 3D Graphics

CSE 167: Introduction to Computer Graphics Lecture #5: Projection. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017

Exercises of PIV. incomplete draft, version 0.0. October 2009

COMP30019 Graphics and Interaction Perspective & Polygonal Geometry

Midterm Exam Fundamentals of Computer Graphics (COMP 557) Thurs. Feb. 19, 2015 Professor Michael Langer

p =(x,y,d) y (0,0) d z Projection plane, z=d

3D Viewing. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

Lecture 4: Viewing. Topics:

VISIBILITY & CULLING. Don t draw what you can t see. Thomas Larsson, Afshin Ameri DVA338, Spring 2018, MDH

Parallelization. Memory coherency helps when distributing rays to various threads/processors

CS464 Oct 3 rd Assignment 3 Due 10/6/2017 Due 10/8/2017 Implementation Outline

9. Visible-Surface Detection Methods

Computer Graphics with OpenGL ES (J. Han) Chapter VII Rasterizer

Transcription:

Computer Graphics Lecture 6 View Projection Taku Komura 1

Overview 1. View transformation 2. Rasterisation

Implementation of viewing. Transform into camera coorinates. Perform projection into view volume or screen coorinates. Clip geometr outsie the view volume. Remove hien surfaces (next week) 3

Transformations vmproj Mc w Mw l vl

View Transformation (from lecture 2) Computer Graphics Inf4/MSc We want to know the positions in the camera coorinate sstem vw Mw c vc Point in the camera coorinate Point in the worl coorinate Camera-to-worl transformation -1 v Mw c vw Mc w vw Lecture 4 2/1/9

View Projection We want to create a picture of the scene viewe from the camera Two sorts of projection Parallel projection Perspective projection 6

Mathematics of Viewing We nee to generate the transformation matrices for perspective an parallel projections. The shoul be 4x4 matrices to allow general concatenation. An there s still 3D clipping an more viewing stuff to look at. 7

Parallel projections (Orthographic projection) Specifie b a irection of projection, rather than a point. Objects of same sie appear at the same sie after the projection 8

Parallel projection. 1 1 M orth Orthographic Projection onto a plane at. x p x, p,. 9 1 1 1 1 1 1 x x

Perspective Projection Specifie b a center of projection an the focal istance (istance from the ee to the projection plane) Objects far awa appear smaller, closer objects appear bigger 1

Projection Matrix Here we will follow the projection transform metho use in OpenGL The camera facing the irection

Perspective projection simplest case. Centre of projection at the origin, Projection plane at -. : focal istance Projection Plane. P(x,,) x P p (x p, p,-) 12

Perspective projection simplest case. P(x,,) x x p x x p p ; triangles : From similar x P(x,,) P p (x p, p,-) P(x,,) p x x x p p / ; /

Perspective projection. [ ] [ ] T x 1. x 1 x T p p. T The transformation can be represente as a M per 1 1 1-1/ 4x4 matrix : 14

Perspective projection. [ ] T p x P M P W Z Y X P 1 1 projecte point Represent the general 15 [ ] [ ] T T per p x W Z Y X P M P / 1-1/ 1 1

Perspective projection. P [ x ] p / Dropping W to come back to 3D: T Trouble with this formulation : Centre of projection fixe at the origin. X W, Y W, Z W x /, /, 16

Alternative formulation. P(x,,) x x p P(x,,) p 17 Projection plane at Centre of projection at 1 ) / ( ; 1 ) / ( Multipl b ; triangles : From similar + + + + + + x x x x x p p p p

Alternative formulation. x x p P(x,,) p P(x,,) Projection plane at, Centre of projection at Now we can allow M per 1 1-1/ 1 18

Problem After projection, the epth information is lost We nee to preserve the epth information for hien surface remove uring rasteriation 19

3D View Volume Computer Graphics Inf4/MSc 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 outsie the view volume must be clippe

Canonical View Volume We can transform the frustum view volume into a normalie canonical view volume using the iea of perspective transformation Much easier to clip surfaces an calculate hien surfaces

Transforming the View Frustum Let us efine parameters (l,r,b,t,n,f) that etermines the shape of the frustum The view frustum starts at -n an ens at -f, with <n<f The rectangle at -n has the minimum corner at (l,b,-n) an the maximum corner at (r,t,-n) 22

Transforming View Frustum into a Canonical view-volume The perspective canonical view-volume can be transforme to the parallel canonical view-volume with the following matrix: < < 23 matrix: + + + < < 1 2 2 2 ) ](, [ n f fn n f n f b t b t b t n l r l r l r n P then f n f n If p

Final step. Divie b W to get the 3-D coorinates Don t flatten ue to hien surface calculations. 3D Clipping The Canonical view volume is efine b: -1 x 1, -1 1, -1 1 Simpl nee to check the (x,,) coorinates an see if the are within the canonical view volume 24 24

Example + + + < < 1 2 2 2 ) ](, [ n f fn n f f b n t b t b t n l r l r l r n P then f n f n If p 1 How oes ABC look like after the projection?

Overview 1. View transformation 2. Rasterisation

Rasteriation Now, all the vertices are in the screen coorinates Nee to ecie how to colour the pixels accoring to the geoemetr of the polgons, triangles We have one this for lines alrea Let s o it for polgons 27

How shoul we o it? Easier to just hanle triangles like OpenGL Polgons without intersections Divie into triangles first 28

Polgon ecomposition into triangles. Now that we have an insie test, we can convert polgons to triangles. Triangles simple, convex an planar. P P7 P6 Simple for convex polgons. P5 P4 Concave more ifficult. P1 P2 P3

Polgon ecomposition Test all vertices to check the are outsie of ABC. Test one ege at a time to reject vertices earl B D C Vertex D fails test. A

Polgon ecomposition If all vertices outsie store triangle, remove vertex an procee with next leftmost vertex. If a vertex is insie, form new triangle with leftmost insie vertex an point A, procee as before. B D Test ABD in same manner as before, C A

Filling in Triangles Scan line algorithm Filling in the triangle b rawing horiontal lines from top to bottom Barcentric coorinates Checking whether a pixel is insie / outsie the triangle

Triangle Rasteriation Consier a 2D triangle with vertices p, p1, p2. Let p be an point in the plane. We can alwas fin a, b, c such that p p1 (α,β,γ) αp+βp1 +γp2 p2

barcentric coorinates We will have if an onl if p is insie the triangle. We call the barcentric coorinates of p. p p1 (α,β,γ) αp+βp1 +γp2 p2

Computing the baricentric coorinates of the interior pixels The triangle is compose of 3 points p (x,), p1 (x1, 1), p2(x2,2) (α,β,γ) : barcentric coorinates Onl if <α,β,γ<1, (x,) is insie the triangle Depth can be compute b αz + βz1 +γz2 Can o the same thing for color, normals, textures 35

Bouning box of the triangle First, ientif a rectangular region on the canvas that contains all of the pixels in the triangle (excluing those that lie outsie the canvas). Calculate a tight bouning box for a triangle: simpl calculate pixel coorinates for each vertex, an fin the minimum/maximum for each axis 36

Scanning insie the triangle Once we've ientifie the bouning box, we loop over each pixel in the box. Next we convert these into barcentric coorinates for the triangle being rawn. Onl if the barcentric coorinates are within the range of [,1], we plot it 37

Interpolation b Barcentric Coorinates The great thing of barcentric coorinates is that we can use it to interpolate attributes (colour, epth, normal vectors, texture coorinates) at the triangle vertices c1 c2 (α,β,γ) αc1+βc2 +γc3 c3

Exercise

Reaing for View Transformation Fole et al. Chapter 6 all of it, Particularl section 6.5 Introuctor text, Chapter 6 all of it, Particularl section 6.6 Akenine-Moller, Real-time Renering Chapter 3.5 Baricentric coorinates www.cs.caltech.eu/courses/cs171/barcentric.pf 4