Raycasting AABBs Directly

?

?

W, K, P / S, J, N Jump to previous / next marker

t / T Toggle theatre / SUPERtheatre mode

z Toggle filter mode V Revert filter to original state

X, ShiftSpace Toggle category and focus previous

v Invert topics / media as per focus

# Keyboard Navigation

## Global Keys

[, < / ], > Jump to previous / next episodeW, K, P / S, J, N Jump to previous / next marker

t / T Toggle theatre / SUPERtheatre mode

z Toggle filter mode V Revert filter to original state

## Menu toggling

q Quotes r References f Filter c Credits## In-Menu Movement

a

w

s

s

d

h
j
k
l

←

↑

↓

↓

→

## Quotes and References Menus

Enter Jump to timecode## Quotes, References and Credits Menus

o Open URL (in new tab)## Filter Menu

x, Space Toggle category and focus nextX, ShiftSpace Toggle category and focus previous

v Invert topics / media as per focus

## Credits Menu

Enter Open URL (in new tab)⏫

Previous: 'Passing Lighting as Boxes'

⏫

0:01Recap and set the stage for the day

🗩

0:01Recap and set the stage for the day

🗩

0:01Recap and set the stage for the day

🗩

0:53Run the game with the determination to raycast lighting boxes directly

🏃

0:53Run the game with the determination to raycast lighting boxes directly

🏃

0:53Run the game with the determination to raycast lighting boxes directly

🏃

3:07Move the Surface computations from LightingTest() into RayCast()

3:07Move the Surface computations from LightingTest() into RayCast()

3:07Move the Surface computations from LightingTest() into RayCast()

6:30Replace HitSurface in AccumulateSample() and RayCast() with a lighting_box

6:30Replace HitSurface in AccumulateSample() and RayCast() with a lighting_box

6:30Replace HitSurface in AccumulateSample() and RayCast() with a lighting_box

16:10Run the game to see our slow lighting solution, and determine to investigate the slowness

🏃

16:10Run the game to see our slow lighting solution, and determine to investigate the slowness

🏃

16:10Run the game to see our slow lighting solution, and determine to investigate the slowness

🏃

18:01Add a TIMED_FUNCTION in RayCast()

18:01Add a TIMED_FUNCTION in RayCast()

18:01Add a TIMED_FUNCTION in RayCast()

18:22Run the game and consult the profiler to see that RayCast() is our most costly function

🏃

18:22Run the game and consult the profiler to see that RayCast() is our most costly function

🏃

18:22Run the game and consult the profiler to see that RayCast() is our most costly function

🏃

19:48Check the day

^{1}^{,2}🗹

19:48Check the day

^{1}^{,2}🗹

19:48Check the day

^{1}^{,2}🗹

20:30Raycasting Against AABB

🖌

20:30Raycasting Against AABB

🖌

20:30Raycasting Against AABB

🖌

24:14Relieve RayCast() of testing RaySourceN for every surface

24:14Relieve RayCast() of testing RaySourceN for every surface

24:14Relieve RayCast() of testing RaySourceN for every surface

29:17Run the game to see that we halved the cost of RayCast()

🏃

29:17Run the game to see that we halved the cost of RayCast()

🏃

29:17Run the game to see that we halved the cost of RayCast()

🏃

29:56Relieve RayCast() of using redundant data

29:56Relieve RayCast() of using redundant data

29:56Relieve RayCast() of using redundant data

32:26Run the game to see that that didn't speed it up

🏃

32:26Run the game to see that that didn't speed it up

🏃

32:26Run the game to see that that didn't speed it up

🏃

32:34Make RayCast() perform inline the functionality of GetBoxSurface()

32:34Make RayCast() perform inline the functionality of GetBoxSurface()

32:34Make RayCast() perform inline the functionality of GetBoxSurface()

34:25Run the game to see that that halved the cost of RayCast()

🏃

34:25Run the game to see that that halved the cost of RayCast()

🏃

34:25Run the game to see that that halved the cost of RayCast()

🏃

35:00Relieve RayCast() of performing redundant work originally necessitated by GetBoxSurface()

35:00Relieve RayCast() of performing redundant work originally necessitated by GetBoxSurface()

35:00Relieve RayCast() of performing redundant work originally necessitated by GetBoxSurface()

38:52Run the game to see that the lighting is busted

^{α}🏃

38:52Run the game to see that the lighting is busted

^{α}🏃

38:52Run the game to see that the lighting is busted

^{α}🏃

39:22Reenable RayCast() to actually compute all the lighting

39:22Reenable RayCast() to actually compute all the lighting

39:22Reenable RayCast() to actually compute all the lighting

42:05Run the game to see that our lighting is back

🏃

42:05Run the game to see that our lighting is back

🏃

42:05Run the game to see that our lighting is back

🏃

42:38Optimise the Normal value out of RayCast() and introduce a Sign value

42:38Optimise the Normal value out of RayCast() and introduce a Sign value

42:38Optimise the Normal value out of RayCast() and introduce a Sign value

50:30Run the game to see that we're a little faster

🏃

50:30Run the game to see that we're a little faster

🏃

50:30Run the game to see that we're a little faster

🏃

50:34Optimise the SignX value out of RayCast()

50:34Optimise the SignX value out of RayCast()

50:34Optimise the SignX value out of RayCast()

53:22Optimise the HalfWidth and HalfHeight values out of RayCast()

53:22Optimise the HalfWidth and HalfHeight values out of RayCast()

53:22Optimise the HalfWidth and HalfHeight values out of RayCast()

54:21Optimise the Width and Height inner product computations out of RayCast()

54:21Optimise the Width and Height inner product computations out of RayCast()

54:21Optimise the Width and Height inner product computations out of RayCast()

58:39Run the game to see that we are down below 60ms

🏃

58:39Run the game to see that we are down below 60ms

🏃

58:39Run the game to see that we are down below 60ms

🏃

58:55Change RelOrigin to be relative to the MinCorner in RayCast()

58:55Change RelOrigin to be relative to the MinCorner in RayCast()

58:55Change RelOrigin to be relative to the MinCorner in RayCast()

1:03:16Run the game to see that the lighting is different and investigate why

🏃

1:03:16Run the game to see that the lighting is different and investigate why

🏃

1:03:16Run the game to see that the lighting is different and investigate why

🏃

1:04:39Revert that RelOrigin change

1:04:39Revert that RelOrigin change

1:04:39Revert that RelOrigin change

1:05:11Determining the ray intersection point more efficiently

🖌

1:05:11Determining the ray intersection point more efficiently

🖌

1:05:11Determining the ray intersection point more efficiently

🖌

1:06:53Try again to make RayCast() use the HalfWidth and HalfHeight instead of Width and Height

1:06:53Try again to make RayCast() use the HalfWidth and HalfHeight instead of Width and Height

1:06:53Try again to make RayCast() use the HalfWidth and HalfHeight instead of Width and Height

1:07:25Run the game to see that the lighting is wrong again

🏃

1:07:25Run the game to see that the lighting is wrong again

🏃

1:07:25Run the game to see that the lighting is wrong again

🏃

1:08:09Make RayCast() correctly compute the Width and Height

1:08:09Make RayCast() correctly compute the Width and Height

1:08:09Make RayCast() correctly compute the Width and Height

1:08:40Run the game to see that the lighting remains correct

🏃

1:08:40Run the game to see that the lighting remains correct

🏃

1:08:40Run the game to see that the lighting remains correct

🏃

1:08:43Consider storing the Span and P in the Box

🗩

1:08:43Consider storing the Span and P in the Box

🗩

1:08:43Consider storing the Span and P in the Box

🗩

1:09:17Run the game to see that we are at 52ms

🏃

1:09:17Run the game to see that we are at 52ms

🏃

1:09:17Run the game to see that we are at 52ms

🏃

1:09:37Toggle off the snake in PlayWorld()

1:09:37Toggle off the snake in PlayWorld()

1:09:37Toggle off the snake in PlayWorld()

1:09:54Run the game to see that we are at 26ms

🏃

1:09:54Run the game to see that we are at 26ms

🏃

1:09:54Run the game to see that we are at 26ms

🏃

1:10:07Relieve RayCast() of doing an extra comparison of XCheck and YCheck with Width and Height respectively

1:10:07Relieve RayCast() of doing an extra comparison of XCheck and YCheck with Width and Height respectively

1:10:30Run the game to see that we are about the same

🏃

1:10:30Run the game to see that we are about the same

🏃

1:10:30Run the game to see that we are about the same

🏃

1:10:46Add P and Radius to lighting_box for RayCast(), GetBoxSurface() and PushCube() to use

1:10:46Add P and Radius to lighting_box for RayCast(), GetBoxSurface() and PushCube() to use

1:10:46Add P and Radius to lighting_box for RayCast(), GetBoxSurface() and PushCube() to use

1:21:54Run the game to see black lighting

🏃

1:21:54Run the game to see black lighting

🏃

1:21:54Run the game to see black lighting

🏃

1:23:16Step in to GetBoxSurface() and inspect its values

🏃

1:23:16Step in to GetBoxSurface() and inspect its values

🏃

1:23:16Step in to GetBoxSurface() and inspect its values

🏃

1:25:34Make PushCube() correctly set the P and Radius

1:25:34Make PushCube() correctly set the P and Radius

1:25:34Make PushCube() correctly set the P and Radius

1:26:24Run the game to see that the lighting is better

🏃

1:26:24Run the game to see that the lighting is better

🏃

1:26:24Run the game to see that the lighting is better

🏃

1:27:13Toggle back on the snake in PlayWorld()

1:27:13Toggle back on the snake in PlayWorld()

1:27:13Toggle back on the snake in PlayWorld()

1:27:24Run the game to see that we're at 47ms

🏃

1:27:24Run the game to see that we're at 47ms

🏃

1:27:24Run the game to see that we're at 47ms

🏃

1:28:43Toggle off the TIMED_FUNCTION in RayCast()

1:28:43Toggle off the TIMED_FUNCTION in RayCast()

1:28:43Toggle off the TIMED_FUNCTION in RayCast()

1:28:52Run the game to see that we are below 40ms

🏃

1:28:52Run the game to see that we are below 40ms

🏃

1:28:52Run the game to see that we are below 40ms

🏃

1:29:14Try to unroll the Axis loop in RayCast()

1:29:14Try to unroll the Axis loop in RayCast()

1:29:14Try to unroll the Axis loop in RayCast()

1:33:08Run the game to see that we are below 30ms

🏃

1:33:08Run the game to see that we are below 30ms

🏃

1:33:08Run the game to see that we are below 30ms

🏃

1:33:50Further compress the Axis "cases" in RayCast()

1:33:50Further compress the Axis "cases" in RayCast()

1:33:50Further compress the Axis "cases" in RayCast()

1:37:28Run the game to see that we remain below 30ms

🏃

1:37:28Run the game to see that we remain below 30ms

🏃

1:37:28Run the game to see that we remain below 30ms

🏃

1:37:38Relieve RayCast() of multiplying the Sign in to RaySourceN and d

1:37:38Relieve RayCast() of multiplying the Sign in to RaySourceN and d

1:37:38Relieve RayCast() of multiplying the Sign in to RaySourceN and d

1:38:53Run the game to see that we remain below 30ms

🏃

1:38:53Run the game to see that we remain below 30ms

🏃

1:38:53Run the game to see that we remain below 30ms

🏃

1:39:21Consider removing the Sign computation from RayCast()

🗩

1:39:21Consider removing the Sign computation from RayCast()

🗩

1:39:21Consider removing the Sign computation from RayCast()

🗩

1:41:13Switch back to the looped version of RayCast() and relive that of multiplying the Sign in to the RaySourceN and d

1:41:13Switch back to the looped version of RayCast() and relive that of multiplying the Sign in to the RaySourceN and d

1:42:04Run the game

🏃

1:42:04Run the game

🏃

1:42:04Run the game

🏃

1:42:16Q&A

🗩

1:42:16Q&A

🗩

1:42:16Q&A

🗩

1:51:54Wrap it up

🗩

1:51:54Wrap it up

🗩

1:51:54Wrap it up

🗩

⏬

Next: 'Modifying Lighting to Use a Spatial Hierarchy'

⏬