CS Computer Graphics: Introduction to Ray Tracing

Similar documents
CS Computer Graphics: Introduction to Ray Tracing

CS Computer Graphics: Ray Tracing Detail, Part 3

Introduction to Ray-tracing Objectives

Photorealism: Ray Tracing

CS Computer Graphics: Ray Tracing Detail, Part 3

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

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

CS Computer Graphics: Hidden Surface Removal

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

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

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

CS 563 Advanced Topics in Computer Graphics Lecture 2: Bare-Bones Raytracer. by Emmanuel Agu

Illumination & Shading I

CS 325 Computer Graphics

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

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

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

Computer Graphics and Image Processing Ray Tracing I

CS Computer Graphics: Illumination and Shading I

CS Computer Graphics: Illumination and Shading I

Intro to Ray-Tracing & Ray-Surface Acceleration

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

Computer Graphics (CS 543) Lecture 10: Soft Shadows (Maps and Volumes), Normal and Bump Mapping

Supplement to Lecture 16

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

Ray Tracing. Foley & Van Dam, Chapters 15 and 16

Computer Graphics Tick 1

Ray Tracing Foley & Van Dam, Chapters 15 and 16

Computer Graphics (CS 4731) Lecture 16: Lighting, Shading and Materials (Part 1)

CS 543: Computer Graphics Lecture 10 (Part II): Raytracing (Part II) Emmanuel Agu

Lighting and Shading

CPSC GLOBAL ILLUMINATION

Computer Graphics (CS 543) Lecture 7b: Intro to lighting, Shading and Materials + Phong Lighting Model

CS 130 Exam I. Fall 2015

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

Ray Tracing. Kjetil Babington

Assignment 6: Ray Tracing

Ray tracing idea. Ray Tracing. Ray tracing algorithm. Plane projection in drawing. CS 465 Lecture 3

CS559 Computer Graphics Fall 2015

Recall: Indexing into Cube Map

Institutionen för systemteknik

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

CS 428: Fall Introduction to. Raytracing. Andrew Nealen, Rutgers, /18/2009 1

Pipeline Operations. CS 4620 Lecture 10

CS 543: Computer Graphics. Projection

Review for Ray-tracing Algorithm and Hardware

The University of Calgary

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

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

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]

Rendering: Reality. Eye acts as pinhole camera. Photons from light hit objects

Ray Tracing I. Internet Raytracing Competition

Recollection. Models Pixels. Model transformation Viewport transformation Clipping Rasterization Texturing + Lights & shadows

Lecture 11. More Ray Casting/Tracing

WHY WE NEED SHADING. Suppose we build a model of a sphere using many polygons and color it with glcolor. We get something like.

Ray Tracing. CPSC 453 Fall 2018 Sonny Chan

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

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

CS 4204 Computer Graphics

Global Illumination. COMP 575/770 Spring 2013

Computer Graphics (CS 543) Lecture 13b Ray Tracing (Part 1) Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

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

Computer Graphics 1. Chapter 7 (June 17th, 2010, 2-4pm): Shading and rendering. LMU München Medieninformatik Andreas Butz Computergraphik 1 SS2010

Ray Tracing. Shandong University

CMSC427 Final Practice v2 Fall 2017

Principles of Computer Graphics. Lecture 3 1

Viewing and Ray Tracing. CS 4620 Lecture 4

Photorealism. Photorealism: Ray Tracing. Ray Tracing

Computer Graphics. Si Lu. Fall uter_graphics.htm 11/22/2017

Pipeline Operations. CS 4620 Lecture 14

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

Ray-Tracing. Misha Kazhdan

Viewing and Ray Tracing

Ray Tracing. CS334 Fall Daniel G. Aliaga Department of Computer Science Purdue University

COMPLETION OF Z-buffer Graphics Pipeline

CS 130 Exam I. Fall 2015

1999, Denis Zorin. Ray tracing

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

03 RENDERING PART TWO

SAMPLING AND NOISE. Increasing the number of samples per pixel gives an anti-aliased image which better represents the actual scene.

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

Deferred Rendering Due: Wednesday November 15 at 10pm

Ray Tracing. Outline. Ray Tracing: History

Photon Maps. The photon map stores the lighting information on points or photons in 3D space ( on /near 2D surfaces)

COMPUTER GRAPHICS AND INTERACTION

Shadows. COMP 575/770 Spring 2013

CS 148, Summer 2012 Introduction to Computer Graphics and Imaging Justin Solomon

Shading. Why we need shading. Scattering. Shading. Objectives

Rendering. Mike Bailey. Rendering.pptx. The Rendering Equation

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

CEng 477 Introduction to Computer Graphics Fall 2007

CS Computer Graphics: Transformations & The Synthetic Camera

Lecture 15: Shading-I. CITS3003 Graphics & Animation

Spring 2012 Final. CS184 - Foundations of Computer Graphics. University of California at Berkeley

Models and Architectures

Raytracing. COSC 4328/5327 Scott A. King

CS 464 Review. Review of Computer Graphics for Final Exam

Ray Tracing. Last Time? Reading for Today. Reading for Today

Problem Set 4 Part 1 CMSC 427 Distributed: Thursday, November 1, 2007 Due: Tuesday, November 20, 2007

Ray Tracer Due date: April 27, 2011

Transcription:

CS 543 - Computer Graphics: Introduction to Ray Tracing by Robert W. Lindeman gogo@wpi.edu (with help from Peter Lohrmann ;-) View Volume View volume similar to gluperspective Angle Aspect Near? Far? But we draw in 2D gluortho( ) R.W. Lindeman - WPI Dept. of Computer Science 2 1

Primary Rays Generate ray from eye through pixel into scene of objects Determine if ray hits an object Calculate lighting at that point Set pixel to necessary color R.W. Lindeman - WPI Dept. of Computer Science 3 Primary Rays Blue lines represent primary rays Some rays receive color from object Some rays receive background color R.W. Lindeman - WPI Dept. of Computer Science 4 2

Determining a Hit For each pixel, test every object for a hit Gather info about hit - Point - Normal R.W. Lindeman - WPI Dept. of Computer Science 5 What's so hard about that? Consider a mesh with only 1300 polygons being rendered to a screen resolution of 640x480. 640x480x1300 = 399,360,000 possible intersections!! Adding 2 reflections = 1,198,080,000 Adding soft shadows = 13,178,880,000 R.W. Lindeman - WPI Dept. of Computer Science 6 3

A Little Better Appreciation? R.W. Lindeman - WPI Dept. of Computer Science 7 Real or Rendered? R.W. Lindeman - WPI Dept. of Computer Science 8 4

Traveling Through Spaces Transformed shape in world space Generated ray in camera space Converted to world space during generation How do we calculate if a ray hits an object? Transformed objects could have ANY shape R.W. Lindeman - WPI Dept. of Computer Science 9 Determining A Hit Apply inverse transformation matrix Move object back to generic shape Move ray to some new location. R.W. Lindeman - WPI Dept. of Computer Science 10 5

Determining A Hit (Sphere) Parametric Equations P = S + td F(x,y,z) = x 2 + y 2 + z 2-1 F(P) = P 2-1 = 0 Substituting P into F(P) = 0, we get: D 2 * t 2 + 2(S D)*t + (S 2 1) = 0 Recall the dot-product relation: a+b 2 = a 2 + 2a b + b 2 This is a quadratic equation of A 2 *t 2 + 2Bt + C = 0 where A = D 2 B = S D C = S 2 1 R.W. Lindeman - WPI Dept. of Computer Science 11 Determining A Hit (Sphere) Utilize quadratic equation: Find the hit point using: t hit = " B A ± B2 " AC A If discriminant (B 2 -AC) is negative: ray misses sphere If discriminant is zero: ray grazes sphere edge Hit point is B/A Discriminant positive: ray pierces sphere Two hits times (+ and discriminant) Normal? Easy! It's the hit point! R.W. Lindeman - WPI Dept. of Computer Science 12 6

Intersecting Transformed Objects F(P) becomes F(T -1 (P)) F(T -1 (S + td)) = 0 T -1 (S + td) = (T -1 S) + (T -1 D)t R.W. Lindeman - WPI Dept. of Computer Science 13 Hit Info Once we calculate a hit, gather information Hit time Hit object (pointer) Entering? Which surface of object Hit point Hit normal R.W. Lindeman - WPI Dept. of Computer Science 14 7

Parametric Shapes http://www.econym.demon.co.uk/isotut/parametric.htm R.W. Lindeman - WPI Dept. of Computer Science 15 Find Best Hit Given a set of hit times (intersections) Find the closest (soonest) hit For each object that is hit by the ray Test if that hit time is the closest thus far Clipping? Now we know which object the ray hit, where it hit,and the normal Time to color the pixel! R.W. Lindeman - WPI Dept. of Computer Science 16 8

Coloring Pixels Is there a need to LERP? If there are no hits, use a background color Otherwise "Default" color? (no lights. ambient) Contribution of lights Add calculated diffuse color Add calculated specular color Contribution of other effects R.W. Lindeman - WPI Dept. of Computer Science 17 Review Coloring (Ambient) + Ambient = R.W. Lindeman - WPI Dept. of Computer Science 18 9

Review Coloring (Diffuse) X = R.W. Lindeman - WPI Dept. of Computer Science 19 Review Coloring (Specular) + = R.W. Lindeman - WPI Dept. of Computer Science 20 10

Review Coloring (Shadows)? = R.W. Lindeman - WPI Dept. of Computer Science 21 Shade Function Get the first hit in the scene If no hits, then return background color Gather some information about the best hit pixelcolor += ambient contribution For each light in the scene pixelcolor += calculated diffuse contribution pixelcolor += calculated specular contribution return pixelcolor R.W. Lindeman - WPI Dept. of Computer Science 22 11

References F.S. Hill Chapter 12 R.W. Lindeman - WPI Dept. of Computer Science 23 12