Scanline Rendering 1 1/42

Similar documents
Temporal Resolution. Flicker fusion threshold The frequency at which an intermittent light stimulus appears to be completely steady to the observer

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

Overview. By end of the week:

Shadows in the graphics pipeline

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

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

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

The exam begins at 2:40pm and ends at 4:00pm. You must turn your exam in when time is announced or risk not having it accepted.

Computer Vision Project-1

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

Lecture 4. Viewing, Projection and Viewport Transformations

CS451Real-time Rendering Pipeline

3D Rendering and Ray Casting

Introduction to 3D Concepts

3D Rendering and Ray Casting

Ray Tracer I: Ray Casting Due date: 12:00pm December 3, 2001

Raycasting. Chapter Raycasting foundations. When you look at an object, like the ball in the picture to the left, what do

lecture 18 - ray tracing - environment mapping - refraction

Ray Tracing Basics I. Computer Graphics as Virtual Photography. camera (captures light) real scene. photo. Photographic print. Photography: processing

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

Drawing Fast The Graphics Pipeline

Ray Tracer Due date: April 27, 2011

COMP 175 COMPUTER GRAPHICS. Ray Casting. COMP 175: Computer Graphics April 26, Erik Anderson 09 Ray Casting

Modeling Light. On Simulating the Visual Experience

Scanline Rendering 2 1/42

Scene Modeling for a Single View

Triangle Rasterization

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

COMP environment mapping Mar. 12, r = 2n(n v) v

CS201 Computer Vision Lect 4 - Image Formation

Three-Dimensional Viewing Hearn & Baker Chapter 7

COSC579: Scene Geometry. Jeremy Bolton, PhD Assistant Teaching Professor

Computer Graphics. Illumination and Shading

Institutionen för systemteknik

Real-Time Shadows. Last Time? Textures can Alias. Schedule. Questions? Quiz 1: Tuesday October 26 th, in class (1 week from today!

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S

3D GRAPHICS. design. animate. render

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

Scene Modeling for a Single View

Computer Graphics and Visualization. Graphics Systems and Models

Models and Architectures

Scene Modeling for a Single View

Introduction: The Nature of Light

LIGHTING AND SHADING

Advanced Computer Graphics Transformations. Matthias Teschner

C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE. Mikhail Bessmeltsev

CHAPTER 1 Graphics Systems and Models 3

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

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

MITOCW MIT6_172_F10_lec18_300k-mp4

Computer Graphics. Chapter 1 (Related to Introduction to Computer Graphics Using Java 2D and 3D)

Three Main Themes of Computer Graphics

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

Soft shadows. Steve Marschner Cornell University CS 569 Spring 2008, 21 February

Computer Graphics - Chapter 1 Graphics Systems and Models

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

Real-Time Shadows. Last Time? Schedule. Questions? Today. Why are Shadows Important?

RASTERISED RENDERING

CS354 Computer Graphics Ray Tracing. Qixing Huang Januray 24th 2017

Prof. Feng Liu. Fall /19/2016

Viewing COMPSCI 464. Image Credits: Encarta and

3D Mathematics. Co-ordinate systems, 3D primitives and affine transformations

3D Rendering. Course Syllabus. Where Are We Now? Rendering. 3D Rendering Example. Overview. Rendering. I. Image processing II. Rendering III.

Computer Graphics 7: Viewing in 3-D

Reading on the Accumulation Buffer: Motion Blur, Anti-Aliasing, and Depth of Field

Movie: For The Birds. Announcements. Ray Tracing 1. Programming 2 Recap. Programming 3 Info Test data for part 1 (Lines) is available

Midterm Exam CS 184: Foundations of Computer Graphics page 1 of 11

Perspective Mappings. Contents

- Rasterization. Geometry. Scan Conversion. Rasterization

6.837 Introduction to Computer Graphics Quiz 2 Thursday November 20, :40-4pm One hand-written sheet of notes allowed

Computer Graphics Shadow Algorithms

Single-view 3D Reconstruction

Visibility: Z Buffering

The Traditional Graphics Pipeline

Introduction to Computer Graphics with WebGL

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

2/26/2016. Chapter 23 Ray Optics. Chapter 23 Preview. Chapter 23 Preview

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Viewing. Announcements. A Note About Transformations. Orthographic and Perspective Projection Implementation Vanishing Points

INFOGR Computer Graphics. J. Bikker - April-July Lecture 11: Visibility. Welcome!

Light and all its colours

Ulf Assarsson Department of Computer Engineering Chalmers University of Technology

Topics and things to know about them:

Today. Parity. General Polygons? Non-Zero Winding Rule. Winding Numbers. CS559 Lecture 11 Polygons, Transformations

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

0. Introduction: What is Computer Graphics? 1. Basics of scan conversion (line drawing) 2. Representing 2D curves

Assignment 2 Ray Tracing

Illumination and Shading

Rendering. Generate an image from geometric primitives II. Rendering III. Modeling IV. Animation. (Michael Bostock, CS426, Fall99)

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

Real-Time Shadows. MIT EECS 6.837, Durand and Cutler

Real-Time Shadows. Last Time? Today. Why are Shadows Important? Shadows as a Depth Cue. For Intuition about Scene Lighting

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

Computer Vision Projective Geometry and Calibration. Pinhole cameras

VTU QUESTION PAPER SOLUTION UNIT -1 INTRODUCTION

Computer Graphics Lecture 11

Orthogonal Projection Matrices. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

CPSC GLOBAL ILLUMINATION

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

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

Transcription:

Scanline Rendering 1 1/42

Scanline Renderer Think of it as setting up a virtual environment/world that mimics the real world but cheats a bit for efficiency, using what we know about light and our eye e.g., from the last lecture Set up a virtual camera somewhere in the virtual world and point it in some direction Put a virtual piece of film (that stores RGB values) into the camera, and take a picture This film data is your final image Place some objects in front of the camera, including a floor/ground, some walls, ceiling/sky, etc. How do we represent these virtual objects? Virtual geometry? Geometric Modeling This is actually a two step process: (1) Make the objects (2) Place the objects in the scene Making objects is itself a two step process: build the geometry & then paint it Don t forget to put some lights into the scene, so it s not completely dark Finally, snap the picture --- that is, code needs to emit light from the virtual light sources, bounce it off the geometry, and follow it into the camera onto the film 2/42

Homework This week s homework and sample code (along with the lectures today and Thursday) is designed to help you learn your way around in a scanline renderer We re using OpenGL (there are other options ) It provides real time feedback so you can experiment with stuff and learn by doing By way of comparison, the ray tracer will be A LOT SLOWER Next week, we ll focus on Geometric Modeling (in the lectures, sample code, and homework) to help you create and obtain geometry that you can put into your virtual scenes Make sure to keep the basic concepts from last Thursday s lecture in mind as we progress we ll assume familiarity with that stuff, as we make various assumptions 3/42

Cameras 4/42

Human Eye Rendering a computer generated image is similar in spirit to how you see real world images Light is emitted from light sources, absorbed and reflected off of objects, and enters the pupil of the eye 5/42

Pupil Without a pupil, light would scatter everywhere and would not make a coherent image on the cones of the eye With a pupil, light makes a coherent image on the cones Cameras, similarly, have an aperture 6/42

Cameras Cameras work very much like the eye Light from the environment is bent by the lens array to make an image on the film Digital cameras record this image as RGB values Our scanline renderer will use a virtual camera 7/42

Pinhole Camera Simplified theoretical construct, but similar to an actual eye or camera Eyes and cameras can t have VERY small holes, because that limits the amount of entering light and diffracts/bends the light 8/42

Pinhole Camera Light leaving any point travels in straight lines We only care about the lines that hit the pinhole (a single point) Infinite depth of field i.e., everything is in focus (no blur) An upside down image is formed by the intersection of these lines with an image plane More distant objects subtend smaller visual angles and appear smaller Objects occlude the objects behind them 9/42

OpenGL Camera OpenGL uses a pinhole camera. However, the image plane (i.e. the film) is placed in front of the pinhole, so that the image is not upside down The frustum is the volume of the view (shown in blue below) Notice the front and back clipping planes! The image plane (i.e. the film) is the clipping plane closest to the camera 10/42

Helpful Hints Get very familiar with the OpenGL camera Do not put the camera too close to your objects (fisheye look) Set it up like a real world scene Significant/severe deductions for poor camera placement, fisheye, etc. (because your image will look terrible) Make sure your near and far clipping plane have enough space between them to contain your scene Do not set the near clipping plane at the camera aperture! Make sure your objects are inside the viewing frustum Etc. Etc. This is a real time system, use the interactivity to your benefit 11/42

Question 1 Where would you like to take your CG picture? Outside? Day or Night? Park? Mountains? City or Country? What Season? Lake? Ocean? Underwater? Space? Skydiving? Inside? Theatre? Classroom? Dorm Room? Living Room? Bathroom? Basement? Attic? Etc.? 12/42

Geometric Models 13/42

Triangles Stanford Bunny 69,451 triangles David, Digital Michelangelo Project 28,184,526 vertices, 56,230,343 triangles 14/42

Why Triangles? It s easy to break convex polygons into triangles As a result, can focus on optimizing the hardware/software implementation of only one primitive (i.e. optimize for triangles) Triangles have some nice properties Guaranteed to be planar (unlike quadrilaterals) Guaranteed to have a well-defined interior There exists a well-defined method for interpolating values in the triangle interior (barycentric interpolation) Etc 15/42

Geometric Modeling Next week 16/42

Arranging your scene 17/42

Transformations Transform every point: (x,y,z ) = T(x,y,z) P = T(P) Moves triangles (& thus geometry) http://youtube/6g3o60o5u7w Create objects (or parts of objects) in convenient coordinates, and then transform into the scene later Make multiple copies (even different sizes) of a single object Connect kinematics of linkages/skeletons for characters/robots 18/42

Matrix Representation Efficiency: can combine a sequence of transforms into a single transform (since matrix multiplication is associative): P = A ( B ( C ( D ( P ) ) ) ) = ( A B C D ) P = M P Compute the composite matrix M once and then apply it to many points 19/42

Hierarchical Transforms M 1 transforms the teapot from its model space to the table s model space M 2 transforms the table from its model space to world space M 2 M 1 transforms the teapot from its model space to world space 20/42

Lines Map to Lines Parametric line: Transform all the points on the line Get a new line connecting the transformed points 21/42

Question 2 What sorts of objects will be in your scene? Ground? Sky? Planets? Moon? Sun? Trees? Leaves? Mountains? Snow? Buildings? Sidewalk? Roads? Cars? Humans? Animals? Barns? Walls? Floors? Rugs? Ceiling? Fans? Chairs? Desks? People? Pets? Your favorite CA? A dart board? Etc.? 22/42

Rotations 23/42

Rotation glm::angleaxis(angle, vec3(ax, ay, ax)) 24/42

2D Rotation Matrix The columns of the matrix are the new locations of the x and y axes So, set the columns to the desired new locations of the x and y axes Rotation matrix = 3D is similar 25/42

Translations 26/42

Translation What does a translation matrix look like? use homogeneous coordinates glm::translate(current, vec3(tx, ty, tz)) 27/42

Homogeneous Coordinates The homogeneous coordinates of a 3D point (x, y, z) are (xw, yw, zw, w) Conversely, the position (x, y, z) of a 3D point can be calculated from homogeneous coordinates by dividing by w (xw/w, yw/w, zw/w) Setting w=1, gives the homogeneous coordinates used for translations: a 3D point (x, y, z) becomes (x, y, z, 1) 28/42

2D Rotation Matrix A 2D point becomes (x, y, 1), so we need a 3x3 matrix in order to represent a 2D rotation This is done by adding an extra row and column of (0, 0, 1) Similarly, 3D rotation matrices are expressed via a 4x4 matrix 29/42

2D Translation Matrix 3D is similar 30/42

Vectors In homogeneous coordinates, vectors are represented using w=0 instead of w=1 Thus translation does not affect vectors, as desired The vectors still rotate properly though 31/42

Composite Transformations 32/42

Rotate 45 degrees about the point (1,1)... R(45) T(-1,-1) T(1,1) T(1,1) R(45) T(-1,-1) 33/42

Be Careful, Order Matters T(1,1) R(45) R(45) T(1,1) Matrix multiplication is NOT commutative The rightmost transform is applied to the points first 34/42

Hint Place an object at the center of the target coordinate system (scene or an intermediate) Rotate the object into the desired orientation Translate the object in order to place it in the target coordinate system (scene or an intermediate) 35/42

Question 3 Looking for Artists: 3A. Name/Email 3B. Best Advice 36/42