Camera Placement for Ray Tracing

Similar documents
Ray Polygon Intersection.

CS251 Spring 2014 Lecture 7

Overview: Ray Tracing & The Perspective Projection Pipeline

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

Last week. Machiraju/Zhang/Möller

COMP30019 Graphics and Interaction Perspective Geometry

Introduction to Homogeneous coordinates

Lecture 19: All Together with Refraction

Movie: Geri s Game. Announcements. Ray Casting 2. Programming 2 Recap. Programming 3 Info Test data for part 1 (Lines) is available

Computing Visibility. Backface Culling for General Visibility. One More Trick with Planes. BSP Trees Ray Casting Depth Buffering Quiz

3D Viewing Episode 2

Prof. Feng Liu. Fall /19/2016

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

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

CS 325 Computer Graphics

Geometric optics. The University of Texas at Austin CS384G Computer Graphics Don Fussell

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

COMP30019 Graphics and Interaction Perspective & Polygonal Geometry

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

Rational Numbers and the Coordinate Plane

3D Viewing. CS 4620 Lecture 8

Reflection and Refraction

Transformations in Ray Tracing. MIT EECS 6.837, Durand and Cutler

Reflection and Refraction

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

BASIC ELEMENTS. Geometry is the study of the relationships among objects in an n-dimensional space

3D Viewing Episode 2

CS 4204 Computer Graphics

Computer Graphics. Lecture 04 3D Projection and Visualization. Edirlei Soares de Lima.

Viewing COMPSCI 464. Image Credits: Encarta and

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

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

COMP3421. Introduction to 3D Graphics

Math background. 2D Geometric Transformations. Implicit representations. Explicit representations. Read: CS 4620 Lecture 6

Computer Graphics. P05 Viewing in 3D. Part 1. Aleksandra Pizurica Ghent University

Turn on the Lights: Reflectance

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

CS 4620 Midterm 1. Tuesday 22 October minutes

Math-2. Lesson 3-1. Equations of Lines

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

COMP30019 Graphics and Interaction Three-dimensional transformation geometry and perspective

N-Views (1) Homographies and Projection

Lecture 17: Recursive Ray Tracing. Where is the way where light dwelleth? Job 38:19

ECE-161C Cameras. Nuno Vasconcelos ECE Department, UCSD

Shadows in the graphics pipeline

EECS : Introduction to Computer Graphics Building the Virtual Camera ver. 1.4

Kinematics of Machines Prof. A. K. Mallik Department of Mechanical Engineering Indian Institute of Technology, Kanpur. Module - 2 Lecture - 1

Rational Numbers: Graphing: The Coordinate Plane

Models and The Viewing Pipeline. Jian Huang CS456

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

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

CS 381 Computer Graphics, Fall 2012 Midterm Exam Solutions. The Midterm Exam was given in class on Tuesday, October 16, 2012.

CS4670: Computer Vision

EECS : Introduction to Computer Graphics Building the Virtual Camera ver. 1.5

CSE328 Fundamentals of Computer Graphics

Chapter 8 Three-Dimensional Viewing Operations

COMP3421. Introduction to 3D Graphics

Camera Calibration. COS 429 Princeton University

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

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

CS6670: Computer Vision

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

CS 184, Fall 1996 Midterm #1 Professor: unknown

Fundamentals of Stereo Vision Michael Bleyer LVA Stereo Vision

Topics and things to know about them:

Ray Tracer Due date: April 27, 2011

CIS 580, Machine Perception, Spring 2016 Homework 2 Due: :59AM

Computing the 3D Viewing Transformation

Principles of Computer Game Design and Implementation. Lecture 6

Camera Model and Calibration

Ray Casting. Outline. Similar to glulookat derivation. Foundations of Computer Graphics

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

So far, we have considered only local models of illumination; they only account for incident light coming directly from the light sources.

Mosaics. Today s Readings

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Linear and Affine Transformations Coordinate Systems

Scene Modeling for a Single View

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

CS 184, Fall 1996 Midterm #1 Professor: unknown

Geometric Transformations

Three-Dimensional Viewing Hearn & Baker Chapter 7

Viewing with Computers (OpenGL)

3D Sensing and Reconstruction Readings: Ch 12: , Ch 13: ,

Module 6: Pinhole camera model Lecture 32: Coordinate system conversion, Changing the image/world coordinate system

CS201 Computer Vision Camera Geometry

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

THE VIEWING TRANSFORMATION

This blog addresses the question: how do we determine the intersection of two circles in the Cartesian plane?

CS 432 Interactive Computer Graphics

Ray tracing. Computer Graphics COMP 770 (236) Spring Instructor: Brandon Lloyd 3/19/07 1

THE CAMERA TRANSFORM

Scene Modeling for a Single View

Computer Vision Project-1

Shadow Algorithms. CSE 781 Winter Han-Wei Shen

Reading. 18. Projections and Z-buffers. Required: Watt, Section , 6.3, 6.6 (esp. intro and subsections 1, 4, and 8 10), Further reading:

Motion. 1 Introduction. 2 Optical Flow. Sohaib A Khan. 2.1 Brightness Constancy Equation

CS6670: Computer Vision

Ray Tracing Part 1. CSC418/2504 Introduction to Computer Graphics. TA: Muhammed Anwar & Kevin Gibson

Ray tracing Tutorial. Lukas Herzberger

COMP 558 lecture 19 Nov. 17, 2010

Transcription:

Camera Placement for Ray Tracing Lecture #3 Tuesday 0/4/4 st Review Camera Placement! The following slides review last Thursday s Lecture on world to camera transforms.! To see shift to raytracing context, it is key to have all the basics of camera parameterization at one s fingertips.! In particular! Placement! Orientation 0/4/4 Ross Beveridge & Bruce Draper, CS 40 CSU 203 2

Watch for VPR vs. PRP issues!! This talk originally was designed with the VRP being the center of the image plane! In this run through, it will be modified to assume the VRP and PRP are the same.! But be aware when figures may not fully indicate the distinction. 0/4/4 Ross Beveridge & Bruce Draper, CS 40 CSU 203 3 Camera Coordinate System Formally, the view reference coordinate system! VRP is the center of the image plane (shown)! PRP is the focal point (not shown)! Image u is red! Image v is green! VUP is yellow! Camera z is blue VRP 0/4/4 Ross Beveridge & Bruce Draper, CS 40 CSU 203 Slide 4

View Reference Point! Where is the camera to be placed?! At the view reference point in world coords. 0/4/4 Ross Beveridge & Bruce Draper, CS 40 CSU 203 Slide 5 How is this done?! Placing the camera is a simple translation. vrp x 0 0 vrp x VRP = vrp y T = 0 0 vrp y vrp z 0 0 vrp z 0 0 0! What about orientation? 0/4/4 Ross Beveridge & Bruce Draper, CS 40 CSU 203 Slide 6

Need to Orient the Camera! Where is the camera pointing.! Define which way is up. Color coded axes: red for x, green for y, blue for z. 0/4/4 Ross Beveridge & Bruce Draper, CS 40 CSU 203 Slide 7 Point the Z-Axis away.! Somewhat counter intuitive at first.! Standard convention is camera looks down the negative z-axis. 0/4/4 Ross Beveridge & Bruce Draper, CS 40 CSU 203 Slide 8

Recap, Where Are We?! Translate the camera, negative vrp.! Specify a pointing direction.! Defined by a vector. L x n x L x L = L y L z n = n y n z = L x 2 + L y 2 + L z 2 L y L z! This is a beginning for a rotation matrix.! L called the View Plane Normal (VPN). 0/4/4 Ross Beveridge & Bruce Draper, CS 40 CSU 203 Slide 9 Transformation So Far CAMERA X AND Y AXIS We need to define unit length basis vectors for these other directions. x c y c z c =??? 0??? 0 n x n y n z 0 0 0 0 0 0 vrp x 0 0 vrp y 0 0 vrp z 0 0 0 x m y m z m CAMERA Z AXIS Recognize that this projects translated model points onto a basis vector defining the camera z axis! 0/4/4 Ross Beveridge & Bruce Draper, CS 40 CSU 203 Slide 0

How Do You Hold a Camera Consider life in a world with Gravity. Gravity means there is an up. Good photographers keep their cameras level. Which of these looks right to you.!!!! up 0/4/4 Ross Beveridge & Bruce Draper, CS 40 CSU 203 Slide VPN & UP Define Horizontal! The horizontal, u, axis is perpendicular to! a plane defined by the VPN and VUP. n= VPN VPN u= VUP n VUP n v = n u 0/4/4 Ross Beveridge & Bruce Draper, CS 40 CSU 203 Slide 2

Put it All Together! Translate then Rotate. x c y c z c = u x u y u z 0 v x v y v z 0 n x n y n z 0 0 0 0 0 0 vrp x 0 0 vrp y 0 0 vrp z 0 0 0 x m y m z m 0/4/4 Ross Beveridge & Bruce Draper, CS 40 CSU 203 Slide 3 Alternate - LookAt Point 0/4/4 Ross Beveridge & Bruce Draper, CS 40 CSU 203 Slide 4

VRP, LookAt & VUP Form! The View Plane Normal is! VPN = VRP - LookAt! Often easier to work out in your head.! Look at the Bear!! Thus, locate a camera by specifying:! VRP (View Referene Point)! LookAt (Point in the world to lookat)! VUP (Vector indicating whats up) 0/4/4 Ross Beveridge & Bruce Draper, CS 40 CSU 203 Slide 5 Internal camera parameters! VRP, VPN & VUP are external! Often called external camera parameters.! Position/orientation camera relative to scene.! Internal parameters are camera properties.! Focal length! Field-of-view! Combination determine geometry.! Points in scene to points on image plane. 0/4/4 Ross Beveridge & Bruce Draper, CS 40 CSU 203 Slide 6

2 nd Now for Ray Tracing! Camera Specification is the Same.! How it is used changes fundamentally.! The goal is not to shift world points to 3D camera coordinates.! The goal is to enumerate rays associated with camera pixels in world coordinates. 0/4/4 Ross Beveridge & Bruce Draper, CS 40 CSU 203 7 Part : Position & the PRP! Specify the PRP, i.e. focal point, in world coordinates. PRP = x PRP y PRP z PRP! Begin thinking about where individual pixels lie in the world, start at the PRP P α, β = PRP +? Warning: We are not using the VRP. For ray tracing, it is more convenient to specify the position of the PRP in the world. 0/4/4 Bruce Draper & J. Ross Beveridge 202 8

Part 2: Center on Image Plane! Recall we typically specify focal length in terms of the distance from the PRP to the near clipping plane.! So, move an amount d (the near distance) in the direction opposite to the VPN. ( ) +? P α,β = PRP + d VPN! This is the center of the image plane P 0,0 = PRP dvpn 0/4/4 Bruce Draper & J. Ross Beveridge 202 9 Part 3: Moving on Image Plane! Here alpha and beta are being used to accentuate their role in specifying image plane location in the range - to. They are not yet integer pixel indices.! If only we knew what 3D world direction to move in order to move along the horizontal axis of the image plane! Wait we do know that. (next slide) 0/4/4 Bruce Draper & J. Ross Beveridge 202 20

Recall Earlier Rotation Matrix x c y c z c = u x u y u z 0 v x v y v z 0 n x n y n z 0 0 0 0 0 0 vrp x 0 0 vrp y 0 0 vrp z 0 0 0 x m y m z m These are exactly the vectors we need to move in the world in the horizontal and vertical image plane directions. U = u x u y V = u z v x v y v z 0/4/4 Ross Beveridge & Bruce Draper, CS 40 CSU 203 2 Part 3: Move to Pixel Location! Once we get to the image center (in 3D)! Now, move an amount alpha in the horizontal camera direction,! and an amount beta in the vertical camera direction. P α,β = PRP dvpn +αu + βv Realize we ve just worked out the exact position of a pixel in the 3D world for a camera whose position and orientation are specified using the PRP, VPN and VUP formulation. 0/4/4 Bruce Draper & J. Ross Beveridge 202 22

Part 4: A Ray for a Pixel! May seem a bit like a step backwards,! Ray direction is defined by the vector going from the PRP to the Pixel (we must change symbols here because U is already used.) W α,β = P α,β PRP = PRP dvpn +αu + βv PRP = dvpn +αu + βv 0/4/4 Bruce Draper & J. Ross Beveridge 202 23 A Point & a Direction = Ray! As before, loop through pixels (i,j) and create rays at equivalent locations (α,β) on the - to bounded image plane.! Ray is pair: R = ( PRP, Wˆ ) α,β! As before, call trace using this ray and returned the depth and color for the first object intersected by that ray. 0/4/4 Ross Beveridge & Bruce Draper, CS 40 CSU 203 24

Now the Pseudo Code! Cast rays from PRP for (int i = 0; i <=255; i++) {! for (int j = 0; j <=255; j++) {! alpha = (2.0 / 255.0)*i.0;! beta = (2.0 / 255.0)*j.0;! w_x = (-d*vpn_x) + alpha * u_x + beta * v_x;! w_y = (-d*vpn_y) + alpha * u_y + beta * v_y;! w_z = (-d*vpn_z) + alpha * u_z + beta * v_z;! // Note ray_cast must normalize vector w! ray_trace(prp_x, prp_y, prp_z, w_x, w_y, w_z);! }! }! 0/4/4 Ross Beveridge & Bruce Draper, CS 40 CSU 203 25 Now Different Pseudo Code! Variant - Cast rays from Pixel for (int i = 0; i <=255; i++) {! for (int j = 0; j <=255; j++) {! alpha = (2.0 / 255.0)*i.0;! beta = (2.0 / 255.0)*j.0;! w_x = (-d*vpn_x) + alpha * u_x + beta * v_x;! w_y = (-d*vpn_y) + alpha * u_y + beta * v_y;! w_z = (-d*vpn_z) + alpha * u_z + beta * v_z;! p_x = prp_x + w_x;! p_y = prp_y + w_y;! p_z = prp_z + w_z;! // Note ray_cast must normalize vector w! ray_trace(p_x, p_y, p_z, w_x, w_y, w_z);! }! }! 0/4/4 Ross Beveridge & Bruce Draper, CS 40 CSU 203 26

Loose Ends!! When are intermediate terms calculated?! Fill in based upon explanation of U and V.! Why no vector data structures?! Use of matrix packages is encouraged.! What gets returned by ray_trace! Return illumination/color-value.! Ray Tracing is Recursive, so! Control recursion depth. 0/4/4 Ross Beveridge & Bruce Draper, CS 40 CSU 203 27