Lecture 4 - Real - time Ray Tracing Welcome! , = (, ) - - PowerPoint PPT Presentation

β–Ά
lecture 4 real time ray tracing
SMART_READER_LITE
LIVE PREVIEW

Lecture 4 - Real - time Ray Tracing Welcome! , = (, ) - - PowerPoint PPT Presentation

INFOMAGR Advanced Graphics Jacco Bikker - November 2017 - February 2018 Lecture 4 - Real - time Ray Tracing Welcome! , = (, ) , + , ,


slide-1
SLIDE 1

𝑱 π’š, π’šβ€² = 𝒉(π’š, π’šβ€²) 𝝑 π’š, π’šβ€² + ΰΆ±

𝑻

𝝇 π’š, π’šβ€², π’šβ€²β€² 𝑱 π’šβ€², π’šβ€²β€² π’†π’šβ€²β€²

INFOMAGR – Advanced Graphics

Jacco Bikker - November 2017 - February 2018

Lecture 4 - β€œReal-time Ray Tracing”

Welcome!

slide-2
SLIDE 2

Today’s Agenda:

  • Introduction
  • Ray Distributions
  • The Top-level BVH
  • Real-time Ray Tracing
  • Assignment 2
slide-3
SLIDE 3

Introduction

Advanced Graphics – Real-time Ray Tracing 3

Cost Breakdown for Ray Tracing:

  • Pixels
  • Primitives
  • Light sources
  • Path segments

Mind scalability as well as constant cost. Example: scene consisting of 1k spheres and 4 light sources, diffuse materials, rendered to 1M pixels: 1𝑁 Γ— 5 Γ— 1𝑙 = 5 βˆ™ 109 ray/prim intersections. (multiply by desired framerate for realtime)

Using the BVH:

  • Pixels
  • N primitives  log N deep tree
  • Light sources
  • Path segments

Example: scene consisting of 1k spheres and 4 light sources, diffuse materials, rendered to 1M pixels: 1𝑁 Γ— 5 Γ— 10 = 5 βˆ™ 107 ray/(prim or node) intersections. (multiply by desired framerate for realtime)

slide-4
SLIDE 4

Introduction

Advanced Graphics – Real-time Ray Tracing 4

slide-5
SLIDE 5

Introduction

Advanced Graphics – Real-time Ray Tracing 5

Reality Check

Performance is now OK, but we’re not quite ready to render a game world.

slide-6
SLIDE 6

Introduction

Advanced Graphics – Real-time Ray Tracing 6

slide-7
SLIDE 7

Today’s Agenda:

  • Introduction
  • Ray Distributions
  • The Top-level BVH
  • Real-time Ray Tracing
  • Assignment 2
slide-8
SLIDE 8

Ray Distributions

Advanced Graphics – Real-time Ray Tracing 8 Cost of ray tracing: Dominated by memory access cost.

  • Ray data
  • Node data
  • Triangle data
  • Material data (incl. textures)
slide-9
SLIDE 9

Ray Distributions

Advanced Graphics – Real-time Ray Tracing 9 Primary rays: For a tile of pixels, these are organized in a narrow frustum. All rays share a common

  • rigin.
slide-10
SLIDE 10

Ray Distributions

Advanced Graphics – Real-time Ray Tracing 10 Shadow rays: For point lights, shadow rays also tend to travel close together. When traced from the light source, they too have a common

  • rigin.
slide-11
SLIDE 11

Ray Distributions

Advanced Graphics – Real-time Ray Tracing 11 Secondary rays: Reflected and refracted rays tend to diverge significantly.

slide-12
SLIDE 12

Ray Distributions

Advanced Graphics – Real-time Ray Tracing 12

Coherence

Primary rays and shadow rays for point lights are coherent :

  • they tend to intersect the same primitives;
  • they tend to traverse the same BVH nodes.

Our problem: Ray tracing cost is dominated by memory latency. Solution: Amortize cost of fetching data over multiple rays.

slide-13
SLIDE 13

Ray Distributions

Advanced Graphics – Real-time Ray Tracing 13

Coherent Ray Tracing*

SIMD: four rays for the price of one.

BVHNode::Traverse( Ray r ) { if (!r.Intersects( bounds )) return; if (isleaf()) { IntersectPrimitives(); } else { pool[left].Traverse( r ); pool[left + 1].Traverse( r ); } }

*: Interactive Rendering with Coherent Ray Tracing, Wald et al., 2001

slide-14
SLIDE 14

Ray Distributions

Advanced Graphics – Real-time Ray Tracing 14

Coherent Ray Tracing*

SIMD: four rays for the price of one.

BVHNode::Traverse( Ray4 r4 ) { if (!r4.Intersects( bounds )) return; if (isleaf()) { IntersectPrimitives(); } else { pool[left].Traverse( r4 ); pool[left + 1].Traverse( r4 ); } }

*: Interactive Rendering with Coherent Ray Tracing, Wald et al., 2001

slide-15
SLIDE 15

Ray Distributions

Advanced Graphics – Real-time Ray Tracing 15

Coherent Ray Tracing

Ray packet traversal:

  • intersect four rays with a single BVH node;
  • if any ray in the packet intersects the node, we traverse it;
  • if the node is a leaf node, we intersect the four rays with each

primitive in the leaf. Masking:

  • We maintain an β€˜active’ mask for disabling rays that do not

intersect a node.

slide-16
SLIDE 16

Ray Distributions

Advanced Graphics – Real-time Ray Tracing 16

Coherent Ray Tracing*

SIMD: four rays for the price of one.

BVHNode::Traverse( Ray4 r4, bool4 mask4 ) { bool4 hit4 = r4.Intersects( bounds ) & mask4; if (none( hit4 )) return; if (isleaf()) { IntersectPrimitives(); } else { pool[left].Traverse( r4, hit4 ); pool[left + 1].Traverse( r4, hit4 ); } }

slide-17
SLIDE 17

Ray Distributions

Advanced Graphics – Real-time Ray Tracing 17

Coherent Ray Tracing

Results:

  • for coherent packets, memory traffic is reduced;
  • overall performance is improved by ~2.3x.

Overhead:

  • if only a single ray requires traversal or intersection,

all four rays perform this operation.

slide-18
SLIDE 18

Ray Distributions

Advanced Graphics – Real-time Ray Tracing 18

Large Packets*

Cost of memory access can be amortized over more rays by using larger packets. Note that a naΓ―ve approach will lead to significant overhead. We therefore add a frustum test to rapidly reject BVH nodes: If the packet frustum does not intersect the node AABB, we discard the node. The cost of this operation is independent of the number of rays in the packet. Likewise, a node is traversed as soon as we find that a ray intersects it. This is also independent of packet size.

*: Large Ray Packets for Real-time Whitted Ray Tracing, Overbeck et al., 2008

slide-19
SLIDE 19

Ray Distributions

Advanced Graphics – Real-time Ray Tracing 19

Large Packets

Algorithm:

  • 1. Early hit test: test first active ray against AABB
  • 2. Early miss test: test AABB against frustum
  • 3. Brute force test: test all rays until a hit is

found. This step yields a new first active ray index.

BVHNode::Traverse( RayPacket rp, int first ) { if (!Intersects( rp[first )) // 1 { if (!Intersects( rp.frustum )) return; // 2 FindFirstActive( rp, ++first ); // 3 } if (first < rp.rayCount) { if (isleaf()) { IntersectPrimitives( rp ); } else { left.Traverse( rp, first ); right.Traverse( rp, first ); } } }

slide-20
SLIDE 20

Ray Distributions

Advanced Graphics – Real-time Ray Tracing 20

Large Packets

Details:

  • Constructing the frustum
  • Ray order & overhead
  • First / last
  • Optimizations: recursion, SIMD

BVHNode::Traverse( RayPacket rp, int first ) { if (!Intersects( rp[first )) // 1 { if (!Intersects( rp.frustum )) return; // 2 FindFirstActive( rp, ++first ); // 3 } if (first < rp.rayCount) { if (isleaf()) { IntersectPrimitives( rp ); } else { left.Traverse( rp, first ); right.Traverse( rp, first ); } } }

slide-21
SLIDE 21

Ray Distributions

Advanced Graphics – Real-time Ray Tracing 21

Frustum Construction

Method 1, for primary rays: Planes are easily defined using the corner rays: 𝑂1 = (π‘ž0βˆ’πΉ) Γ— (π‘ž1 βˆ’ π‘ž0) , 𝑒1 = 𝑂1 βˆ™ 𝐹 𝑂2 = (π‘ž1βˆ’πΉ) Γ— (π‘ž2 βˆ’ π‘ž1) , 𝑒2 = 𝑂2 βˆ™ 𝐹 𝑂3 = (π‘ž2βˆ’πΉ) Γ— (π‘ž3 βˆ’ π‘ž2) , 𝑒3 = 𝑂3 βˆ™ 𝐹 𝑂4 = (π‘ž3βˆ’πΉ) Γ— (π‘ž0 βˆ’ π‘ž3) , 𝑒4 = 𝑂4 βˆ™ 𝐹 Note: for secondary rays, we will not have a common origin, nor corner rays. π‘ž0 π‘ž1 π‘ž2 𝐹 π‘ž3

slide-22
SLIDE 22

Ray Distributions

Advanced Graphics – Real-time Ray Tracing 22

Frustum Construction

Method 2, for shadow rays:

  • 1. Determine dominant axis and direction:

𝐸𝑑 = σ𝑗=0

𝑂

𝐸𝑗 , chose axis ΰ·  𝑙 as the largest component of 𝐸𝑑 , ො 𝑣 and ො 𝑀 are the other axes.

  • 2. Construct a plane 𝑄 orthogonal to ΰ· 

𝑙

  • 3. Calculate intersection coordinates 𝑣, 𝑀 of the rays with P
  • 4. Determine π‘£π‘›π‘—π‘œ, 𝑣𝑛𝑏𝑦 and π‘€π‘›π‘—π‘œ, 𝑀𝑛𝑏𝑦
  • 5. Corner rays are now:

π‘£π‘›π‘—π‘œ, π‘€π‘›π‘—π‘œ 𝑣𝑛𝑏𝑦, π‘€π‘›π‘—π‘œ 𝑣𝑛𝑏𝑦, 𝑀𝑛𝑏𝑦 (π‘£π‘›π‘—π‘œ, 𝑀𝑛𝑏𝑦) Note: this still requires a common origin. ΰ·  𝑙 1 ො 𝑣

slide-23
SLIDE 23

Ray Distributions

Advanced Graphics – Real-time Ray Tracing 23

Frustum Construction

Method 3, for generic rays:

  • 1. Construct two planes:

𝑄

𝑔𝑏𝑠, orthogonal to ΰ· 

𝑙, at location 𝑙𝑔𝑏𝑠 which is

  • btained from the scene AABB;

𝑄

π‘œπ‘“π‘π‘ , orthogonal to ΰ· 

𝑙, at location π‘™π‘œπ‘“π‘π‘ , which is obtained from the AABB over the ray origins.

  • 2. Calculate intersection coordinates 𝑣𝑔𝑏𝑠, 𝑀𝑔𝑏𝑠

and π‘£π‘œπ‘“π‘π‘ , π‘€π‘œπ‘“π‘π‘  of the rays with 𝑄

𝑔𝑏𝑠 and 𝑄 π‘œπ‘“π‘π‘  .

  • 3. Determine π‘£π‘›π‘—π‘œ

π‘œπ‘“π‘π‘ , 𝑣𝑛𝑏𝑦 π‘œπ‘“π‘π‘ , π‘€π‘›π‘—π‘œ π‘œπ‘“π‘π‘ , 𝑣𝑛𝑏𝑦 π‘œπ‘“π‘π‘  and π‘£π‘›π‘—π‘œ π‘œπ‘“π‘π‘ , 𝑣𝑛𝑏𝑦 π‘œπ‘“π‘π‘ , π‘€π‘›π‘—π‘œ π‘œπ‘“π‘π‘ , 𝑣𝑛𝑏𝑦 π‘œπ‘“π‘π‘ .

  • 4. Corner rays are now defined as

π‘£π‘›π‘—π‘œ

𝑔𝑏𝑠, π‘€π‘›π‘—π‘œ 𝑔𝑏𝑠 βˆ’ π‘£π‘›π‘—π‘œ π‘œπ‘“π‘π‘ , π‘€π‘›π‘—π‘œ π‘œπ‘“π‘π‘  ,

𝑣𝑛𝑏𝑦

𝑔𝑏𝑠 , π‘€π‘›π‘—π‘œ 𝑔𝑏𝑠 βˆ’ 𝑣𝑛𝑏𝑦 π‘œπ‘“π‘π‘ , π‘€π‘›π‘—π‘œ π‘œπ‘“π‘π‘  ,

𝑣𝑛𝑏𝑦

𝑔𝑏𝑠 , 𝑀𝑛𝑏𝑦 𝑔𝑏𝑠

βˆ’ 𝑣𝑛𝑏𝑦

π‘œπ‘“π‘π‘ , 𝑀𝑛𝑏𝑦 π‘œπ‘“π‘π‘  ,

π‘£π‘›π‘—π‘œ

𝑔𝑏𝑠, 𝑀𝑛𝑏𝑦 𝑔𝑏𝑠

βˆ’ (π‘£π‘›π‘—π‘œ

π‘œπ‘“π‘π‘ , 𝑀𝑛𝑏𝑦 π‘œπ‘“π‘π‘ ).

ΰ·  𝑙 𝑙𝑔𝑏𝑠 π‘™π‘œπ‘“π‘π‘ 

slide-24
SLIDE 24

Ray Distributions

Advanced Graphics – Real-time Ray Tracing 24

Ray Order

The order of the rays in a packet is important. We keep track of the first active ray: in this case the green dot. We thus enter the node with 61 rays, while only 12 rays actually intersect the node. Keeping track of the last ray helps somewhat. 7 8 63

slide-25
SLIDE 25

Ray Distributions

Advanced Graphics – Real-time Ray Tracing 25

Ray Order

Overhead can be reduced by numbering rays in each quadrant sequentially.

15 16 31 32 63

slide-26
SLIDE 26

Ray Distributions

Advanced Graphics – Real-time Ray Tracing 26

Ray Order

Overhead can be reduced by numbering rays in each quadrant sequentially. For the general case, Morton order is optimal.

slide-27
SLIDE 27

Ray Distributions

Advanced Graphics – Real-time Ray Tracing 27

Divergent Rays: Partition Traversal

int PartitionRays for ( int i = 0; i < 𝑗𝑏; i++ ) if (ray[idx[i]].IntersectsAABB()) swap( idx[𝑗𝑓++], idx[i] ); return 𝑗𝑓; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

rays ray indices 𝑗𝑏 𝑗𝑓

2 1 3 4 5 6 7 8 9 10 11 12 13 14 15

𝑗𝑓

slide-28
SLIDE 28

Ray Distributions

Advanced Graphics – Real-time Ray Tracing 28

Divergent Rays: Partition Traversal

int PartitionRays for ( int i = 0; i < 𝑗𝑏; i++ ) if (ray[idx[i]].IntersectsAABB()) swap( idx[𝑗𝑓++], idx[i] ); return 𝑗𝑓; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

rays ray indices 𝑗𝑏 𝑗𝑓

2 5 3 4 1 6 7 8 9 10 11 12 13 14 15

𝑗𝑓

slide-29
SLIDE 29

Ray Distributions

Advanced Graphics – Real-time Ray Tracing 29

Divergent Rays: Partition Traversal

int PartitionRays for ( int i = 0; i < 𝑗𝑏; i++ ) if (ray[idx[i]].IntersectsAABB()) swap( idx[𝑗𝑓++], idx[i] ); return 𝑗𝑓; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

rays ray indices 𝑗𝑏 𝑗𝑓

2 5 6 3 4 1 7 8 9 10 11 12 13 14 15

𝑗𝑓

slide-30
SLIDE 30

Ray Distributions

Advanced Graphics – Real-time Ray Tracing 30

Divergent Rays: Partition Traversal

int PartitionRays for ( int i = 0; i < 𝑗𝑏; i++ ) if (ray[idx[i]].IntersectsAABB()) swap( idx[𝑗𝑓++], idx[i] ); return 𝑗𝑓; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

rays ray indices 𝑗𝑏 𝑗𝑓

2 5 6 9 4 1 7 8 3 10 11 12 13 14 15

𝑗𝑓

slide-31
SLIDE 31

Ray Distributions

Advanced Graphics – Real-time Ray Tracing 31

Divergent Rays: Partition Traversal

int PartitionRays for ( int i = 0; i < 𝑗𝑏; i++ ) if (ray[idx[i]].IntersectsAABB()) swap( idx[𝑗𝑓++], idx[i] ); return 𝑗𝑓; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

rays ray indices 𝑗𝑏 𝑗𝑓

2 5 6 9 11 1 7 8 3 10 4 12 13 14 15

𝑗𝑓

slide-32
SLIDE 32

Ray Distributions

Advanced Graphics – Real-time Ray Tracing 32

Divergent Rays: Partition Traversal Partition traversal gathers active rays in a continuous list. This comes at the price of some overhead:

  • ne layer of indirection (ray indices  rays);
  • swapping of indices.

In practice, this method is suitable for ray distributions where large gaps in the ray set are to be expected.

slide-33
SLIDE 33

Ray Distributions

Advanced Graphics – Real-time Ray Tracing 33

Optimization: Recursion

The recursion can be replaced by a local stack:

struct Stack { BVHNode* node; int first; }; Stack stack[STACKSIZE]; stack[0].node = GetBVHRoot(); stack[0].first = 0; int stackPtr = 1; while( stackPtr > 0) { BVHNode* node = stack[--stackPtr].node; first = stack[stackPtr].first; ... }

BVHNode::Traverse( RayPacket rp, int first ) { if (!Intersects( rp[first )) // 1 { if (!Intersects( rp.frustum )) return; // 2 FindFirstActive( rp, ++first ); // 3 } if (first < rp.rayCount) { if (isleaf()) { IntersectPrimitives( rp ); } else { left.Traverse( rp, first ); right.Traverse( rp, first ); } } }

slide-34
SLIDE 34

Ray Distributions

Advanced Graphics – Real-time Ray Tracing 34

Optimization: SIMD

We can still use SIMD to test four rays at once.

  • The smallest primitive thus becomes the β€˜QuadRay’;
  • a packet of 𝑂 rays consists of 𝑂/4 QuadRays;
  • β€˜first’ points to the first QuadRay that has at least one active ray;
  • FindFirst processes the remaining rays four at a time.

Note: for AVX, replace β€˜four’ by β€˜eight’.

slide-35
SLIDE 35

Ray Distributions

Advanced Graphics – Real-time Ray Tracing 35

Results

Compared to 2x2 SIMD packet traversal, ranged traversal improves primary and shadow rays by ~3.5x. Note that ray divergence has a large impact on performance. 1 16.85 (100%) 25.11 (100%) 18.44 (100%) 2 11.61 (69%) 18.83 (75%) 12.93 (70%) 3 6.98 (41%) 12.56 (50%) 7.48 (41%) 4 3.85 (23%) 7.71 (31%) 3.87 (21%)

slide-36
SLIDE 36

Today’s Agenda:

  • Introduction
  • Ray Distributions
  • The Top-level BVH
  • Real-time Ray Tracing
  • Assignment 2
slide-37
SLIDE 37

Top-level BVH

Advanced Graphics – Real-time Ray Tracing 37

Ray Tracing Animated Scenes

Covered so far:

  • Static geometry: high-quality construction with spatial splits
  • Deformations: BVH refitting (water, waving trees, … )
  • Structural changes: binned BVH construction

Not covered:

  • Rigid motion
slide-38
SLIDE 38

Top-level BVH

Advanced Graphics – Real-time Ray Tracing 38

slide-39
SLIDE 39

Top-level BVH

Advanced Graphics – Real-time Ray Tracing 39

slide-40
SLIDE 40

Top-level BVH

Advanced Graphics – Real-time Ray Tracing 40

slide-41
SLIDE 41

Top-level BVH

Advanced Graphics – Real-time Ray Tracing 41

Combining BVHs

slide-42
SLIDE 42

Top-level BVH

Advanced Graphics – Real-time Ray Tracing 42

Combining BVHs

Two BVHs can be combined into a single BVH, by simply adding a new root node pointing to the two BVHs.

  • This works regardless of the method used to build each BVH
  • This can be applied repeatedly to combine many BVHs
slide-43
SLIDE 43

Advanced Graphics – Real-time Ray Tracing 43

Scene Graph

slide-44
SLIDE 44

Top-level BVH

Advanced Graphics – Real-time Ray Tracing 44

Scene Graph

world car wheel wheel wheel wheel turret plane plane car wheel wheel wheel wheel turret buggy wheel wheel wheel wheel dude dude dude

slide-45
SLIDE 45

Top-level BVH

Advanced Graphics – Real-time Ray Tracing 45

Scene Graph

If our application uses a scene graph, we can construct a BVH for each scene graph node. The BVH for each node is built using an appropriate construction algorithm:

  • High-quality SBVH for static scenery (offline)
  • Fast binned SAH BVHs for dynamic scenery

The extra nodes used to combine these BVHs into a single BVH are known as the Top-level BVH .

slide-46
SLIDE 46

Top-level BVH

Advanced Graphics – Real-time Ray Tracing 46

Rigid Motion

Applying rigid motion to a BVH:

  • 1. Refit the top-level BVH
  • 2. Refit the affected BVH
slide-47
SLIDE 47

Top-level BVH

Advanced Graphics – Real-time Ray Tracing 47

Rigid Motion

Applying rigid motion to a BVH:

  • 1. Refit the top-level BVH
  • 2. Refit the affected BVH
  • r:
  • 2. Transform the ray, not the node

Rigid motion is achieved by transforming the rays by the inverse transform upon entering the sub-BVH.

(this obviously does not only apply to translation)

slide-48
SLIDE 48

Top-level BVH

Advanced Graphics – Real-time Ray Tracing 48

The Top-level BVH - Construction

Input: list of axis aligned bounding boxes for transformed scene graph nodes Algorithm:

  • 1. Find the two elements in the list for which the AABB has the smallest

surface area

  • 2. Create a parent node for these elements
  • 3. Replace the two elements in the list by the parent node
  • 4. Repeat until one element remains in the list.

Note: algorithmic complexity is 𝑃(𝑂3).

slide-49
SLIDE 49

Top-level BVH

Advanced Graphics – Real-time Ray Tracing 49

The Top-level BVH – Faster Construction*

Algorithm:

Node A = list.GetFirst(); Node B = list.FindBestMatch( A ); while (list.size() > 1) { Node C = list.FindBestMatch( B ); if (A == C) { list.Remove( A ); list.Remove( B ); A = new Node( A, B ); list.Add( A ); B = list.FindBestMatch( A ); } else A = B, B = C; }

*: Fast Agglomerative Clustering for Rendering, Walter et al., 2008

A B C A B A B

slide-50
SLIDE 50

Top-level BVH

Advanced Graphics – Real-time Ray Tracing 50

The Top-level BVH – Traversal

The leafs of the top-level BVH contain the sub-BVHs. When a ray intersects such a leaf, it is transformed by the inverted transform matrix of the sub-BVH. After this, it traverses the sub-BVH. Once the sub-BVH has been traversed, we transform the ray again, this time by the transform matrix of the sub-BVH. For efficiency, we store the inverted matrix with the sub-BVH root.

slide-51
SLIDE 51

Top-level BVH

Advanced Graphics – Real-time Ray Tracing 51

slide-52
SLIDE 52

Top-level BVH

Advanced Graphics – Real-time Ray Tracing 52

The Top-level BVH – Summary

The top-level BVH enables complex animated scenes:

  • for static objects, it contains high-quality sub-BVHs;
  • for objects undergoing rigid motion, it also contains high-quality

sub-BVHs, with a transform matrix and its inverse;

  • for deforming objects, it contains sub-BVHs that can be refitted;
  • for arbitrary animations, it contains lower quality sub-BVHs.

Combined, this allows for efficient maintenance of a global BVH.

slide-53
SLIDE 53

Today’s Agenda:

  • Introduction
  • Ray Distributions
  • The Top-level BVH
  • Real-time Ray Tracing
  • Assignment 2
slide-54
SLIDE 54

Real-time

Advanced Graphics – Real-time Ray Tracing 54

The Quest for Real-time Ray Tracing

Tracing primary, shadow and reflection rays using packets: cores mrays/s mrays/s mrays/s 1 35 37 38 2 70 74 75 6 211 221 225

(Intel Xeon, 3.4Ghz)

1024x768 @ 30Hz: 9.3 rays per pixel.

slide-55
SLIDE 55

Today’s Agenda:

  • Introduction
  • Ray Distributions
  • The Top-level BVH
  • Real-time Ray Tracing
  • Assignment 2
slide-56
SLIDE 56

Assignment 2

Advanced Graphics – Real-time Ray Tracing 56

BVH Construction

Assignment 2: add an acceleration structure to your framework.

  • Recommended: BVH
  • Also good: kD-tree
  • Other options exist, talk to me if you want to explore.

Good BVHs:

  • Surface Area Heuristic
  • Spatial Splits
  • …

Traversal:

  • Single ray
  • Packets
slide-57
SLIDE 57

Assignment 2

Advanced Graphics – Real-time Ray Tracing 57

BVH Construction

Programming Language

  • C/C++ and C# work
  • But JAVA is also allowed

Deadline: Thursday December 28, 23:59 Use the Submit system. Deliverables:

  • Project
  • Small report
slide-58
SLIDE 58

Assignment 2

Advanced Graphics – Real-time Ray Tracing 58

BVH Construction

How to get a passing grade:

  • Implement a BVH, using the SAH
  • Implement single ray traversal
  • Achieve decent performance

How to score an 8:

  • Implement spatial splits
  • Build a BVH for dynamic scenes with a top-level BVH
  • Implement packet traversal for primary and secondary rays

How to score a 10: Pick more than one advanced topic.

slide-59
SLIDE 59

Today’s Agenda:

  • Introduction
  • Ray Distributions
  • The Top-level BVH
  • Real-time Ray Tracing
  • Assignment 2
slide-60
SLIDE 60

INFOMAGR – Advanced Graphics

Jacco Bikker - November 2017 - February 2018

END of β€œReal-time Ray Tracing”

next lecture: β€œSIMD recap”