CS580: Ray Tracing. Sung-Eui Yoon ( 윤성의 ) Course URL:

Similar documents
Classic Rendering Pipeline

Sung-Eui Yoon ( 윤성의 )

Sung-Eui Yoon ( 윤성의 )

Illumination and Shading

Topic 9: Lighting & Reflection models. Lighting & reflection The Phong reflection model diffuse component ambient component specular component

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

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

Acceleration Data Structures

Illumination & Shading: Part 1

Topic 9: Lighting & Reflection models 9/10/2016. Spot the differences. Terminology. Two Components of Illumination. Ambient Light Source

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

Ray Tracing. Cornell CS4620/5620 Fall 2012 Lecture Kavita Bala 1 (with previous instructors James/Marschner)

Raytracing. COSC 4328/5327 Scott A. King

Review for Ray-tracing Algorithm and Hardware

Chapter 11 Global Illumination. Part 1 Ray Tracing. Reading: Angel s Interactive Computer Graphics (6 th ed.) Sections 11.1, 11.2, 11.

Ray Tracing. Kjetil Babington

CPSC GLOBAL ILLUMINATION

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

CSE 681 Illumination and Phong Shading

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

Effects needed for Realism. Computer Graphics (Fall 2008) Ray Tracing. Ray Tracing: History. Outline

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

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

Raytracing CS148 AS3. Due :59pm PDT

COMP371 COMPUTER GRAPHICS

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

Comp 410/510 Computer Graphics. Spring Shading

OpenGl Pipeline. triangles, lines, points, images. Per-vertex ops. Primitive assembly. Texturing. Rasterization. Per-fragment ops.

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

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

7: Rendering (1) COMP Computer Graphics and Image Processing. Local illumination model. Global illumination model. Direct Direct.

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

Ray-Tracing. Misha Kazhdan

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

Interactive Real-Time Raycasting

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

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

Computer Graphics. Illumination and Shading

Computer Graphics Ray Casting. Matthias Teschner

Accelerated Raytracing

Reflection and Shading

Shading I Computer Graphics I, Fall 2008

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

Supplement to Lecture 16

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

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

w Foley, Section16.1 Reading

Lighting and Shading

Local vs. Global Illumination & Radiosity

Lecture 11: Ray tracing (cont.)

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

Lighting affects appearance

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

Lighting and Shading. Slides: Tamar Shinar, Victor Zordon

Ray tracing. EECS 487 March 19,

Ray Intersection Acceleration

Intersection Acceleration

Ray Tracing. Computer Graphics CMU /15-662, Fall 2016

Ray Tracing Acceleration. CS 4620 Lecture 20

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

Lecture 10: Ray tracing

Lighting and Shading Computer Graphics I Lecture 7. Light Sources Phong Illumination Model Normal Vectors [Angel, Ch

Photorealism: Ray Tracing

Today. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models

Illumination & Shading

Accelerating Ray-Tracing

Ray Casting. Outline in Code. Outline. Finding Ray Direction. Heckbert s Business Card Ray Tracer. Foundations of Computer Graphics (Fall 2012)

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

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

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

Spatial Data Structures

Illumination and Shading

Anti-aliased and accelerated ray tracing. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell

Illumination Algorithms

Today. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models

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

Ray Tracing. Outline. Ray Tracing: History

Spatial Data Structures

Computer Graphics. - Spatial Index Structures - Philipp Slusallek

Visual cues to 3D geometry. Light Reflection and Advanced Shading. Shading. Recognizing materials. size (perspective) occlusion shading

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

Topics. Ray Tracing II. Intersecting transformed objects. Transforming objects

Illumination Models & Shading

Lecture 15: Shading-I. CITS3003 Graphics & Animation

Illumination & Shading

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

Lighting and Reflectance COS 426

Scene Management. Video Game Technologies 11498: MSc in Computer Science and Engineering 11156: MSc in Game Design and Development

Recursion and Data Structures in Computer Graphics. Ray Tracing

Ray Casting. To Do. Outline. Outline in Code. Foundations of Computer Graphics (Spring 2012) Heckbert s Business Card Ray Tracer

Illumination in Computer Graphics

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

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

CPSC / Sonny Chan - University of Calgary. Collision Detection II

Simple Lighting/Illumination Models

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

I have a meeting with Peter Lee and Bob Cosgrove on Wednesday to discuss the future of the cluster. Computer Graphics

CS230 : Computer Graphics Lighting and Shading. Tamar Shinar Computer Science & Engineering UC Riverside

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

Lighting affects appearance

Transcription:

CS580: Ray Tracing Sung-Eui Yoon ( 윤성의 ) Course URL: http://sglab.kaist.ac.kr/~sungeui/gcg/

Recursive Ray Casting Gained popularity in when Turner Whitted (1980) recognized that recursive ray casting could be used for global illumination effects 2

Ray Casting and Ray Tracing Trace rays from eye into scene Backward ray tracing Ray casting used to compute visibility at the eye Perform ray tracing for arbitrary rays needed for shading Reflections Refraction and transparency Shadows 3

Basic Algorithms Rays are cast from the eye point through each pixel in the image From kavita s slides 4

Shadows Cast ray from the intersection point to each light source Shadow rays From kavita s slides 5

Reflections If object specular, cast secondary reflected rays From kavita s slides 6

Refractions If object tranparent, cast secondary refracted rays From kavita s slides 7

An Improved Illumination Model [Whitted 80] Phong illumination model I numlights j j j j j j n r (k aia k did(n ˆ Lˆ j) k sis(v ˆ R) ˆ s ) j 1 Whitted model I r numlights j 1 (k j a I j a k j d I j d (Nˆ Lˆ j )) k s S k t T S and T are intensity of light from reflection and transmission rays Ks and Kt are specular and transmission coefficient 8

OpenGL s Illumination Model numlights j j j j j j n Ir (k aia k didmax((n ˆ Lˆ j),0) k sismax((v ˆ s R) ˆ,0)) j 1 From Wikipedia 9

Ambient Light Source A simple hack for indirect illumination Incoming ambient illumination (I i,a ) is constant for all surfaces in the scene Reflected ambient illumination (I r,a ) depends only on the surface s ambient reflection coefficient (k a ) and not its position or orientation I k I r,a a i,a These quantities typically specified as (R, G, B) triples 10

Ideal Diffuse Reflection Ideal diffuse reflectors (e.g., chalk) Reflect uniformly over the hemisphere Reflection is view-independent Very rough at the microscopic level Follow Lambert s cosine law 11

Lambert s Cosine Law The reflected energy from a small surface area from illumination arriving from direction ˆL is proportional to the cosine of the angle between and the surface normal ˆN I I cosθ ˆL r i I (Nˆ L) ˆ i ˆL 12

Computing Diffuse Reflection Constant of proportionality depends on surface properties I k I (Nˆ L) ˆ r,d d The constant k d specifies how much of the incident light I i is diffusely reflected i Diffuse reflection for varying light directions When (Nˆ L) ˆ 0 the incident light is blocked by the surface itself and the diffuse reflection is 0 13

Specular Reflection Specular reflectors have a bright, view dependent highlight E.g., polished metal, glossy car finish, a mirror At the microscopic level a specular reflecting surface is very smooth Specular reflection obeys Snell s law 14 Image source: astochimp.com and wiki

Snell s Law The relationship between the angles of the incoming and reflected rays with the normal is given by: n sin n sin i i o o ˆL i ˆN o ˆR n i and n o are the indices of refraction for the incoming and outgoing ray, respectively Reflection is a special case where n i = n o so o = i The incoming ray, the surface normal, and the reflected ray all lie in a common plane 15

Non-Ideal Reflectors Snell s law applies only to ideal specular reflectors Roughness of surfaces causes highlight to spread out Empirical models try to simulate the appearance of this effect, without trying to capture the physics of it ˆL ˆN ˆR 16

Phong Illumination One of the most commonly used illumination models in computer graphics Empirical model and does not have no physical basis ˆN ˆV ns I k I (cos ) ˆL ˆR (V) ˆ r k s s i I (Vˆ R) ˆ i is the direction to the viewer ( ˆ ˆ n s V R) is clamped to [0,1] The specular exponent n s controls how quickly the highlight falls off 17

Effect of Specular Exponent How the shape of the highlight changes with varying n s 18

Examples of Phong varying light direction 19 varying specular exponent

Putting it All Together I r numlights j 1 (k j a I j a k j d I j d max((nˆ Lˆ j ),0) k j s I j s max((vˆ R),0)) ˆ n s 20

An Improved Illumination Model [Whitted 80] Phong illumination model I numlights j j j j j j n r (k aia k did(n ˆ Lˆ j) k sis(v ˆ R) ˆ s ) j 1 Whitted model I r numlights j 1 (k j a I j a k j d I j d (Nˆ Lˆ j )) k s S k t T S and T are intensity of light from reflection and transmission rays Ks and Kt are specular and transmission coefficient 21

Ray Tree e f a s 2 s 0 s 1 eye c b d eye R T a s 0 b R T R T e s 2 f c s 1 b 22

Acceleration Methods for Ray Tracing Rendering time for a ray tracer depends on the number of ray intersection tests per pixel The number of pixels X the number of primitives in the scene Early efforts focused on accelerating the rayobject intersection tests Ray-triangle intersection tests More advanced methods required to make ray tracing practical Bounding volume hierarchies Spatial subdivision (e.g., kd-trees) 23

Bounding Volumes Enclose complex objects within a simple-tointersect objects If the ray does not intersect the simple object then its contents can be ignored The likelihood that it will strike the object depends on how tightly the volume surrounds the object. Spheres are simple, but not tight Axis-aligned bounding boxes often better Can use nested or hierarchical bounding volumes 24

Bounding Volumes Sphere [Whitted80] Cheap to compute Cheap test Potentially very bad fit Axis-Aligned Bounding Box Very cheap to compute Cheap test Tighter than sphere 25

Bounding Volumes Oriented Bounding Box Fairly cheap to compute Fairly Cheap test Generally fairly tight Slabs / K-dops More expensive to compute Fairly cheap test Can be tighter than OBB 26

Hierarchical Bounding Volumes Organize bounding volumes as a tree Choose a partitioning plane and distribute triangles into left and right nodes Each ray starts with the scene BV and traverses down through the hierarchy r 27

Spatial Subdivision Idea: Divide space in to subregions Place objects within a subregion into a list Only traverse the lists of subregions that the ray passes through Mailboxing used to avoid multiple test with objects in multiple regions Many types Regular grid Octree BSP tree kd-tree 28

Overview of kd-trees Binary spatial subdivision (special case of BSP tree) Split planes aligned on main axis Inner nodes: subdivision planes Leaf nodes: triangle(s) 29

30 Example

31 Example

32 Example

33 Example

Example What about triangles overlapping the split? 34

35 Example

Split Planes How to select axis & split plane? Largest dimension, subdivide in middle More advanced: Surface area heuristic Makes large difference 50%-100% higher overall speed 36

Median vs. SAH (from [Wald04]) 37

Ray Tracing with kd-tree Goal: find closest hit with scene Traverse tree front to back (starting from root) At each node: If leaf: intersect with triangles If inner: traverse deeper 38

Classic Ray Tracing Gathering approach From lights, reflected, and refracted directions Pros of ray tracing Simple and improved realism over the rendering pipeline Cons: Simple light model, material, and light propagation Not a complete solution Hard to accelerate with special-purpose H/W 39

History Problems with classic ray tracing Not realistic View-dependent Radiosity (1984) Global illumination in diffuse scenes Monte Carlo ray tracing (1986) Global illumination for any environment 40

Class Objectives were: Understand a basic ray tracing Know the Phong illumination model Implement its acceleration data structure and know how to use it 41

Any Questions? Come up with one question on what we have discussed in the class and submit at the end of the class 1 for already answered questions 2 for typical questions 3 for questions with thoughts Submit questions at least four times before the mid-term exam Multiple questions for the class is counted as only a single time 42

Homework Go over the next lecture slides before the class Watch 2 SIGGRAPH videos and submit your summaries right brefore every Tue. class Just one paragraph for each summary 43 Example: Title: XXX XXXX XXXX Abstract: this video is about accelerating the performance of ray tracing. To achieve its goal, they design a new technique for reordering rays, since by doing so, they can improve the ray coherence and thus improve the overall performance.

PA1 Get to know pbrt 44

Next Time Radiosity 45