Replacing the Pseudo-random Number Generator

?

?# Keyboard Navigation

## Global Keys

[, < / ], > Jump to previous / next episode

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

t / T Toggle theatre / SUPERtheatre mode

V Revert filter to original state Y Select link (requires manual Ctrl-c)## Menu toggling

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

## 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 next

X, ShiftSpace Toggle category and focus previous

v Invert topics / media as per focus## Filter and Link Menus

z Toggle filter / linking mode
## Credits Menu

Enter Open URL (in new tab)

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

t / T Toggle theatre / SUPERtheatre mode

V Revert filter to original state Y Select link (requires manual Ctrl-c)

a

w

s

s

d

h
j
k
l

←

↑

↓

↓

→

X, ShiftSpace Toggle category and focus previous

v Invert topics / media as per focus

⏫

Previous: 'Optimizing Ray vs. AABB Intersections'

⏫

0:01Recap and set the stage for the day investigating the variance (flicker) in the lighting

🏃

0:01Recap and set the stage for the day investigating the variance (flicker) in the lighting

🏃

0:01Recap and set the stage for the day investigating the variance (flicker) in the lighting

🏃

4:15Read through and describe our usage of photons per second in the lighting code

📖

4:15Read through and describe our usage of photons per second in the lighting code

📖

4:15Read through and describe our usage of photons per second in the lighting code

📖

8:28Make ComputeLightPropagation() consider the approximate location of the moon (i.e. directly up in Z) when applying its colour

8:28Make ComputeLightPropagation() consider the approximate location of the moon (i.e. directly up in Z) when applying its colour

9:27Run the game to see that underside surfaces are black

🏃

9:27Run the game to see that underside surfaces are black

🏃

9:27Run the game to see that underside surfaces are black

🏃

10:10Temporarily increase the MoonColor brightness in ComputeLightPropagation()

10:10Temporarily increase the MoonColor brightness in ComputeLightPropagation()

10:10Temporarily increase the MoonColor brightness in ComputeLightPropagation()

10:19See that brighter moon and admire the character of the scene

🏃

10:19See that brighter moon and admire the character of the scene

🏃

10:19See that brighter moon and admire the character of the scene

🏃

12:42Remove the SkyColor, GroundColor and SunDirection from ComputeLightPropagation()

12:42Remove the SkyColor, GroundColor and SunDirection from ComputeLightPropagation()

12:42Remove the SkyColor, GroundColor and SunDirection from ComputeLightPropagation()

13:06Transferring light as photons per second

🖌

13:06Transferring light as photons per second

🖌

13:06Transferring light as photons per second

🖌

16:02Complete sample, if sampling every single photon hit by an infinite number of rays

🖌

16:02Complete sample, if sampling every single photon hit by an infinite number of rays

🖌

16:02Complete sample, if sampling every single photon hit by an infinite number of rays

🖌

19:39Our actual sample, casting 64 rays with temporal antialiasing filtering, and questions to consider

🖌

19:39Our actual sample, casting 64 rays with temporal antialiasing filtering, and questions to consider

🖌

🖌

30:31Consider explicitly accumulating all lighting points and only averaging at the end

📖

30:31Consider explicitly accumulating all lighting points and only averaging at the end

📖

30:31Consider explicitly accumulating all lighting points and only averaging at the end

📖

33:12Rename Emit to LastPPS and Direction to LastDirection, and add SampleCount in lighting_point_state, to enable ComputeLightPropagation() to accumulate all lighting points directly without doing temporal blending?

33:12Rename Emit to LastPPS and Direction to LastDirection, and add SampleCount in lighting_point_state, to enable ComputeLightPropagation() to accumulate all lighting points directly without doing temporal blending?

39:02Run the game to see a totally stable lighting solution

🏃

39:02Run the game to see a totally stable lighting solution

🏃

39:02Run the game to see a totally stable lighting solution

🏃

40:42Introduce the notion of a fixed LIGHT_TEST_ACCUMULATION_COUNT, to make the light converge over this many iterations of the lighting routine

40:42Introduce the notion of a fixed LIGHT_TEST_ACCUMULATION_COUNT, to make the light converge over this many iterations of the lighting routine

48:38Add a key to toggle the converging lighting accumulation in UpdateAndRenderWorld()

48:38Add a key to toggle the converging lighting accumulation in UpdateAndRenderWorld()

48:38Add a key to toggle the converging lighting accumulation in UpdateAndRenderWorld()

49:27Run the game and try toggling the lighting accumulation

🏃

49:27Run the game and try toggling the lighting accumulation

🏃

49:27Run the game and try toggling the lighting accumulation

🏃

49:45Enable LightingTest() to map the lighting points back

49:45Enable LightingTest() to map the lighting points back

49:45Enable LightingTest() to map the lighting points back

51:37Run the game to try toggling the lighting convergence

🏃

51:37Run the game to try toggling the lighting convergence

🏃

51:37Run the game to try toggling the lighting convergence

🏃

52:26Make LightingTest() cap the AccumulationCount

52:26Make LightingTest() cap the AccumulationCount

52:26Make LightingTest() cap the AccumulationCount

53:03Run the game to see our "converged" lighting getting brighter, and investigate why

🏃

53:03Run the game to see our "converged" lighting getting brighter, and investigate why

🏃

53:03Run the game to see our "converged" lighting getting brighter, and investigate why

🏃

55:23Correctly make LightingTest() cap the AccumulationCount

55:23Correctly make LightingTest() cap the AccumulationCount

55:23Correctly make LightingTest() cap the AccumulationCount

55:36Run the game and admire our converged lighting solution

🏃

55:36Run the game and admire our converged lighting solution

🏃

55:36Run the game and admire our converged lighting solution

🏃

56:42Toggle the lighting accumulation and consider how to address the oscillation

🏃

56:42Toggle the lighting accumulation and consider how to address the oscillation

🏃

56:42Toggle the lighting accumulation and consider how to address the oscillation

🏃

59:52Increase LIGHT_TEST_ACCUMULATION_COUNT from 256 to 1024

59:52Increase LIGHT_TEST_ACCUMULATION_COUNT from 256 to 1024

59:52Increase LIGHT_TEST_ACCUMULATION_COUNT from 256 to 1024

1:00:03Consider working on the hemisphere sampling

🏃

1:00:03Consider working on the hemisphere sampling

🏃

1:00:03Consider working on the hemisphere sampling

🏃

1:02:15Add debug visualisation of the rays in LightingTest()

1:02:15Add debug visualisation of the rays in LightingTest()

1:02:15Add debug visualisation of the rays in LightingTest()

1:06:43Run the game and check out the debug visualisation of our rays, to see that there is some clumping

🏃

1:06:43Run the game and check out the debug visualisation of our rays, to see that there is some clumping

🏃

🏃

1:07:42Determine to improve the random number generation^{1}^{,2}

📖

1:07:42Determine to improve the random number generation^{1}^{,2}

📖

1:07:42Determine to improve the random number generation^{1}^{,2}

📖

1:12:33Recommend Melissa O'Neill's^{3} PCG^{4}

📖

1:12:33Recommend Melissa O'Neill's^{3} PCG^{4}

📖

1:12:33Recommend Melissa O'Neill's^{3} PCG^{4}

📖

1:16:59Consider the difficulty of performing PCG in SIMD, due to the absence of lane shifting until AVX-512^{5}

📖

1:16:59Consider the difficulty of performing PCG in SIMD, due to the absence of lane shifting until AVX-512^{5}

📖

📖

1:21:39Switch RandomNextUInt32() to perform xorshift

1:21:39Switch RandomNextUInt32() to perform xorshift

1:21:39Switch RandomNextUInt32() to perform xorshift

1:23:19Run the game to see an unexpected distribution

🏃

1:23:19Run the game to see an unexpected distribution

🏃

1:23:19Run the game to see an unexpected distribution

🏃

1:23:47Make RandomUnilateral() produce up to U32Max points of randomness

1:23:47Make RandomUnilateral() produce up to U32Max points of randomness

1:23:47Make RandomUnilateral() produce up to U32Max points of randomness

1:24:45Run the game to see a more expected, if still slightly clumpy, distribution

🏃

1:24:45Run the game to see a more expected, if still slightly clumpy, distribution

🏃

1:24:45Run the game to see a more expected, if still slightly clumpy, distribution

🏃

1:26:46Excise the old random number table in favour of xorshift

1:26:46Excise the old random number table in favour of xorshift

1:26:46Excise the old random number table in favour of xorshift

1:27:15Take another look at the random distribution

🏃

1:27:15Take another look at the random distribution

🏃

1:27:15Take another look at the random distribution

🏃

1:27:43LightingTest()

1:27:43LightingTest()

1:27:43LightingTest()

1:29:07Weighted sampling

🖌

1:29:07Weighted sampling

🖌

1:29:07Weighted sampling

🖌

1:30:36Start to make LightingTest() perform an inverse square-root mapping

1:30:36Start to make LightingTest() perform an inverse square-root mapping

1:30:36Start to make LightingTest() perform an inverse square-root mapping

1:31:39Run the game to see a more upward-facing distribution

🏃

1:31:39Run the game to see a more upward-facing distribution

🏃

1:31:39Run the game to see a more upward-facing distribution

🏃

1:31:59Continue to work on the upward-facing sampling equation in LightingTest()

1:31:59Continue to work on the upward-facing sampling equation in LightingTest()

1:31:59Continue to work on the upward-facing sampling equation in LightingTest()

1:33:58Upward-biased sampling equation

🖌

1:33:58Upward-biased sampling equation

🖌

1:33:58Upward-biased sampling equation

🖌

1:34:26Fix the sampling equation in LightingTest()

1:34:26Fix the sampling equation in LightingTest()

1:34:26Fix the sampling equation in LightingTest()

1:34:42Run the game to see a more fully distributed upward-facing distribution

🏃

1:34:42Run the game to see a more fully distributed upward-facing distribution

🏃

1:34:42Run the game to see a more fully distributed upward-facing distribution

🏃

1:35:39Enable the rays to be randomly cast over time

1:35:39Enable the rays to be randomly cast over time

1:35:39Enable the rays to be randomly cast over time

1:36:58Run the game to see our randomly cast rays

🏃

1:36:58Run the game to see our randomly cast rays

🏃

1:36:58Run the game to see our randomly cast rays

🏃

1:37:22Switch our random number generator to operate in SIMD by default, introducing f32_4x versions of << and >>

1:37:22Switch our random number generator to operate in SIMD by default, introducing f32_4x versions of << and >>

1:43:11Arithmetic vs logical shifting

🗩

1:43:11Arithmetic vs logical shifting

🗩

1:43:11Arithmetic vs logical shifting

🗩

1:45:43Introduce ShiftRight4X() and ShiftLeft4X() in lieu of f32_4x shift operators^{6}

1:45:43Introduce ShiftRight4X() and ShiftLeft4X() in lieu of f32_4x shift operators^{6}

1:45:43Introduce ShiftRight4X() and ShiftLeft4X() in lieu of f32_4x shift operators^{6}

1:53:59Step through RandomNextU324X() to watch what it does

🏃

1:53:59Step through RandomNextU324X() to watch what it does

🏃

1:53:59Step through RandomNextU324X() to watch what it does

🏃

1:58:18Make RandomNextU324X() perform ShiftLeft4X() inline

1:58:18Make RandomNextU324X() perform ShiftLeft4X() inline

1:58:18Make RandomNextU324X() perform ShiftLeft4X() inline

2:00:07Step in to RandomNextU324X() and inspect its values

🏃

2:00:07Step in to RandomNextU324X() and inspect its values

🏃

2:00:07Step in to RandomNextU324X() and inspect its values

🏃

2:00:47Owl of Shame Moment: It wasn't doing a lane-based shift^{7}

🦉

🗩

2:00:47Owl of Shame Moment: It wasn't doing a lane-based shift^{7}

🦉

🗩

2:00:47Owl of Shame Moment: It wasn't doing a lane-based shift^{7}

🦉

🗩

2:01:50Make ShiftRight4X() and ShiftLeft4X() use _mm_srli_epi32 and _mm_slli_epi32 respectively

🦉

🖮

2:01:50Make ShiftRight4X() and ShiftLeft4X() use _mm_srli_epi32 and _mm_slli_epi32 respectively

🦉

🖮

2:01:50Make ShiftRight4X() and ShiftLeft4X() use _mm_srli_epi32 and _mm_slli_epi32 respectively

🦉

🖮

2:02:37Step back through RandomNextU324X() to see that its values look reasonable

🏃

🦉

2:02:37Step back through RandomNextU324X() to see that its values look reasonable

🏃

🦉

2:02:37Step back through RandomNextU324X() to see that its values look reasonable

🏃

🦉

2:03:35Run the game to see our ray distribution, with unexpectedly flicker-free lighting

🏃

🦉

2:03:35Run the game to see our ray distribution, with unexpectedly flicker-free lighting

🏃

🦉

2:03:35Run the game to see our ray distribution, with unexpectedly flicker-free lighting

🏃

🦉

2:06:11Make U32_4x() pick the correct slice for RandomSeed()

🦉

🖮

2:06:11Make U32_4x() pick the correct slice for RandomSeed()

🦉

🖮

2:06:11Make U32_4x() pick the correct slice for RandomSeed()

🦉

🖮

2:07:11Run the game to see our flicker back

🏃

🦉

2:07:11Run the game to see our flicker back

🏃

🦉

2:07:11Run the game to see our flicker back

🏃

🦉

2:08:43Switch all our _mm_set*() calls to be _mm_setr*()

🦉

🖮

2:08:43Switch all our _mm_set*() calls to be _mm_setr*()

🦉

🖮

2:08:43Switch all our _mm_set*() calls to be _mm_setr*()

🦉

🖮

2:09:19Run the game and note the ordering of the _mm_set*() intrinsics^{8}

🏃

🦉

📖

2:09:19Run the game and note the ordering of the _mm_set*() intrinsics^{8}

🏃

🦉

📖

2:09:19Run the game and note the ordering of the _mm_set*() intrinsics^{8}

🏃

🦉

📖

2:10:56Enable RandomBilateral_4x() to operate directly in SIMD, and introduce RandomUnilateral_4x() and U32ToF32()^{9}

🦉

🖮

2:10:56Enable RandomBilateral_4x() to operate directly in SIMD, and introduce RandomUnilateral_4x() and U32ToF32()^{9}

🦉

🖮

🦉

🖮

2:19:23Consider negative and positive numbers in twos complement

🦉

🗩

2:19:23Consider negative and positive numbers in twos complement

🦉

🗩

2:19:23Consider negative and positive numbers in twos complement

🦉

🗩

2:21:47Continue to implement RandomBilateral_4x()

🦉

🖮

2:21:47Continue to implement RandomBilateral_4x()

🦉

🖮

2:21:47Continue to implement RandomBilateral_4x()

🦉

🖮

2:22:46Run the game and consider stopping here for today

🏃

🦉

2:22:46Run the game and consider stopping here for today

🏃

🦉

2:22:46Run the game and consider stopping here for today

🏃

🦉

2:23:32Q&A

🗩

2:23:32Q&A

🗩

2:23:32Q&A

🗩

2:26:54Sample distribution

🖌

2:26:54Sample distribution

🖌

2:26:54Sample distribution

🖌

2:31:27Using the "eye" vector to estimate perceived reflectance of surfaces

🖌

2:31:27Using the "eye" vector to estimate perceived reflectance of surfaces

🖌

2:31:27Using the "eye" vector to estimate perceived reflectance of surfaces

🖌

2:37:41Angular falloff

🖌

2:37:41Angular falloff

🖌

2:37:41Angular falloff

🖌

2:40:58Computing reflected light sources around corners

🖌

2:40:58Computing reflected light sources around corners

🖌

2:40:58Computing reflected light sources around corners

🖌

2:48:07We are good to go

🗩

2:48:07We are good to go

🗩

2:48:07We are good to go

🗩

⏬

Next: 'Removing the CRT from the Win32 Loader'

⏬