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

Similar documents
Last week. Machiraju/Zhang/Möller

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

Coordinate Transformations & Homogeneous Coordinates

Ray scene intersections

Ray Tracer Due date: April 27, 2011

CS 464 Review. Review of Computer Graphics for Final Exam

6.837 Computer Graphics Hierarchical Modeling Wojciech Matusik, MIT EECS Some slides from BarbCutler & Jaakko Lehtinen

Advanced Computer Graphics Transformations. Matthias Teschner

Topics and things to know about them:

Computer Graphics Ray Casting. Matthias Teschner

L1 - Introduction. Contents. Introduction of CAD/CAM system Components of CAD/CAM systems Basic concepts of graphics programming

CHAPTER 1 Graphics Systems and Models 3

Last Time? Ray Casting. Administrivia: Lab & Office Hours. Notes on Assignments. Ray Casting. Overview of Today

Models and The Viewing Pipeline. Jian Huang CS456

Linear and Affine Transformations Coordinate Systems

Content. Coordinate systems Orthographic projection. (Engineering Drawings)

Introduction Ray tracing basics Advanced topics (shading) Advanced topics (geometry) Graphics 2010/2011, 4th quarter. Lecture 11: Ray tracing

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

CS451Real-time Rendering Pipeline

2D/3D Geometric Transformations and Scene Graphs

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

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

Motivation. Sampling and Reconstruction of Visual Appearance. Effects needed for Realism. Ray Tracing. Outline

Today. Rendering algorithms. Rendering algorithms. Images. Images. Rendering Algorithms. Course overview Organization Introduction to ray tracing

CV: 3D sensing and calibration

Transforms. COMP 575/770 Spring 2013

Lecture 8 Ray tracing Part 1: Basic concept Yong-Jin Liu.

Lighting. To do. Course Outline. This Lecture. Continue to work on ray programming assignment Start thinking about final project

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

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

Today. Today. Introduction. Matrices. Matrices. Computergrafik. Transformations & matrices Introduction Matrices

Rigid Body Motion and Image Formation. Jana Kosecka, CS 482

6.837 Introduction to Computer Graphics Final Exam Tuesday, December 20, :05-12pm Two hand-written sheet of notes (4 pages) allowed 1 SSD [ /17]

GEOMETRIC TOOLS FOR COMPUTER GRAPHICS

Assignment 2 Ray Tracing

Ray Tracing. CPSC 453 Fall 2018 Sonny Chan

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

Ray Tracing. Outline. Ray Tracing: History

Shading, Advanced Rendering. Week 7, Wed Feb 28

Surface and Solid Geometry. 3D Polygons

Solid Modeling. Ron Goldman Department of Computer Science Rice University

Today. Rendering algorithms. Rendering algorithms. Images. Images. Rendering Algorithms. Course overview Organization Introduction to ray tracing

Ray Tracing III. Wen-Chieh (Steve) Lin National Chiao-Tung University

Humanoid Robotics. Projective Geometry, Homogeneous Coordinates. (brief introduction) Maren Bennewitz

Lecture 11: Ray tracing (cont.)

CS 4620 Midterm, March 21, 2017

Pin Hole Cameras & Warp Functions

Consider a partially transparent object that is illuminated with two lights, one visible from each side of the object. Start with a ray from the eye

Homogeneous Coordinates. Lecture18: Camera Models. Representation of Line and Point in 2D. Cross Product. Overall scaling is NOT important.

Lecture 11. More Ray Casting/Tracing

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.

Graphics 2009/2010, period 1. Lecture 8: ray tracing

Assignment 6: Ray Tracing

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

Epipolar Geometry Prof. D. Stricker. With slides from A. Zisserman, S. Lazebnik, Seitz

CSG obj. oper3. obj1 obj2 obj3. obj5. obj4

Interactive Computer Graphics A TOP-DOWN APPROACH WITH SHADER-BASED OPENGL

6.837 Introduction to Computer Graphics Assignment 5: OpenGL and Solid Textures Due Wednesday October 22, 2003 at 11:59pm

Specifying Complex Scenes

Photorealism: Ray Tracing

Geometric Algebra. 8. Conformal Geometric Algebra. Dr Chris Doran ARM Research

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

Camera Placement for Ray Tracing

Agenda. Ray(tracing(algorithm( Code(structure( Ray(intersec;ons Sphere Triangle Hints Transforma;ons Debugging How(to(start

CMSC427 Final Practice v2 Fall 2017

GLOBAL EDITION. Interactive Computer Graphics. A Top-Down Approach with WebGL SEVENTH EDITION. Edward Angel Dave Shreiner

Lecture 5 Basic Rendering

Final Exam CS 184: Foundations of Computer Graphics! page 1 of 12!

Computer Graphics I Lecture 11

CS 4620 Midterm 1. Tuesday 22 October minutes

Modeling Objects. Modeling. Symbol-Instance Table. Instance Transformation. Each appearance of the object in the model is an instance

Programming projects. Assignment 1: Basic ray tracer. Assignment 1: Basic ray tracer. Assignment 1: Basic ray tracer. Assignment 1: Basic ray tracer

CPSC GLOBAL ILLUMINATION

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

Translations. Geometric Image Transformations. Two-Dimensional Geometric Transforms. Groups and Composition

Effects needed for Realism. Ray Tracing. Ray Tracing: History. Outline. Foundations of Computer Graphics (Spring 2012)

Introduction to Geometric Algebra Lecture VI

6.837 LECTURE 7. Lecture 7 Outline Fall '01. Lecture Fall '01

Ray Tracing COMP575/COMP770

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

Topic 12: Texture Mapping. Motivation Sources of texture Texture coordinates Bump mapping, mip-mapping & env mapping

Geometric Transformations

Vector Algebra Transformations. Lecture 4

Midterm Exam! CS 184: Foundations of Computer Graphics! page 1 of 13!

Spatial Data Structures

Computer Vision Projective Geometry and Calibration. Pinhole cameras

Topic 11: Texture Mapping 11/13/2017. Texture sources: Solid textures. Texture sources: Synthesized

3D Viewing. CS 4620 Lecture 8

Image Formation. Antonino Furnari. Image Processing Lab Dipartimento di Matematica e Informatica Università degli Studi di Catania

CHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY CS2401 COMPUTER GRAPHICS QUESTION BANK

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

Level of Details in Computer Rendering

Computer Graphics. Lecture 02 Graphics Pipeline. Edirlei Soares de Lima.

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

CS Simple Raytracer for students new to Rendering

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

Visual Recognition: Image Formation

Graphics Pipeline 2D Geometric Transformations

3-D D Euclidean Space - Vectors

Topic 11: Texture Mapping 10/21/2015. Photographs. Solid textures. Procedural

Transcription:

Transformations in Ray Tracing

Linear Algebra Review Session Tonight! 7:30 9 PM

Last Time: Simple Transformations Classes of Transformations Representation homogeneous coordinates Composition not commutative

Today Motivations Transformations in Modeling Adding Transformations to our Ray Tracer Constructive Solid Geometry (CSG) Assignment 2

Modeling Create / acquire objects Placing objects Placing lights Describe materials Choose camera position and camera parameters Specify animation...

Transformations in Modeling Position objects in a scene Change the shape of objects Create multiple copies of objects Projection for virtual cameras Animations

Today Motivations Transformations in Modeling Scene description Class Hierarchy Transformations in the Hierarchy Adding Transformations to our Ray Tracer Constructive Solid Geometry (CSG) Assignment 2

Scene Description Scene Camera Lights Background Materials (much more next week) Objects

Simple Scene Description File OrthographicCamera { center 0 0 10 direction 0 0-1 up 0 1 0 size 5 } Lights { numlights 1 DirectionalLight { direction -0.5-0.5-1 color 1 1 1 } } Background { color 0.2 0 0.6 } Materials { nummaterials <n> <MATERIALS> } Group { numobjects <n> <OBJECTS> }

Class Hierarchy Object3D Sphere Cone Cylinder Plane Triangle Group

Why is a Group an Object3D? Logical organization of scene

Simple Example with Groups Group { numobjects 3 Group { numobjects 3 Box { <BOX PARAMS> } Box { <BOX PARAMS> } Box { <BOX PARAMS> } } Group { numobjects 2 Group { Box { <BOX PARAMS> } Box { <BOX PARAMS> } Box { <BOX PARAMS> } } Group { Box { <BOX PARAMS> } Sphere { <SPHERE PARAMS> } Sphere { <SPHERE PARAMS> } } } Plane { <PLANE PARAMS> } }

Adding Materials Group { numobjects 3 Group { numobjects 3 Box { <BOX PARAMS> } Box { <BOX PARAMS> } Box { <BOX PARAMS> } } Group { numobjects 2 Group { Box { <BOX PARAMS> } Box { <BOX PARAMS> } Box { <BOX PARAMS> } } Group { Box { <BOX PARAMS> } Sphere { <SPHERE PARAMS> } Sphere { <SPHERE PARAMS> } } } Plane { <PLANE PARAMS> } }

Adding Materials Group { numobjects 3 Material { <BROWN> } Group { numobjects 3 Box { <BOX PARAMS> } Box { <BOX PARAMS> } Box { <BOX PARAMS> } } Group { numobjects 2 Material { <BLUE> } Group { Box { <BOX PARAMS> } Box { <BOX PARAMS> } Box { <BOX PARAMS> } } Group { Material { <GREEN> } Box { <BOX PARAMS> } Material { <RED> } Sphere { <SPHERE PARAMS> } Material { <ORANGE> } Sphere { <SPHERE PARAMS> } } } Material { <BLACK> } Plane { <PLANE PARAMS> } }

Adding Transformations

Class Hierarchy with Transformations Object3D Sphere Cone Cylinder Plane Triangle Group Transform

Why is a Transform an Object3D? To position the logical groupings of objects within the scene

Simple Example with Transforms Group { numobjects 3 Transform { ZRotate { 45 } Group { numobjects 3 Box { <BOX PARAMS> } Box { <BOX PARAMS> } Box { <BOX PARAMS> } } } Transform { Translate { -2 0 0 } Group { numobjects 2 Group { Box { <BOX PARAMS> } Box { <BOX PARAMS> } Box { <BOX PARAMS> } } Group { Box { <BOX PARAMS> } Sphere { <SPHERE PARAMS> } Sphere { <SPHERE PARAMS> } } } } Plane { <PLANE PARAMS> } }

Nested Transforms p' = T ( S p ) = TS p Translate Scale Sphere same as Translate Scale Sphere Transform { Translate { 1 0.5 0 } Transform { Scale { 2 2 2 } Sphere { center 0 0 0 radius 1 } } } Transform { Translate { 1 0.5 0 } Scale { 2 2 2 } Sphere { center 0 0 0 radius 1 } }

Questions?

Today Motivations Transformations in Modeling Adding Transformations to our Ray Tracer Transforming the Ray Handling the depth, t Transforming the Normal Constructive Solid Geometry (CSG) Assignment 2

Incorporating Transforms 1. Make each primitive handle any applied transformations Sphere { center 1 0.5 0 radius 2 } 2. Transform the Rays Transform { Translate { 1 0.5 0 } Scale { 2 2 2 } Sphere { center 0 0 0 radius 1 } }

Primitives handle Transforms Sphere { center 3 2 0 z_rotation 30 r_major 2 r_minor 1 } r minor (x,y) r major Complicated for many primitives

Transform the Ray Move the ray from World Space to Object Space r minor (x,y) r major r = 1 World Space (0,0) Object Space p WS = M p OS p OS = M -1 p WS

Transform Ray New origin: origin OS = M -1 origin WS New direction: direction OS = M -1 (origin WS + 1 * direction WS ) - M -1 origin WS direction OS = M -1 direction WS origin WS direction WS q WS = origin WS + t WS * direction WS origin OS direction OS q OS = origin OS + t OS * direction OS World Space Object Space

Transforming Points & Directions Transform point Transform direction Homogeneous Coordinates: (x,y,z,w) W = 0 is a point at infinity (direction)

What to do about the depth, t If M includes scaling, direction OS will NOT be normalized 1. Normalize the direction 2. Don't normalize the direction

1. Normalize direction t OS t WS and must be rescaled after intersection t WS World Space t OS Object Space

2. Don't normalize direction t OS = t WS Don't rely on t OS being true distance during intersection routines (e.g. geometric ray-sphere intersection, a 1 in algebraic solution) t WS World Space t OS Object Space

Questions?

New component of the Hit class Surface Normal: unit vector that is locally perpendicular to the surface

Why is the Normal important? It's used for shading makes things look 3D! object color only (Assignment 1) Diffuse Shading (Assignment 2)

Visualization of Surface Normal ±x= Red ±y= Green ±z= Blue

How do we transform normals? n WS n OS World Space Object Space

Transform the Normal like the Ray? translation? rotation? isotropic scale? scale? reflection? shear? perspective?

Transform the Normal like the Ray? translation? rotation? isotropic scale? scale? reflection? shear? perspective?

What class of transforms? Projective Affine Similitudes Rigid / Euclidean Linear Translation Identity Rotation Isotropic Scaling Scaling Reflection Shear Perspective a.k.a. Orthogonal Transforms

Transformation for shear and scale Incorrect Normal Transformation Correct Normal Transformation

More Normal Visualizations Incorrect Normal Transformation Correct Normal Transformation

So how do we do it right? Think about transforming the tangent plane to the normal, not the normal vector n OS n WS v OS Original Incorrect Correct v WS Pick any vector v OS in the tangent plane, how is it transformed by matrix M? v WS = M v OS

Transform tangent vector v v is perpendicular to normal n: n OST v OS = 0 n OST (M -1 M) v OS = 0 (n OST M -1 ) (M v OS ) = 0 (n OST M -1 ) v WS = 0 v WS is perpendicular to normal n WS : n WS n WST = n OS (M -1 ) n OS v OS v WS n WS =(M -1 ) T n OS n WST v WS = 0

Comment So the correct way to transform normals is: n WS =(M -1 ) T n OS But why did n WS = M n OS work for similitudes? Because for similitude / similarity transforms, (M -1 ) T =λ M e.g. for orthonormal basis: ux uy uz xu xv xn M = vx vy vz M -1 = yu yv yn nx ny nz zu zv zn

Questions?

Today Motivations Transformations in Modeling World Space vs Object Space Adding Transformations to our Ray Tracer Constructive Solid Geometry (CSG) Assignment 2

Constructive Solid Geometry (CSG) Given overlapping shapes A and B: Union Intersection Subtraction

How can we implement CSG? Points on A, Outside of B Points on B, Outside of A Points on B, Inside of A Points on A, Inside of B Union Intersection Subtraction

Collect all the intersections Union Intersection Subtraction

Implementing CSG 1. Test "inside" intersections: Find intersections with A, test if they are inside/outside B Find intersections with B, test if they are inside/outside A 2. Overlapping intervals: Find the intervals of "inside" along the ray for A and B Compute union/intersection/subtraction of the intervals

"Fredo's First CSG Raytraced Image"

Questions?

Today Motivations Transformations in Modeling World Space vs Object Space Adding Transformations to our Ray Tracer Constructive Solid Geometry (CSG) Assignment 2 Due Wednesday Sept 24 th, 11:59pm

Simple Shading Single Directional Light Source Diffuse Shading Ambient Light c pixel = c ambient *c object + dir light n * c light * c object n dir light c light = (1,1,1) c ambient = (0,0,0) c light = (0.5,0.5,0.5) c ambient = (0.5,0.5,0.5)

Adding Perspective Camera up direction horizontal angle

Triangle Meshes (.obj) vertices triangles v -1-1 -1 v 1-1 -1 v -1 1-1 v 1 1-1 v -1-1 1 v 1-1 1 v -1 1 1 v 1 1 1 f 1 3 4 f 1 4 2 f 5 6 8 f 5 8 7 f 1 2 6 f 1 6 5 f 3 7 8 f 3 8 4 f 1 5 7 f 1 7 3 f 2 4 8 f 2 8 6

Acquiring Geometry 3D Scanning (Images removed due to copyright considerations.)

Next Week: Ray Tracing Surface reflectance