1 of 71

Ray Tracing

Computer Graphics and Imaging

UC Berkeley CS 184/284A

Discussion 06

2 of 71

Week 7 Announcements

  • Homework 2 was due 3/4 - you have 3 slip days per assignment
  • Homework 3 Checkpoint is due on Friday 3/7. Homework is due 3/18.
  • Take-Home Exam Next Week.

3 of 71

Ray Tracing Basics

4 of 71

Ray Equation

r(t) = o + td

  • Where o is the position of the origin.
  • d is the direction of the ray.
  • t is time, and is ≥ 0.

5 of 71

6 of 71

7 of 71

Ray Tracing

8 of 71

Ray Tracing

9 of 71

Worksheet Question 3

10 of 71

11 of 71

12 of 71

13 of 71

14 of 71

15 of 71

Bonus Question!

How would you check if an intersection is inside a triangle?

16 of 71

Bonus Question!

How would you check if an intersection is inside a triangle?

17 of 71

18 of 71

Try placing the ray in this diagram to get intuition

19 of 71

Try placing the ray in this diagram to get intuition

20 of 71

21 of 71

22 of 71

23 of 71

Ray Triangle Intersection

24 of 71

Last week: Ray-Plane Intersection

25 of 71

Ray Triangle Intersection

But meshes are made of triangles, so we need ray-triangle intersection!

25

Last week:

26 of 71

Ray Triangle Intersection

27 of 71

Ray Triangle Intersection Derivation

27

28 of 71

29 of 71

30 of 71

31 of 71

32 of 71

33 of 71

34 of 71

35 of 71

Acceleration Structures

36 of 71

Acceleration Structures Motivation

  • Meshes can be made of hundreds of thousands of triangles.
  • We sample at least one ray per pixel. (Imagine a 4K = 3840x2160 TV.)
  • Calculating intersections can quickly get expensive!

36

37 of 71

Sneak Peek

In the next assignment, you will be able to render images like these!

37

38 of 71

Idea: Bounding Volume Hierarchy

Internal nodes:

  1. Bounding box.
  2. Reference to children.

38

39 of 71

Idea: Bounding Volume Hierarchy

Internal nodes:

  1. Bounding box.
  2. Reference to children.

39

Leaf nodes:

  1. Bounding box.
  2. List of primitives in the box.

40 of 71

Worksheet Question 2

41 of 71

41

42 of 71

42

split this side

43 of 71

43

split this side

44 of 71

44

There are 2 valid splits!

45 of 71

45

We’ll just consider this one.

46 of 71

46

47 of 71

47

  • It’s fine if these bounding boxes intersect!
  • Key idea: we have partitioned objects into disjoint sets.

48 of 71

48

49 of 71

49

50 of 71

50

51 of 71

51

52 of 71

52

53 of 71

Using a Bounding Volume Hierarchy

53

54 of 71

Using a Bounding Volume Hierarchy

54

55 of 71

Using a Bounding Volume Hierarchy

55

56 of 71

Using a Bounding Volume Hierarchy

56

57 of 71

Using a Bounding Volume Hierarchy

57

58 of 71

Using a Bounding Volume Hierarchy

58

59 of 71

Using a Bounding Volume Hierarchy

59

60 of 71

Using a Bounding Volume Hierarchy

60

61 of 71

Using a Bounding Volume Hierarchy

61

62 of 71

Using a Bounding Volume Hierarchy

62

63 of 71

Using a Bounding Volume Hierarchy

63

64 of 71

Using a Bounding Volume Hierarchy

64

65 of 71

Using a Bounding Volume Hierarchy

65

66 of 71

67 of 71

2.2. Using a Bounding Volume Hierarchy

67

Hint: Axis-aligned ray-plane intersection equation

68 of 71

2.2. Using a Bounding Volume Hierarchy

68

69 of 71

2.2. Using a Bounding Volume Hierarchy

69

70 of 71

2.2. Using a Bounding Volume Hierarchy

70

71 of 71

Let’s Take Attendance.

  • The attendance form is in the header of the CS 184/284A course website: cs184.eecs.berkeley.edu/sp26/. You can also use this QR code:
  • Be sure to select put today’s date and �input your TA’s secret word 😉
  • Any feedback? Let us know!