cinera_handmade.network/cmuratori/hero/code/code436.hmml

85 lines
8.3 KiB
Plaintext
Raw Permalink Normal View History

[video output=day436 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Spiral and Blue Noise Distributions on the Sphere" vod_platform=youtube id=TfBPaNsGe_k annotator=Miblo]
2018-03-21 18:18:23 +00:00
[0:03][Recap and set the stage for the day using sine and cosine to improve the :lighting sampling quality][:mathematics :rendering :speech :statistics]
[2:08][:Run the game to show the :"debug visualisation" of our :lighting's hemisphere sampling][:rendering :statistics]
[4:27][Describe the hemisphere sampling in ComputeLightPropagation()][:lighting :rendering :research :statistics]
[5:33][Hemisphere sample distribution][:blackboard :statistics]
[7:26][:Run the game to show our hemisphere sampling][:"debug visualisation" :lighting :rendering :statistics]
[8:52][Begin to change ComputeLightPropagation() to perform spiral sampling[ref
site=Wikipedia
page=Phyllotaxis
url=https://en.wikipedia.org/wiki/Phyllotaxis][ref
site="Marmakoide's Blog"
page="Spreading points on a disc and on a sphere"
url=http://blog.marmakoide.org/?p=1] of the :lighting, as suggested by @Kelimion][:rendering :statistics]
[17:20][Change ComputeLightPropagation() to use polar coordinates for our randomly sampled hemisphere][:lighting :rendering :statistics]
[18:29][:Run the game to see our hemisphere sampling][:"debug visualisation" :lighting :rendering :statistics]
[18:50][Change ComputeLightPropagation() to produce spiral sampling around a sphere[ref
site="Marmakoide's Blog"
page="Spreading points on a disc and on a sphere"
url=http://blog.marmakoide.org/?p=1] with a note about Vogel's method[ref
title="A better way to construct the sunflower head"
author="Helmut Vogel"
url=https://eurekamag.com/research/004/547/004547922.php]][:lighting :rendering :statistics]
[29:53][:Run the game to see the sample distribution][:"debug visualisation" :lighting :rendering :statistics]
[30:13][Increase the sample count from 16 to 64 in ComputeLightPropagation()]
[30:25][:Run the game to see the nice covering of the sphere][:"debug visualisation" :lighting :rendering :statistics]
[30:49][Make ComputeLightPropagation() produce hemispherical data][:lighting :rendering :statistics]
[31:24][:Run the game to see the hemispherical data][:"debug visualisation" :lighting :rendering :statistics]
[32:01][Reduce the sample count back to 16 and randomly jitter them in ComputeLightPropagation()][:lighting :rendering :statistics]
[33:50][:Run the game to see that this is back to being clumpy][:"debug visualisation" :lighting :rendering :statistics]
[34:04][Try to alleviate the clumpiness in ComputeLightPropagation()][:lighting :rendering :statistics]
[36:05][:Run the game to see the varying samples][:"debug visualisation" :lighting :rendering :statistics]
[36:53][Make ComputeLightPropagation() only randomise the Rho value][:lighting :rendering :statistics]
[37:33][:Run the game to see this coverage][:"debug visualisation" :lighting :rendering :statistics]
[37:40][Make ComputeLightPropagation() use one randomised RhoOffset for the whole sphere][:lighting :rendering :statistics]
[38:48][:Run the game to see this coverage][:"debug visualisation" :lighting :rendering :statistics]
[38:55][Let ComputeLightPropagation() run the sampling over 20 frames for us to visualise the coverage][:lighting :rendering :statistics]
[39:56][:Run the game to see this extended coverage][:"debug visualisation" :lighting :rendering :statistics]
[40:26][Make ComputeLightPropagation() multiple Theta, rather than Tau, in to the RhoOffset][:lighting :rendering :statistics]
[40:46][:Run the game to see this extended coverage][:"debug visualisation" :lighting :rendering :statistics]
[41:09][Change ComputeLightPropagation() to jitter the 64 points sampling more fairly][:lighting :rendering :statistics]
[42:50][:Run the game to see this jittered coverage][:"debug visualisation" :lighting :rendering :statistics]
[43:01][Make ComputeLightPropagation() jitter the i value][:lighting :rendering :statistics]
[43:29][:Run the game to see this coverage biasing towards the spiral][:"debug visualisation" :lighting :rendering :statistics]
[44:48][Make ComputeLightPropagation() jitter the normal of each ray][:lighting :rendering :statistics]
[46:18][:Run the game to see this distribution][:"debug visualisation" :lighting :rendering :statistics]
[47:19][Make ComputeLightPropagation() bias the distribution towards upwards][:lighting :rendering :statistics]
[49:02][:Run the game to see this more upwards facing distribution, and consider how to concentrate the samples at the top][:"debug visualisation" :lighting :rendering :statistics]
[52:01][Make ComputeLightPropagation() produce a handwritten distribution of 64 points][:lighting :rendering :statistics]
[56:49][:Run the game to see this distribution, tweaking the MinimumDistanceSq until we crash][:"debug visualisation" :lighting :programming :rendering :statistics]
[57:17][Make ComputeLightPropagation set MinimumDistanceSq to 0.25²][:lighting :rendering :statistics]
[57:28][:Run the game see to see our uniformly covered sphere][:"debug visualisation" :lighting :programming :rendering :statistics]
[57:45][Make ComputeLightPropagation() concentrate our distribution towards the top][:lighting :rendering :statistics]
[1:03:23][:Run the game to see our tighter distribution][:"debug visualisation" :lighting :programming :rendering :statistics]
[1:03:34][Let ComputeLightPropagation() run the sampling over 20 frames for us to visualise the coverage][:lighting :rendering :statistics]
[1:04:12][:Run the game to see this extended coverage, and consider how to produce bundles of 4 points, accounting for the spread][:"debug visualisation" :lighting :rendering :statistics]
[1:06:12][Euclidean straight-line vs "great arc" parabolic distance][:blackboard :geometry]
[1:08:17][Change ComputeLightPropagation() to distribute the sampling points by their parabolic rather than straight-line distance][:lighting :rendering :statistics]
[1:22:50][:Run the game to see our extended parabolic distribution][:"debug visualisation" :lighting :rendering :statistics]
[1:22:59][Make ComputeLightPropagation() jitter our randomly distributed sampling points over 20 frames][:lighting :rendering :statistics]
[1:25:41][:Run the game to see the random patches][:"debug visualisation" :lighting :rendering :statistics]
[1:26:09][Make ComputeLightPropagation() concentrate the points towards the top][:lighting :rendering :statistics]
[1:28:10][:Run the game to see our distribution, and consider distributing all 64 separately][:"debug visualisation" :lighting :rendering :statistics]
[1:28:19][Make ComputeLightPropagation() distribute all 64 points unbundled][:lighting :rendering :statistics]
[1:31:15][:Run the game to see our 64 distributed points][:"debug visualisation" :lighting :rendering :statistics]
[1:33:19][Q&A][:speech]
[1:33:57][@bestalloys][Q: What do you think about a compile time switch to flip between pseudo-rng and standard rng to see if it's an rng issue?][:library :prng]
[1:34:34][@nxsy][Q: Why cant we use the spiral method to generate 64 points, that we group into 16 groups of 4 based on direction, and then rotate the spiral 18 degrees over 20 frames for the samples?][:statistics]
[1:35:18][@frostyninja][Q: What about a precomputed sample sphere that you rotate over the frame period instead of random jittering?][:statistics]
[1:35:39][Lateral distribution][:blackboard :statistics]
[1:38:02][Consider doing quadrant-based distribution][:speech :statistics]
[1:38:36][@bestalloys][crt rng][:prng]
[1:41:53][Step in to the :asm of rand() from the CRT[ref
site=Wikipedia
page="Linear congruential generator"
url=https://en.wikipedia.org/wiki/Linear_congruential_generator]][:library :prng :run]
[1:44:54][@longboolean][Q: Is this intended as a preprocessed step or will these hemispheres be computed for every quad every frame?][:statistics]
[1:45:14][@fierydrake][Q: Could anything be done with a centroidal Voronoi tessellation covering the sphere? Is that too expensive? Is it a terrible idea?][:statistics]
[1:45:35][@frostyninja][Q: Could we get a relatively performant blue noise?][:prng :statistics]
[1:45:54][Point out the blue noise graph in 'The Color of Noise'[ref
site="Casey Muratori's home page"
page="The Color of Noise"
url=https://caseymuratori.com/blog_0010]][:prng :research :statistics]
[1:47:23][Wrap things up][:speech]
[/video]