Introduction to Ray-tracing Objectives

Similar documents
Ray-tracing Cont. Ray-tracing

CS Computer Graphics: Introduction to Ray Tracing

CS Computer Graphics: Introduction to Ray Tracing

Photorealism: Ray Tracing

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

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

8.1 Geometric Queries for Ray Tracing

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

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

Lighting and Shading

CS5620 Intro to Computer Graphics

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

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

Supplement to Lecture 16

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

Illumination & Shading

Shading I Computer Graphics I, Fall 2008

Intro to Ray-Tracing & Ray-Surface Acceleration

Comp 410/510 Computer Graphics. Spring Shading

Illumination Models & Shading

Ray Tracing COMP575/COMP770

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

Global Illumination Using Ray Tracing

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

Ray Tracing. Kjetil Babington

Recursive Ray Tracing. Ron Goldman Department of Computer Science Rice University

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

Computer Graphics Tick 1

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

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

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

CS 325 Computer Graphics

Assignment 2 Ray Tracing

Computer Graphics. Lecture 13. Global Illumination 1: Ray Tracing and Radiosity. Taku Komura

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

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

Lecture 11: Ray tracing (cont.)

Implementation Issues

Ray Tracing. CSCI 420 Computer Graphics Lecture 15. Ray Casting Shadow Rays Reflection and Transmission [Ch ]

Today s class. Simple shadows Shading Lighting in OpenGL. Informationsteknologi. Wednesday, November 21, 2007 Computer Graphics - Class 10 1

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

Computer Graphics. Ray Tracing. Based on slides by Dianna Xu, Bryn Mawr College

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

Lecture 15: Shading-I. CITS3003 Graphics & Animation

Photorealism. Photorealism: Ray Tracing. Ray Tracing

Ray-Tracing. Misha Kazhdan

Ray Tracing. Shandong University

Ray Tracing. Brian Curless CSEP 557 Fall 2016

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

Introduction to Computer Graphics 7. Shading

The University of Calgary

COMP371 COMPUTER GRAPHICS

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

To Shading and Beyond. CS 6965 Fall 2011

Computer Graphics I. Assignment 3

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

Ray tracing Tutorial. Lukas Herzberger

Computer Graphics Global Illumination

Lighting and Shading. Slides: Tamar Shinar, Victor Zordon

A Little Background. Motivation. Motivation

Ray Tracing. Yogitha Golla Indiana State University Terre Haute IN, USA. December 13, Abstract This project is about Ray Tracing Mechanism.

Computer Graphics. Lecture 10. Global Illumination 1: Ray Tracing and Radiosity. Taku Komura 12/03/15

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

Deferred Rendering Due: Wednesday November 15 at 10pm

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

Computer Graphics. - Introduction to Ray Tracing - Philipp Slusallek

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

Computer Graphics Global Illumination

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

03 RENDERING PART TWO

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

Raytracing. COSC 4328/5327 Scott A. King

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

CMSC427 Final Practice v2 Fall 2017

Ray Tracing Foley & Van Dam, Chapters 15 and 16

Global Illumination. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

OpenGL Lighting Computer Graphics Spring Frank Palermo

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

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

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

CPSC GLOBAL ILLUMINATION

Computer Graphics Tick 2

Local Illumination. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

CEng 477 Introduction to Computer Graphics Fall 2007

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

Topics and things to know about them:

Illumination and Shading

Global Rendering. Ingela Nyström 1. Effects needed for realism. The Rendering Equation. Local vs global rendering. Light-material interaction

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

CS559 Computer Graphics Fall 2015

CS Computer Graphics: Ray Tracing Detail, Part 3

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

Ray Tracer Due date: April 27, 2011

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

Reflection and Shading

Computer Graphics and Image Processing Ray Tracing I

surface: reflectance transparency, opacity, translucency orientation illumination: location intensity wavelength point-source, diffuse source

CS130 : Computer Graphics Lecture 8: Lighting and Shading. Tamar Shinar Computer Science & Engineering UC Riverside

Illumination & Shading I

9. Illumination and Shading

Transcription:

Introduction to Ray-tracing Objectives Define ray-tracing as a means of rendering Ray-tracing for spheres Combining with shading model An algorithm framework 2 1

Light vs. Rendering 3 (Local) Ray-tracing light e-ray Compute interections with objects light 4 2

(Local) Ray-tracing light s-ray e-ray s-ray Compute shadows and illumination light 5 (Local) Ray-tracing 1. Find intersection of ray with nearest object in scene (Eye ray) 2. Determine if that object is in shadow relative to light source(s) (Shadow ray) 3. Determine illumination of object from light source(s) A LARGE part of the work is in calculating intersections. Performance can be improved by making intersection calculations more efficient or by avoiding unnecessary intersection calculations. 6 3

Defining E-ray e-ray Define ray by parametric line with parameter t, R(t) = Ro + Rd * t for all values t > 0 Ro = Origin of the ray (at eye position) Rd = Direction of ray, unit vector pointing from eye to pixel on image plane (different for each pixel) 7 Intersecting Objects 1. Find intersection of ray nearest object in scene (Eye ray) -Objects in scene could be: Polygons Curved Surfaces Spheres - easiest to compute... -Ray-sphere intersection: Define sphere as: (x -x c ) 2 + (y - y c ) 2 +(z - z c ) 2 - Sr 2 = 0 with Sr as radius and Sc as center 8 4

Ray- Sphere Intersection What are the possible scenarios? 9 Ray- Sphere Intersection 1. Find value of t for ray-sphere intersection Substitute the ray equation: x = xo + xd * t y = yo + yd * t z = zo + zd * t Into sphere equation as: (xo + xd*t -x c ) 2 + (yo + yd*t - y c ) 2 +(zo + zd*t - z c ) 2 - r 2 = 0 Note, this is a quadratic equation in terms of t 10 5

Ray- Sphere Intersection 1. Find value of t for ray-sphere intersection (xo + xd*t -x c ) 2 + (yo + yd*t - y c ) 2 +(zo + zd*t - z c ) 2 - r 2 = 0 becomes At 2 + Bt + C = 0 where: A = xd 2 + yd 2 + zd 2 = 1 B = 2[ xd( xo - xc ) + yd( yo - yc ) + zd( zo - zc ) ] C = (xo - xc ) 2 + (yo - yc ) 2 + (zo - zc) 2 - Sr 2 and so t = - B + B 2-4C 2 discriminant 11 Ray- Sphere Intersection How does t correspond to intersection? t0 t 1 t0 t 0 t 1 t 1 discriminant = 0 discriminant < 0 12 6

Ray- Sphere Intersection Actual intersection point: xi = xo + xd*ti yi = yo + yd*ti zi = zo + zd*ti Compute normal (unit length) at intersection: Rn = [ (xi - xc)/sr,(yi - yc)/sr,(zi - zc)/sr] Note, if ray is inside the sphere, negate to point at ray: Rn Rn 13 Ray- Sphere Intersection Summary: Calculate (A,) B,& C and discriminant for quadratic If discriminant < 0 then no intersection Calculate to If to < 0, find t1 If t1 < 0, no intersection Compute actual intersection point Compute normal at intersection To speed up precompute Sr 2 and 1/Sr Be careful of round-off errors which may appear like intersections for very small non-zero values of t 14 7

Shadow Rays Once an intersection is computed, we send a shadow ray to each light source to see if it is in shadow or not We can treat shadow rays the same as eye rays except: They begin at the point of intersection Ro = {xi,yi,zi} T They are directed toward the light source (normalize vector to find Rd) If no intersection is found, the point is not in shadow from that light source, compute illumination If it is in shadow, only add the ambient term for the light Note, no need to compute exact intersection value or normal 15 Combining with shading Normal is determined by Ray-sphere Angle of incidence = angle of reflection Rn light ray -(s-ray) reflected ray qr qi Sphere 16 8

Combining with shading Angle f is between eye-ray and reflected e-ray Rn light ray -(s-ray) reflected ray f qi Sphere 17 Combining with shading For each light source and each color component, the Phong model adds to the illumination as: I += k d L d cosq + k s L s cos a f + k a L a Again, shadow ray lets us determine if the point on the sphere is in shadowed by the particular light If shadowed, do not compute diffuse and specular (only ambient) 18 9

Algorithm framework For each pixel j Determine closest intersection with objects in the scene If no hits, color pixel j background color Else Illumination j for = 0; For each light k Compute shadow ray intersection If hit, illumination j += ambient k Else find illum k and add to illum j end light end hit end pixel 19 Algorithm framework Notes: Illumination is computed for R, G, B values individually If the intensity goes above 1 for these values, will wash out the color - especially when we have a lot of lights in the scene, may want to re-normalize... but better is to keep contribution of each light small (for example ambient total to be <.4 or so) 20 10

Intersecting Other Objects Other objects in the scene follow similar procedures We will look at polygons next time 21 11