Review for Ray-tracing Algorithm and Hardware

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

Sung-Eui Yoon ( 윤성의 )

Ray Tracing. Kjetil Babington

Intro to Ray-Tracing & Ray-Surface Acceleration

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

COMP371 COMPUTER GRAPHICS

CPSC GLOBAL ILLUMINATION

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

Raytracing CS148 AS3. Due :59pm PDT

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

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

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

Photorealism: Ray Tracing

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

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

COMP 4801 Final Year Project. Ray Tracing for Computer Graphics. Final Project Report FYP Runjing Liu. Advised by. Dr. L.Y.

Interactive Real-Time Raycasting

03 RENDERING PART TWO

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

Supplement to Lecture 16

Illumination Algorithms

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

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

Ray Tracing. Outline. Ray Tracing: History

Computer Graphics. Lecture 14 Bump-mapping, Global Illumination (1)

Ø Sampling Theory" Ø Fourier Analysis Ø Anti-aliasing Ø Supersampling Strategies" Ø The Hall illumination model. Ø Original ray tracing paper

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

INFOGR Computer Graphics. J. Bikker - April-July Lecture 10: Ground Truth. Welcome!

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

Classic Rendering Pipeline

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

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

Ray-Tracing. Misha Kazhdan

CS 325 Computer Graphics

Lighting affects appearance

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

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

COMPLETION OF Z-buffer Graphics Pipeline

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. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane

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

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

Ray tracing. EECS 487 March 19,

Lighting and Shading

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

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

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

A Little Background. Motivation. Motivation

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

CS 4204 Computer Graphics

Rendering Part I (Basics & Ray tracing) Lecture 25 December 1, 2015

Computer Graphics. - Ray Tracing I - Marcus Magnor Philipp Slusallek. Computer Graphics WS05/06 Ray Tracing I

Assignment 2 Ray Tracing

Raytracing. COSC 4328/5327 Scott A. King

Shading, Advanced Rendering. Week 7, Wed Feb 28

CS 488. More Shading and Illumination. Luc RENAMBOT

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

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

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

Computer Graphics. - Introduction to Ray Tracing - Philipp Slusallek

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

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

Enhancing Traditional Rasterization Graphics with Ray Tracing. October 2015

Lecture 18: Primer on Ray Tracing Techniques

CS-184: Computer Graphics. Administrative

Global Illumination CS334. Daniel G. Aliaga Department of Computer Science Purdue University

COMP environment mapping Mar. 12, r = 2n(n v) v

Illumination & Shading: Part 1

Lecture 11: Ray tracing (cont.)

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

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

SUMMARY. CS380: Introduction to Computer Graphics Ray tracing Chapter 20. Min H. Kim KAIST School of Computing 18/05/29. Modeling

Photorealistic 3D Rendering for VW in Mobile Devices

Global Illumination. Why Global Illumination. Pros/Cons and Applications. What s Global Illumination

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

CS Computer Graphics: Introduction to Ray Tracing

CS Computer Graphics: Introduction to Ray Tracing

MIT Monte-Carlo Ray Tracing. MIT EECS 6.837, Cutler and Durand 1

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

Virtual Reality for Human Computer Interaction

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

CS5620 Intro to Computer Graphics

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

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

Lighting and Shading. Slides: Tamar Shinar, Victor Zordon

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

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

Reflection and Shading

Recursion and Data Structures in Computer Graphics. Ray Tracing

The Rasterization Pipeline

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

Shading and Illumination

CS 130 Exam I. Fall 2015

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

Ray Tracing COMP575/COMP770

Lecture 15: Shading-I. CITS3003 Graphics & Animation

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

Assignment 6: Ray Tracing

Computer Graphics. Illumination and Shading

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

Transcription:

Review for Ray-tracing Algorithm and Hardware Reporter: 邱敬捷博士候選人 Lan-Da Van ( 范倫達 ), Ph. D. Department of Computer Science National Chiao Tung University Taiwan, R.O.C. Summer, 2017 1 2017/7/26

Outline Introduction Ray-casting Algorithm Ray-tracing Algorithm Traversal Tree Algorithm Ray-tracing Hardware Traversal Tree and Build Tree Hardware Conclusion

Graphics Pipeline Review Properties of the Graphics Pipeline Primitives are transformed and projected (not depending on display resolution) Primitives are processed one at a time. Forward-mapping from geometrical space to image space

Realistic Images synthesis Global illumination Radiosity (Finite elements) Ray tracing (Point sampling) Photon mapping (Point sampling) https://upload.wikimedia.org/wikipedia/commons/3/32/recursive_raytrace_of_a_sphere.png 4

Ray Casting (1/2) Ray-casting searches along lines of sight, or rays, to determine the primitive that is visible along it. Properties of ray-casting: Go through all primitives at each pixel Image space sample first Analytic processing afterwards

Ray Casting (2/2) For every pixel shoot a ray from the eye through the pixel. For every object in the scene Find the point of intersection with the ray closest to (and in front of) the eye Compute normal at point of intersection Compute color for pixel based on point and normal at intersection closest to the eye (e.g. by Phong illumination model). t 0

Ray-tracing (1/4) Cast rays from the eye point the same way as ray casting Builds the image pixel by pixel, one at a time Cast additional rays from the hit point to determine the pixel color Shoot rays toward each light. If they hit something, then the object is shadowed from that light, otherwise use standard model for the light Reflection rays for mirror surfaces, to see what should be reflected in the mirror Refraction rays to see what can be seen through transparent objects Sum all the contributions to get the pixel color

Ray-tracing (2/4) http://help.chaosgroup.com/vray/help/rhino/150r1/basic.htm

Ray-tracing (3/4) Primary rays (Red) are always traced from the camera into the scene in order to determine what will be visible in the final image. To create the direct illumination and shadows "Shadow rays "(Black) are traced from each rendered point to each light in the scene. If the rays "hit" a light the point is illuminated based on the light's settings. If they hit an object the point is shaded. Reflection rays (Green) are traced in the direction of the reflection vector which depends on the type of reflection - fresnel or normal and the index of refraction of the material. The direction of the Refraction rays/transmitted rays (Blue) depends only on the index of refraction of the material. http://help.chaosgroup.com/vray/help/rhino/150r1/basic.htm

Ray-tracing (4/4) https://courses.cs.washington.edu/courses/cse457/15au/src/trace/trace.php

Recursive Ray-tracing Recursive Ray Tracing R 2 N 3 T 3 Viewpoint N 2 R 1 T 1 R 3 L 1 L 2 N 1 L 3 L 1 R 1 T 1 L 2 L 3 N i surface normal R i reflected ray Eye R 2 R 3 T 3 L i shadow ray T i transmitted (refracted) ray

Recursive Ray-tracing How to detect other tracing paths in red color? http://www.cs.virginia.edu/~gfx/courses/1999/advanced.spring99.html/lecture2/sld005.htm

Recursive Ray-tracing Ray Tracing Illumination E V L Nˆ R V reflected I I ( ( E E, V ) I direct I reflected I transmitte d I P I reflected I k reflected r I( P, Vreflected) I transmitte d V transmitte d I k transmitte d t I( P, V d transmitte ) I direct k a I ambient I light k d Nˆ Lˆ k s Vˆ Rˆ n shiny

Ray-tracing Results

Phone Reflection Model Visual illustration of the Phong equation: here the light is white, the ambient and diffuse colors are both blue, and the specular color is white, reflecting a small part of the light hitting the surface, but only in very narrow highlights. The intensity of the diffuse component varies with the direction of the surface, and the ambient component is uniform (independent of direction). https://en.wikipedia.org/wiki/phong_reflection_model

Reflection Ray

Reflection Ray Results

Refraction Ray Snell s Law Tˆ Tˆ Tˆ sin Mˆ t sin t i r sin cos Nˆ Nˆ i I Mˆ ( cos ˆ) sin i sin t ( Nˆ cos i Iˆ) cos tn ˆ sin i ( cos cos ) Nˆ Iˆ r cos Nˆ Iˆ i cos 1 sin t i i t 2 t t t r 2 1 sin r 2 i 2 1 (1 ( Nˆ Iˆ) r Nˆ cos Iˆ Î i i Nˆ 2 ) Nˆ Nˆ cos i t Tˆ Mˆ Note that I is the negative of the incoming ray ˆ 2 r 1 r (1 ( Nˆ Iˆ) 2 T ( Nˆ Iˆ) ) Nˆ Iˆ r Total internal reflection when the square root is imaginary

Refraction Ray Results

Shadow Ray Shoot a ray to the light and try to get the distance to the nearest intersection point. If the distance > the distance to the light, add the lighting effect Space partition will speed up its computation.

Shadow Ray pixel light d_l eye d_hit p d_l < d_hit, visibility = 1

Shadow Ray d_l light eye d_hit d_l > d_hit, visibility = 0

Computational Flow H. Y. Kim, Y. J. Kim, L. S. Kim, MRTP: Mobile Ray Tracing Processor with Reconfigurable Stream Multi- Processors for High Datapth Utilization, IEEE JSSC, Feb. 2012.

KD Tree Structure and Results http://zh.wikipedia.org/wiki/k-d%e6%a0%91 http://cybertron.cg.tu-berlin.de/rapid_prototyping_11ws/slicer/

BVH Tree Structure and Results Bounding Volume Hierarchy http://www.bogotobogo.com/games/spatiald atastructure.php http://thomasdiewald.com/blog/?p=1488

Octree Structure and Results http://en.wikipedia.org/wiki/octree http://http.developer.nvidia.com/gpugems2/ gpugems2_chapter37.html

RT Sphere Intersection O P D Ray: P O td P C R Sphere: 2 2 0 C 2 2 O td C R 0 t 2 b b 4ac 2a 2 at bt c 2 a D 0 b 2( O C) D c ( O C) R 2 2

RT Triangle Intersection Barycentric Coordinates P c0p0 c1p 1 c2p2 c0 c1 c2 1 c c 1 2 ( P P ) ( P P ) 0 2 0 ( P P ) ( P P ) 1 0 2 0 ( P P ) ( P P ) 1 0 0 ( P P ) ( P P ) c 1 c c 1 0 2 0 0 1 2 This can be used for checking if P is In the triangle. It is also useful when Computing the texture coordinates and Other linear interpolations (normal). P is inside the triangle if c 1 > 0, c 2 >0, and c 1 +c 2 < 1 CS 535

Ray-tracing Hardware Perspective: Heterogeneous computation architecture (skip here) Commercial GPU (skip here) CUDA OpenCL Specialized hardware for ray-tracing

Specialized Hardware - Ray Tracing Acceleration Structure Tracing General Computation

Ray Processing Unit (RPU) 5.5fps SIGGRAPH '05 ACM SIGGRAPH 2005 Papers, Pages 434-444 4.5fps

Samsung Reconfigurable GPU based on Ray Tracing (SGRT) Fairy scene, 34 fps at 4 SGRT cores (500 MHz T&I unit and 1 GHz SRP

Samsung Reconfigurable GPU based on Ray Tracing (SGRT) Combine the advantages of Rasterization & RayTracing HPG '13 Proceedings of the 5th High-Performance Graphics Conference Pages 109-119

Internal Architecture of the T&I Unit Node Leaf Node HPG '13 Proceedings of the 5th High-Performance Graphics Conference Pages 109-119

Traversal Unit Single Pipeline Parallel Pipeline

Programmable Shader

Execution Flow

RT Results

T&I Engine http://dl.acm.org/citation.cfm?id=2024194; T&I Engine: Traversal and Intersection Engine for Hardware Accelerated Ray Tracing

A Hardware Unit for Fast SAHoptimised BVH Construction ACM Transactions on Graphics, Vol. 32, No. 4, Article 139, Publication Date: July 2013

Build Times Real-time rendering: 30fps One flame: 33ms

Conclusion Pon: Global illumination can be achieved. The computational independence of each ray makes ray tracing amenable to parallelization. Con: Sacrifice performance to improve image quality Divergence of second rays reduce parallelism If the traditional ray tracing is not realistic enough, additional techniques (photon mapping, path tracing) can be considered to show more accurate simulation of real-world lighting