1 of 96

Intro CG @ NCSU

Ben Watson

cgclass.csc.ncsu.edu

1

2 of 96

2

3 of 96

3

4 of 96

history

5 of 96

6 of 96

7 of 96

8 of 96

9 of 96

10 of 96

11 of 96

12 of 96

13 of 96

14 of 96

15 of 96

modern applications

16 of 96

17 of 96

18 of 96

19 of 96

ask your questions

BREAK TIME

listen to

tunes

19

20 of 96

ray casting

vs

ray tracing

21 of 96

hoxxep.github.io/webgl-ray-tracing-demo/

22 of 96

23 of 96

24 of 96

25 of 96

shadows

26 of 96

27 of 96

28 of 96

29 of 96

30 of 96

For each screen pixel

Find the ray from the eye through the pixel

For each object in the scene

If the ray intersects the object, and is closest yet

Record intersection and object

Find color for closest intersection

31 of 96

For each screen pixel

Find the ray from the eye through the pixel

For each object in the scene

If the ray intersects the object, and is closest yet

Record intersection and object

Shade(closest intersection)

Shade(surface)

color = ka*La + kd*Ld(N*L) + ks*Ls(N*H)^n

return(color)

32 of 96

For each screen pixel

Find the ray from the eye through the pixel

For each object in the scene

If the ray intersects the object, and is closest yet

Record intersection and object

Shade(closest intersection)

Shade(surface)

S = {0: shadow ray occluded, 1: not occluded}

color = ka*La + S*(kd*Ld(N*L) + ks*Ls(N*H)^a)

return(color)

33 of 96

34 of 96

35 of 96

go deeper with readings...

sites.google.com/view/cgwiki-ncsu/topics/ray-tracing

post reactions and... we might discuss them next time

log them and... get reading credit

36 of 96

37 of 96

Requests, questions, thoughts?

go-vxlab.csc.ncsu.edu / raytracingdiscussion

post them and... we’ll discuss them next time

log them and... get participation credit

37

38 of 96

39 of 96

Intro CG @ NCSU

Ben Watson

cgclass.csc.ncsu.edu

39

40 of 96

40

41 of 96

41

42 of 96

ray casting

vs

ray tracing

43 of 96

hoxxep.github.io/webgl-ray-tracing-demo/

44 of 96

reflections

45 of 96

46 of 96

47 of 96

48 of 96

49 of 96

50 of 96

R̂ = norm(2N̂(N̂●L̂) – L̂)

where X̂ = norm(X) = X/‖X‖

where ‖X‖ = √(Xx2 + Xy2 + Xz2)

51 of 96

For each screen pixel

Find the ray from the eye through the pixel

For each object in the scene

If the ray intersects the object, and is closest yet

Record intersection and object

Shade(closest intersection,0)

Shade(surface,whichBounce)

S = {0: shadow ray occluded, 1: not occluded}

color = ka*La + S*(kd*Ld(N*L) + ks*Ls(N*H)^a)

if (whichBounce < NUMBOUNCES)

find surfaceR in direction R

color += ks*Shade(surfaceR,whichBounce+1)

return(color)

52 of 96

53 of 96

refractions

54 of 96

55 of 96

56 of 96

57 of 96

58 of 96

59 of 96

60 of 96

For each screen pixel

Find the ray from the eye through the pixel

For each object in the scene

If the ray intersects the object, and is closest yet

Record intersection and object

Shade(closest intersection,0)

Shade(surface,whichBounce)

S = {0: shadow ray occluded, 1: not occluded}

color = ka*La + S*(kd*Ld(N*L) + ks*Ls(N*H)^a)

if (whichBounce < NUMBOUNCES)

find surfaceR in direction R

color += ks*Shade(surfaceR,whichBounce+1)

find surfaceT in direction T

color += kr*Shade(surfaceT,whichBounce+1)

return(color)

61 of 96

62 of 96

hoxxep.github.io/webgl-ray-tracing-demo/

63 of 96

64 of 96

65 of 96

ask your questions

BREAK TIME

listen to

tunes

65

66 of 96

what’s missing

67 of 96

68 of 96

light path notation

E = eye location

L = light location

S = specular reflection

D = diffuse reflection

69 of 96

ray tracing

L[S]*(S|D)E

70 of 96

complete

L[S|D]*E

71 of 96

72 of 96

73 of 96

74 of 96

75 of 96

optimizations

76 of 96

77 of 96

78 of 96

79 of 96

80 of 96

go deeper with readings...

sites.google.com/view/cgwiki-ncsu/topics/ray-tracing

post reactions and... we might discuss them next time

log them and... get reading credit

81 of 96

82 of 96

Requests, questions, thoughts?

go-vxlab.csc.ncsu.edu / raytracingdiscussion

post them and... we’ll discuss them next time

log them and... get participation credit

82

83 of 96

84 of 96

85 of 96

86 of 96

87 of 96

88 of 96

89 of 96

90 of 96

91 of 96

92 of 96

93 of 96

94 of 96

95 of 96

96 of 96