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

Similar documents
CS 112 The Rendering Pipeline. Slide 1

Rasterization Overview

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

Models and Architectures

3D Polygon Rendering. Many applications use rendering of 3D polygons with direct illumination

CS 498 VR. Lecture 18-4/4/18. go.illinois.edu/vrlect18

Sung-Eui Yoon ( 윤성의 )

Pipeline Operations. CS 4620 Lecture 10

Game Architecture. 2/19/16: Rasterization

Project 1, 467. (Note: This is not a graphics class. It is ok if your rendering has some flaws, like those gaps in the teapot image above ;-)

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11

Triangle Rasterization

CS4620/5620: Lecture 14 Pipeline

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Pipeline Operations. CS 4620 Lecture 14

CS451Real-time Rendering Pipeline

Introduction to Computer Graphics with WebGL

Real Time Reflections Han-Wei Shen

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

CSE328 Fundamentals of Computer Graphics

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

Models and Architectures. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

Models and The Viewing Pipeline. Jian Huang CS456

Computer Graphics. Bing-Yu Chen National Taiwan University The University of Tokyo

TSBK03 Screen-Space Ambient Occlusion

Chapter 5. Projections and Rendering

Hidden surface removal. Computer Graphics

Perspective Mappings. Contents

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

Viewing COMPSCI 464. Image Credits: Encarta and

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

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

Lecture 4. Viewing, Projection and Viewport Transformations

S U N G - E U I YO O N, K A I S T R E N D E R I N G F R E E LY A VA I L A B L E O N T H E I N T E R N E T

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

Viewing with Computers (OpenGL)

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

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

THE VIEWING TRANSFORMATION

CS 130 Final. Fall 2015

Computer Graphics Shadow Algorithms

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

COMP3421. Introduction to 3D Graphics

Announcements. Submitting Programs Upload source and executable(s) (Windows or Mac) to digital dropbox on Blackboard

EECE 478. Learning Objectives. Learning Objectives. Rasterization & Scenes. Rasterization. Compositing

1.2.3 The Graphics Hardware Pipeline

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into

Surface Graphics. 200 polys 1,000 polys 15,000 polys. an empty foot. - a mesh of spline patches:

3D Graphics for Game Programming (J. Han) Chapter II Vertex Processing

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

Computer Graphics. Bing-Yu Chen National Taiwan University

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

Motivation. Culling Don t draw what you can t see! What can t we see? Low-level Culling

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

OpenGL Transformations

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Visibility and Occlusion Culling

Perspective transformations

CSC 305 The Graphics Pipeline-1

Prof. Feng Liu. Fall /19/2016

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

15. Clipping. Projection Transformation. Projection Matrix. Perspective Division

The 3D Graphics Rendering Pipeline

Introduction to Visualization and Computer Graphics

Overview. Pipeline implementation I. Overview. Required Tasks. Preliminaries Clipping. Hidden Surface removal

Computer Science 426 Midterm 3/11/04, 1:30PM-2:50PM

Realtime 3D Computer Graphics Virtual Reality

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

Culling. Computer Graphics CSE 167 Lecture 12

Three Main Themes of Computer Graphics

For each question, indicate whether the statement is true or false by circling T or F, respectively.

Clipping. CSC 7443: Scientific Information Visualization

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

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

Introduction to Computer Vision

The Graphics Pipeline and OpenGL I: Transformations!

For this assignment, you are to expand your renderer from assignment 2 with perspective, a polygon clipper, ambient lighting, and obj file reading.

CSE 690: GPGPU. Lecture 2: Understanding the Fabric - Intro to Graphics. Klaus Mueller Stony Brook University Computer Science Department

Practical Shadow Mapping

Level of Details in Computer Rendering

INTRODUCTION TO COMPUTER GRAPHICS. cs123. It looks like a matrix Sort of. Viewing III. Projection in Practice 1 / 52

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

The Traditional Graphics Pipeline

Homework #2 and #3 Due Friday, October 12 th and Friday, October 19 th

Page 1. Area-Subdivision Algorithms z-buffer Algorithm List Priority Algorithms BSP (Binary Space Partitioning Tree) Scan-line Algorithms

Chapter 2 A top-down approach - How to make shaded images?

COMP3421. Introduction to 3D Graphics

Computer Graphics I Lecture 11

CSE 167: Introduction to Computer Graphics Lecture #10: View Frustum Culling

CHAPTER 1 Graphics Systems and Models 3

Advanced Lighting Techniques Due: Monday November 2 at 10pm

Today. Rendering pipeline. Rendering pipeline. Object vs. Image order. Rendering engine Rendering engine (jtrt) Computergrafik. Rendering pipeline

CS 354R: Computer Game Technology

The Traditional Graphics Pipeline

Computer Graphics 7: Viewing in 3-D

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

The Application Stage. The Game Loop, Resource Management and Renderer Design

Homework #2. Hidden Surfaces, Projections, Shading and Texture, Ray Tracing, and Parametric Curves

CSE452 Computer Graphics

Transcription:

Graphic Pipeline 1

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 model 3D world? How to render them? 2

Data Representation How do we define objects Primitives (triangle, polygon, surfaces) Polygonal model Each primitive is a planar polygon Object is made of a mesh of polygons 3

Triangular Model Triangular model Any surface passing through three vertices will be planar Minimal planar primitives No restrictions to be imposed during model building Piecewise Linear Representation Easy to implement in hardware Easy to interpolate attributes Convex Linear Interpolation Unique coefficients 4

Most Common Format List of vertices and attributes 3D coordinates, color, texture coordinates. Geometric information Positions, normals, curvature List of triangles Indices of triangles Topological information How are the triangles connected? 5

Object Representation: Example 6

Rendering Pipeline Input Soup of 2D triangles in 3D space Output 2D image from a particular view Why pipeline? Contains different stages Each triangle is sent through it in a pipeline fashion 7

Steps of Graphic Pipeline 1. Geometric Transformation of Vertices 2. Clipping and Vertex Interpolation of Attributes 3. Rasterization and Pixel Interpolation of Attributes 8

Geometric Transformation 1. Model Transformation 2. View Transformation 3. Perspective Projection 4. Window Coordinate Transformation 9

Model Transformation World and Object Coordinates Y W Y O X O X W Z O Y O Z W Y O X O Z O X O Z O 10

Model Transformation Transforming from the object to world coordinates Placing the object in the desired position, scale and orientation Can be done by any kind of transformations Graphics hardware/library support only linear transformations like translate, rotate, scale, and shear 11

Advantages Allows separation of concerns When designing objects do not worry about scene Create a library of objects Allows multiple instantiation by just changing the location, orientation and size of the same object 12

View Transformation Input Position and orientation of eye (9 parameters) View point (COP) Normal to the image plane N View Up U To align Eye with the origin Normal to the image plane with negative Z axis View Up vector with positive Y axis Can be achieved by rotation and translation 13

Default View Setup E = (0,0,0) V = (0,1,0) N = (0,0,1) 14

Perspective Projection Transformation Define the view frustum (6 parameters) Assume origin is the view point Near and far planes (planes parallel to XY plane perpendicular to the negative Z axis) [2] Left, right, top, bottom rectangle defined on the near plane [4] 15

Default View Setup 16

Projection Transformation Y X Z 17

Projection Transformation Transforming the view frustum (along with the objects inside it) into a cuboid with unit square faces on the near and far planes the negative Z axis passes through the center of these two faces. Projecting the objects on the near plane Consists of a shear, scale and perspective projection 18

Perspective Projection n n x p /x = y p /y = z p /z x p = x y p = y z z n n 19

Gaze Direction Y (0,0,z p ) Z (x v,y v,z p ) 20

Coincide this with N Shear Matrix Can be defined by the window extents l, r, t, b Sh(x v /n, y v /n) = Sh((r+l)/2n, (t+b)/2n) = 1 0 x v /n 0 0 1 y v /n 0 0 0 1 0 0 0 0 1 1 0 r+l/2n 0 0 1 t+b/2n 0 0 0 1 0 0 0 0 1

Now normalize X and Y Map X and Y between -1 to +1 Scale by 2/(r-l) and 2/(t-b) Looks like K n is focal length r+l is change of center r-l is inversely proportional to number of pixels

Where is the lost dimension? Why 4x4? Z should map to n always, since depth of the image is same But we need to resolve occlusion 23

How do we use the z? Perspective projection is applied on the vertices of a triangle Can depth be resolved in the triangle level? T1 is not infront of T2 and vice versa Part of T1 is in front of T2 and vice versa T1 T2 View Direction 24

How do we use the z? Occlusion has to be resolved in the pixel level How do we find z for a point inside the triangle Not its vertex We do not want to apply 3D to 2D xform Too expensive Interpolate in 2D (screen space interpolation) T1 T2 View Direction 25

Screen Space Interpolation Linear interpolation of z in screen space Does not work Why? Perspective projection is inversely proportional to z Over-estimates Wrong occlusion resolution 26

Correct Solution Interpolate 1/Z Reciprocal of Z Interpolate in screen space Take reciprocal again 1 Z t = 1 Z 0 (1-u) + 1 Z 1 u 27

Transforming z to 1/z x y z 1 x p y p -z 1 Instead of this x y z 1 x p y p -1/z 1 we would like to store 1/z for interpolation purposes

Bounding Z Depth of field effect Define a far plane - f Leads to culling of distant objects Efficiency issues

Normalizing 1/z Map 1/n and 1/f to -1 and +1 Three steps only on z coordinates Translate the center between -1/n and -1/f to origin T(tz) where tz = (1/n+1/f)/2) Scale it to match -1 to +1 S(sz) where sz = 2/(1/n-1/f)) Whole z transform (1/z + tz)sz = 1/z(2nf/f-n) + (f+n)/(f-n)

Projection Transformation Y X Z

Final Matrix Defined only in terms of the planes of the view frustum