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

Slides:



Advertisements
Similar presentations
GR2 Advanced Computer Graphics AGR
Advertisements

Christian Lauterbach COMP 770, 2/16/2009. Overview  Acceleration structures  Spatial hierarchies  Object hierarchies  Interactive Ray Tracing techniques.
Ray Tracing CMSC 635. Basic idea How many intersections?  Pixels  ~10 3 to ~10 7  Rays per Pixel  1 to ~10  Primitives  ~10 to ~10 7  Every ray.
Light Issues in Computer Graphics Presented by Saleema Amershi.
1. What is Lighting? 2 Example 1. Find the cubic polynomial or that passes through the four points and satisfies 1.As a photon Metal Insulator.
Based on slides created by Edward Angel
Illumination Model & Surface-rendering Method 박 경 와.
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Shading I.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Lighting/Shading II Week.
Computer Graphics (Fall 2005) COMS 4160, Lecture 21: Ray Tracing
7M836 Animation & Rendering
Objectives Learn to shade objects so their images appear three- dimensional Learn to shade objects so their images appear three- dimensional Introduce.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Lighting and Shading Week.
1 7M836 Animation & Rendering Global illumination, ray tracing Arjan Kok
Lecture 8 Advanced Rendering – Ray Tracing, Radiosity & NPR.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Shading I Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Basic Ray Tracing CMSC 435/634. Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear.
CS 480/680 Computer Graphics Shading I Dr. Frederick C Harris, Jr.
CSC418 Computer Graphics n Raytracing n Shadows n Global Illumination.
CS 445 / 645: Introductory Computer Graphics
Ray Tracing II A More Practical Version. A QUICK REVIEW.
Computer Graphics 2 Lecture x: Acceleration Techniques for Ray-Tracing Benjamin Mora 1 University of Wales Swansea Dr. Benjamin Mora.
-Global Illumination Techniques
Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand.
CS 376 Introduction to Computer Graphics 04 / 16 / 2007 Instructor: Michael Eckmann.
CSC418 Computer Graphics n Illumination n Lights n Lightinging models.
Ray Tracing Chapter CAP4730: Computational Structures in Computer Graphics.
Basic Ray Tracing CMSC 435/634. Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear.
David Luebke 1 10/26/2015 Lighting CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
Photo-realistic Rendering and Global Illumination in Computer Graphics Spring 2012 Material Representation K. H. Ko School of Mechatronics Gwangju Institute.
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Surface Rendering Methods 고려대학교 컴퓨터 그래픽스 연구실.
Lecture Fall 2001 Illumination and Shading in OpenGL Light Sources Empirical Illumination Shading Transforming Normals Tong-Yee Lee.
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
Ray Tracing II. HW1 Part A due October 10 Camera module Object module –Read from a file –Sphere and Light only Ray tracer module: –No shading. No reflection.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
David Luebke 3/5/2016 Advanced Computer Graphics Lecture 4: Faster Ray Tracing David Luebke
David Luebke3/12/2016 Advanced Computer Graphics Lecture 3: More Ray Tracing David Luebke
CS552: Computer Graphics Lecture 33: Illumination and Shading.
Computer Graphics Ken-Yi Lee National Taiwan University (the slides are adapted from Bing-Yi Chen and Yung-Yu Chuang)
Advanced Computer Graphics
Basic Ray Tracing CMSC 435/634.
7. Illumination Phong Illumination Diffuse, Specular and Ambient
Shading CS 465 Lecture 4 © 2004 Steve Marschner • 1.
Bounding Volume Hierarchies and Spatial Partitioning
© University of Wisconsin, CS559 Spring 2004
Shading Revisited Some applications are intended to produce pictures that look photorealistic, or close to it The image should look like a photograph A.
Bounding Volume Hierarchies and Spatial Partitioning
Real-Time Ray Tracing Stefan Popov.
Unit-7 Lighting and Shading
© University of Wisconsin, CS559 Fall 2004
Path Tracing (some material from University of Wisconsin)
Monte Carol Integration
Lighting.
CS 655 – Computer Graphics Global Illumination.
Ray-tracing Algorithm and Hardware
Fundamentals of Computer Graphics Part 6 Shading
Isaac Gang University of Mary Hardin-Baylor
Image.
Illumination Models Chapter 14 Section 14.1 to 14.2
Illumination and Shading
Advanced Computer Graphics
CSCE 441: Computer Graphics Ray Tracing
14th Lecture – Final Lecture
GR2 Advanced Computer Graphics AGR
Radiosity Sung-Eui Yoon (윤성의) CS580: Course URL:
Illumination Model 고려대학교 컴퓨터 그래픽스 연구실.
Illumination Model 고려대학교 컴퓨터 그래픽스 연구실.
CS 480/680 Computer Graphics Shading.
Introduction to Ray Tracing
CSC418 Computer Graphics Raytracing Shadows Global Illumination.
Presentation transcript:

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

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

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

Basic Algorithms Rays are cast from the eye point through each pixel in the image

Shadows Cast ray from the intersection point to each light source Shadow rays Used 3ds Max

Reflections If object specular, cast secondary reflected rays

Refractions If object tranparent, cast secondary refracted rays

An Improved Illumination Model [Whitted 80] Phong illumination model Whitted model S and T are intensity of light from reflection and transmission rays Ks and Kt are specular and transmission coefficient

OpenGL’s Illumination Model From Wikipedia

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

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

Lambert’s Cosine Law The reflected energy from a small surface area from illumination arriving from direction is proportional to the cosine of the angle between and the surface normal

Computing Diffuse Reflection Constant of proportionality depends on surface properties The constant kd specifies how much of the incident light Ii is diffusely reflected When the incident light is blocked by the surface itself and the diffuse reflection is 0 Diffuse reflection for varying light directions Why are sphere’s used to show shading

Image source: astochimp.com and wiki 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 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: ni and no are the indices of refraction for the incoming and outgoing ray, respectively Reflection is a special case where ni = no so o = i The incoming ray, the surface normal, and the reflected ray all lie in a common plane

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

Phong Illumination One of the most commonly used illumination models in computer graphics Empirical model and does not have no physical basis is the direction to the viewer is clamped to [0,1] The specular exponent ns controls how quickly the highlight falls off

Effect of Specular Exponent How the shape of the highlight changes with varying ns

varying light direction varying specular exponent Examples of Phong varying light direction varying specular exponent

Putting it All Together

An Improved Illumination Model [Whitted 80] Phong illumination model Whitted model S and T are intensity of light from reflection and transmission rays Ks and Kt are specular and transmission coefficient

Ray Tree e s2 s1 f s0 a d c eye b eye a b s0 e f s2 c s1 R T R T R T

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 ray- object intersection tests Ray-triangle intersection tests More advanced methods required to make ray tracing practical Bounding volume hierarchies Spatial subdivision (e.g., kd-trees)

Bounding Volumes Enclose complex objects within a simple-to- intersect 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

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

Bounding Volumes Oriented Bounding Box Slabs / K-dops 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 Discrete orientation polytopes

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

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

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)

Example

Example

Example

Example

What about triangles overlapping the split? Example What about triangles overlapping the split?

Example

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

Median vs. SAH (from [Wald04])

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

Classic Ray Tracing Gathering approach Pros of ray tracing Cons: 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

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

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

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

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 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

Next Time Radiosity

Figs.

Basic Algorithms

Shadows

Refractions If object tranparent, cast secondary refracted rays