CS 148: Summer 2016 Introduction of Graphics and Imaging Zahid Hossain
Ray Tracing
https://en.wikipedia.org/wiki/Ray_tracing_%28graphics%29
Ray Tracing CS 148: Summer 2016 Introduction of Graphics and - - PowerPoint PPT Presentation
Ray Tracing CS 148: Summer 2016 Introduction of Graphics and Imaging Zahid Hossain https://en.wikipedia.org/wiki/Ray_tracing_%28graphics%29 Paths of Light http://software.intel.com/file/37491 2 CS 148: Introduction to Computer Graphics and
CS 148: Summer 2016 Introduction of Graphics and Imaging Zahid Hossain
https://en.wikipedia.org/wiki/Ray_tracing_%28graphics%29
http://software.intel.com/file/37491
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 2
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3
http://software.intel.com/file/37491
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 4
http://software.intel.com/file/37491
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 5
http://software.intel.com/file/37491
Most light do not reach the camera
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 6
http://software.intel.com/file/37491
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 7
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 8
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 9
http://www.scratchapixel.com/lessons/3d-basic-rendering/introduction-to-ray-tracing/implementing-the-raytracing-algorithm
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 10 http://www.scratchapixel.com
essons/3d-basic-rendering/introduction-to-ray-tracing
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 11
Few lines of code; already impressive
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 12 http://www.scratchapixel.com/images/upload/ray-tracing-refresher/rt-whitted-example.png?
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 13
Render Time: 74 minutes
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 14
Render Time: 16 ms ! (60 fps): my Macbook Pro nVidia GTX M750
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 15 http://images.povcomp.com/entries/images/105_main.jpg
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 16 http://images.povcomp.com/entries/images/105_main.jpg
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 17
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 18
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 19
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 20
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 21
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 22
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 23
No perspective transformation needed!
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 24
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 25
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 26
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 27
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 28
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 29
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 30
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 31
If t* < 0 then what ?
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 32
http://designjk.files.wordpress.com/2011/12/teapot-decorated.png CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 33
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 34
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 35
Note the directions !
http://graphics.stanford.edu/courses/cs148-10-summer/docs/2006--degreve--reflection_refraction.pdf
~ vi
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 36
~ vi
http://graphics.stanford.edu/courses/cs148-10-summer/docs/2006--degreve--reflection_refraction.pdf
http://2.bp.blogspot.com/-2CpxoSdtNE8/T5nMClgobpI/AAAAAAAAAJ4/XgaZ168HpKg/s1600/P0008_I004.png CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 37
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 38
Real life issues !
abstract class surface virtual hit-record hit(ray, t0, t1) virtual box bounding-box() struct hit-record vector3d position, normal surface hit-surface … abstract class material color evaluate(in-ray, normal, pos) …
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 39
color ray-trace(ray r) hit-record record = intersect(r); … if (record.hit-surface.is-reflective) ray reflected-ray = reflect(r,record.normal); color reflected-color = ray-trace(reflected-ray); compute-spectral-component( reflected-color); …
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 40
Lots of bounces Fewer bounces
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 41
Avoid infinite recursion: stop after nth depth (typically n=5)
http://www.hackification.com/2008/08/31/experiments-in-ray-tracing-part-8-anti-aliasing/
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 42
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 43
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 44
Moiré pattern
http://upload.wikimedia.org/wikipedia/commons/f/fb/Moire_pattern_of_bricks_small.jpg CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 45
Patterned Noise
http://en.wikipedia.org/wiki/File:Moire_pattern_of_bricks.jpg CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 46
We are less sensitive to granular noise
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 47
One ray per box
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 48
http://sopra.le-gousteau.de/images/2/2e/Bv_bvh_bspheres.jpg http://graphics.ucsd.edu/courses/rendering/2004/ssaha/index_files/finalbvh.jfif
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 49
Bounding Volume Hierarchy (BVH)
http://sopra.le-gousteau.de/images/2/2e/Bv_bvh_bspheres.jpg http://graphics.ucsd.edu/courses/rendering/2004/ssaha/index_files/finalbvh.jfif
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 50
Bounding Volume Hierarchy (BVH)
Value Variable
p Pixels on screen b Objects in scene m Average pixels/object
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 51
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 52
http://erich.realtimerendering.com/shadow_comparison.html
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 53
http://user.online.be/felixverbelen/lunecl.jpg
Lights aren’t all point sources
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 54
Randomly sample light rays: Area Light
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 55
Shadow computed per ray: Average intensity
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 56
Shadow Caster
Shadow computed per ray: Average intensity
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 57
Shadow Caster
http://liam887.files.wordpress.com/2010/08/weaver.jpg CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 58
Randomly sample eye positions
Square lens
“Focus plane”
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 59
https://graphics.stanford.edu/wikis/cs148-11-fall/RaytracingResults http://www.baylee-online.net/Projects/Raytracing/Algorithms/Glossy-Reflection-Transmission
Randomly sample reflected rays
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 60
http://www.matkovic.com/anto/3dl-test-balls-01.jpg
Randomly sample positions
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 61
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 62
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 63
Account for indirect lighting
http://en.wikipedia.org/wiki/Global_illumination CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 64
Diffuse inter-reflection
http://en.wikipedia.org/wiki/Global_illumination CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 65
http://en.wikipedia.org/wiki/Global_illumination CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 66
Color Bleed
http://en.wikipedia.org/wiki/Global_illumination CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 67
Caustics
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 68
http://candela.stanford.edu/cs348b-14/doku.php?id=lectures:lecture17:slide6
Bi-Directional Path Tracing
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 69
“Embarrassingly parallel,” but not SIMD?
[NVIDIA, SIGGRAPH 2008] CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 70
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 71
CS 348b
CS 148: Summer 2016 Introduction of Graphics and Imaging Zahid Hossain
https://en.wikipedia.org/wiki/Ray_tracing_%28graphics%29