87
CS 148, Summer 2012 Introduction to Computer Graphics and Imaging Justin Solomon http://www.futuretech.blinkenlights.nl/misc/scene_1024x768.jpg

CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAAAAAAAAAAA

CS 148, Summer 2012 Introduction to Computer Graphics and Imaging

Justin Solomon

http://www.futuretech.blinkenlights.nl/misc/scene_1024x768.jpg

Page 2: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

http://www.publicdomainpictures.net/view-image.php?picture=female-photographer&image=4360&large=1 http://bloodredpencil.blogspot.com/2010/09/need-help-get-help.html

Page 3: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

http://www.publicdomainpictures.net/view-image.php?picture=female-photographer&image=4360&large=1 http://bloodredpencil.blogspot.com/2010/09/need-help-get-help.html

Page 4: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

http://software.intel.com/file/37491

Page 5: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Light source

http://software.intel.com/file/37491

Page 6: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Light interacts with objects in scene

http://software.intel.com/file/37491

Page 7: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Image plane

http://software.intel.com/file/37491

Page 8: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Most light doesn’t reach the camera http://software.intel.com/file/37491

??

Page 9: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Most light doesn’t reach the camera http://software.intel.com/file/37491

??

Page 10: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Many lighting effects are reversible

Page 11: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Trace rays from light to camera

Page 12: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Trace rays from light to camera

Page 13: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Draw viewing ray through each pixel

Page 14: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Intersect with geometry

Page 15: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Compute light ray

Page 16: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Evaluate shading

µ

Page 17: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Take closest one

Page 18: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Redirect ray

µ

µ

Page 19: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Redirect ray

µ

µ

Page 20: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Rasterization for (each object in scene)

drawObject();

Page 21: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Rasterization

Ray Tracing

for (each object in scene)

drawObject();

for (each pixel in image)

sendRay();

Page 22: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Rasterization

Ray Tracing

for (each object in scene)

drawObject();

for (each pixel in image)

sendRay();

Page 23: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

for each pixel do

compute viewing ray

if (ray hits an object with t>0) then

Compute normal

Evaluate shading model

else

Set pixel color to background color

Textbook page 85

Page 24: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Ray

~o = origin

~d = direction

Page 25: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Ray

~o = origin

~d = directionDoes not have to be unit length!

Page 26: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Point on Ray

~o+ t~dt 2 (0;1)

t ¸ 1

Page 27: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Point on Ray

~o+ t~d

t < 0

Page 28: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Point on Ray

~o+ t~d

t < 0

Page 29: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Generating rays

No perspective transformation

needed!

~p0

~j

~i

~p = ~p0 + u~i+ v~ju 2 [0;w]; v 2 [0; h]

Page 30: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Ray-object intersection

~o+ t~d

k~x¡~ck2 = R2

Page 31: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Ray-object intersection

~o+ t~d k~x¡~ck2 = R2

Page 32: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Ray-object intersection

~o+ t~d k~x¡~ck2 = R2

k~o+ t~d¡~ck2 = R2

Page 33: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Ray-object intersection

~o+ t~d k~x¡~ck2 = R2

k~o+ t~d¡~ck2 = R2

(~o+ t~d¡~c) ¢ (~o+ t~d¡~c) = R2

Page 34: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Ray-object intersection

~o+ t~d k~x¡~ck2 = R2

k~o+ t~d¡~ck2 = R2

(~o+ t~d¡~c) ¢ (~o+ t~d¡~c) = R2

k~dk2t2 +2((~o¡~c) ¢ ~d)t+ k~o¡~ck2 =R2

Page 35: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Ray-object intersection CS 148, fall 2011

Page 36: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Normals

~x~c~N =

~x¡~c

k ¢ k

Page 37: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Normals http://designjk.files.wordpress.com/2011/12/teapot-decorated.png

~v1

~v2

~v3

~v2 ¡~v1

~v3 ¡~v1

~N =(~v2 ¡ ~v1)£ (~v3 ¡ ~v1)

k(~v2 ¡ ~v1)£ (~v3 ¡ ~v1)k

Page 38: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Light rays

~x

~l1 ¡ ~x~l2 ¡ ~x

¢ ¢ ¢

Page 39: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

http://www.spot3d.com/vray/help/150SP1/images/examples/shadows/03_raytraced_colored.png

Page 40: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

http://2.bp.blogspot.com/-2CpxoSdtNE8/T5nMClgobpI/AAAAAAAAAJ4/XgaZ168HpKg/s1600/P0008_I004.png

Intersect light ray with scene

Page 41: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

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)

Page 42: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

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

Page 43: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Lots of bounces Fewer bounces

CS 148, fall 2011

Save time; avoid infinite recursion

Page 44: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

http://www.deepakantony.com/wp-content/uploads/2012/04/ambientocclusion_instancing.png http://members.optusnet.com.au/pennywyatt/Images/People.png

Deal with repeated objects

Page 45: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Deal with repeated objects

http://members.optusnet.com.au/pennywyatt/Images/People.png

Store object once, use often

Page 46: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Deal with repeated objects

Each instance stores a

transformation matrix M

(can stretch, rotate, etc!)

Page 47: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Deal with repeated objects

Object coordinates World coordinates

M 2 R3£3

Page 48: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Deal with repeated objects

M 2 R3£3

~o+ t~d

Page 49: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Deal with repeated objects

M 2 R3£3

~o+ t~dM¡1~o+ tM¡1~d

Do intersection here!

Page 50: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Deal with repeated objects

M 2 R3£3

~o+ t~dM¡1~o+ tM¡1~dSame t!

Page 51: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Deal with repeated objects

M 2 R3£3

~N ~M ~N

Page 52: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Binary operations for shape http://upload.wikimedia.org/wikipedia/commons/8/8b/Csg_tree.png

Page 53: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Binary operations for shape http://en.wikipedia.org/wiki/Constructive_solid_geometry

A B

A[B A¡B A\B

Page 54: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Binary operations for shape http://en.wikipedia.org/wiki/Constructive_solid_geometry

A B

A[B A¡B A\B

Page 55: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Store “inside intervals”

in(A) = [1; 3]

in(B) = [2; 6]

in(A \B) = [2; 3]

in(A [B) = [1; 6]

in(A¡B) = [1; 2)

A B

Page 56: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Store “inside intervals”

in(A) = [1; 3]

in(B) = [2; 6]

in(A \B) = [2; 3]

in(A [B) = [1; 6]

in(A¡B) = [1; 2)

A B

Page 57: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Store “inside intervals”

in(A) = [1; 3]

in(B) = [2; 6]

in(A \B) = [2; 3]

in(A [B) = [1; 6]

in(A¡B) = [1; 2)

A B

Page 58: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Store “inside intervals”

in(A) = [1; 3]

in(B) = [2; 6]

in(A \B) = [2; 3]

in(A [B) = [1; 6]

in(A¡B) = [1; 2)

A B

Page 59: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

http://ps-2.kev009.com/CATIA-B18/basug_C2/basugbt1510.htm

Page 60: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

http://www.hackification.com/2008/08/31/experiments-in-ray-tracing-part-8-anti-aliasing/

Page 61: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Scatter rays to make ray tracing less crisp.

Page 62: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Multiple rays per pixel

Page 63: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Multiple rays per pixel

Moiré pattern

http://upload.wikimedia.org/wikipedia/commons/f/fb/Moire_pattern_of_bricks_small.jpg

Page 64: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Remove Moiré patterns http://en.wikipedia.org/wiki/File:Moire_pattern_of_bricks.jpg

Page 65: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

?

?

?

Page 66: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on
Page 67: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on
Page 68: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

http://erich.realtimerendering.com/shadow_comparison.html

Hard shadows Soft shadows

Page 69: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

http://user.online.be/felixverbelen/lunecl.jpg

Lights aren’t all point sources

Page 70: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Randomly sample light rays

Page 71: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Shadow computed per ray

Page 72: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Shadow computed per ray

Page 73: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Shadow computed per ray

Page 74: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

http://liam887.files.wordpress.com/2010/08/weaver.jpg

Page 75: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Randomly sample eye positions

Square lens “Focus plane”

Page 76: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

https://graphics.stanford.edu/wikis/cs148-11-fall/RaytracingResults http://www.baylee-online.net/Projects/Raytracing/Algorithms/Glossy-Reflection-Transmission

Randomly sample reflected rays

Page 77: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

http://www.matkovic.com/anto/3dl-test-balls-01.jpg

Randomly sample positions

Page 78: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Brightness depends on nearby geometry http://en.wikipedia.org/wiki/Ambient_occlusion

Diffuse Ambient

Page 79: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Account for indirect lighting http://en.wikipedia.org/wiki/Global_illumination

Page 80: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Account for indirect lighting

Diffuse inter-reflection http://en.wikipedia.org/wiki/Global_illumination

Page 81: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Account for indirect lighting

Caustics http://en.wikipedia.org/wiki/Global_illumination

Page 82: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Rasterization:

O(bm)

Ray tracing:

O(bp)

Accelerated ray tracing:

O(p log b)

Value Variable

p Pixels on screen

b Objects in scene

m Average pixels/object

CS 148, fall 2011

Page 83: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

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

Page 84: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Binary Space Partitioning (BSP) trees http://algorithmicarts.com/images/2008/bsptree-cutaway1269x684.png

Page 85: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

Uniform subdivision grid http://www.cs.berkeley.edu/~sequin/CS184/IMGS/spatialSubdiv.gif

Page 86: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

“Embarrassingly parallel,” but not SIMD? [NVIDIA, SIGGRAPH 2008]

Page 87: CS 148, Summer 2012 Introduction to Computer Graphics and ...graphics.stanford.edu/.../lecture10_ray_tracing.pdf · Accelerated ray tracing: O(p log b) Value Variable p Pixels on

TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAAAAAAAAAAA

CS 148, Summer 2012 Introduction to Computer Graphics and Imaging

Justin Solomon

http://www.futuretech.blinkenlights.nl/misc/scene_1024x768.jpg