diff --git a/cmuratori/hero/code/code583.hmml b/cmuratori/hero/code/code583.hmml new file mode 100644 index 0000000..7bbcd9e --- /dev/null +++ b/cmuratori/hero/code/code583.hmml @@ -0,0 +1,80 @@ +[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Streamlining the New Lighting Pipeline" vod_platform=youtube id=WzXFlKj5G2o annotator=Miblo] +[0:04][Recap and set the stage for the day debugging and streamlining our :lighting][:speech] +[4:41][Launch the game, with continued thoughts on :hardware :rendering][:run] +[5:15][Demo our diffuse :lighting, considering disabling it for the debug overlay][:"debug system" :run] +[7:15][Set up to thread the whole of EndLightingComputation()][:lighting :research :threading] +[10:03][Draw the voxels in TestLightSphere()][:"debug visualisation" :lighting] +[10:19][Show the voxels][:"debug visualisation" :lighting :run] +[10:45][Determine that Global_Lighting_ShowProbes controls the probe drawing][:"debug visualisation" :lighting :research] +[10:51][Consult the debug overlay for the ShowProbes toggle][:"debug visualisation" :lighting :run] +[11:18][Set Global_Lighting_ShowProbes to true][:"debug visualisation" :lighting] +[11:27][Show, explain and consider pulling the light probes][:"debug visualisation" :lighting :run] +[13:28][Remove LightProbeCount and LightProbeP from lighting_solution, and propagate this removal][:"data structure" :lighting] +[14:09][Our mistake: Making Z primal][:lighting :speech :threading] +[16:47][Replace OnePastLastLightProbeIndex with VoxelX in lighting_work (i.e. making X primal), and continue to switch ComputeLightPropagation() away from light probes to a voxel-direct, X slice-based scheme][:"data structure" :lighting] +[23:24][Consider the potentially increased cache-friendliness of our voxel-direct scheme][:"data structure" :lighting :performance :speech] +[24:52][Switch ComputeLightPropagationWork() to our voxel-direct scheme][:"data structure" :lighting :threading] +[36:36][Augment lighting_work with SamplePointEntropy and LightPointEntropy for ComputeLightPropagation() to set][:"data structure" :lighting] +[38:52][Continue to switch ComputeLightPropagationWork() to our voxel-direct scheme][:lighting :threading] +[40:11][Augment lighting_solution with a game_render_commands pointer, for ComputeLightPropagation() to take][:"data structure" :lighting] +[41:38][Continue to switch ComputeLightPropagationWork() to our voxel-direct scheme, making it call TestLightSphere()][:lighting :threading] +[44:12][Weld ComputeLightPropagation() in to EndLightingComputation(), and replace TestCastFromProbes() with a voxel-direct TestCast()][:lighting :threading] +[49:40][Introduce FullCast(), respecifying SpamVoxel() as UpdateVoxel()][:lighting :threading] +[57:21][Rename TestLightSphere() to TestSphere(), updating it to our voxel-direct scheme][:lighting :threading] +[1:01:22][Clean up compile errors in ComputeLightPropagationWork()][:lighting :threading] +[1:02:14][Remove InLargeVoxel(), GetVoxelIndex(), GetVoxelCenterP(), SignedSquareRoot() and GetLightAmount(), and weld GetIrradiance() in to ComputeVoxelIrradianceAt()][:lighting] +[1:07:37][Hit assertion in EndLightingComputation()][:lighting :run] +[1:08:08][Change lighting_work in lighting_solution to be a pointer, allocated by InitLighting(), and remove AccumulatedPPS][:"data structure" :lighting :memory] +[1:09:31][:Run slowly][:lighting] +[1:09:59][Restrict ComputeLightPropagationWork() to loop over only one Z-slice][:lighting] +[1:10:55][See nothing lit][:lighting :run] +[1:11:19][Scour TestSphere() for bugs][:lighting :research] +[1:12:07][Remove InvHotDim from TestSphere() and switch it to set the LightC based directly on the light's direction][:"debug visualisation" :lighting] +[1:12:25][See our lit world][:"debug visualisation" :lighting :run] +[1:12:41][Reduce the brightness of the direction-based :lighting in TestSphere()][:"debug visualisation" :lighting] +[1:13:11][See our diffusely lit world][:"debug visualisation" :lighting :run] +[1:13:44][Make EndLightingComputation() add the ComputeLightPropationWork() calls to our queue][:lighting :threading] +[1:14:09][See our diffusely and multithreaded lit world][:"debug visualisation" :lighting :run :threading] +[1:14:23][Set Global_Lighting_ShowProbes to false][:"debug visualisation" :lighting] +[1:15:13][See our lit world, spotting a hole in our light map, and check our :performance][:"debug visualisation" :lighting :run :threading] +[1:16:50][Switch TestSphere() back to set the LightC as computed, fixing that actual computation to not be done in UV-space][:lighting] +[1:18:39][Admire our light][:lighting :run] +[1:19:39][Make CompileZBiasProgram() fall-off the :lighting not quite to black, to hide the voxelisation][:hardware] +[1:21:17][Admire our less apparently voxelised :lighting][:lighting :programming :run] +[1:23:18][Switch ComputeLightPropationWork() to TEST_CAST][:lighting] +[1:23:47][Hit a write-access violation in GetLightLeafForP()][:lighting :run] +[1:24:24][Prevent TestCast() from asking GetLightLeafForP() to draw the voxel hierarchy, because PushDebugLine() is not thread-safe][:"debug visualisation" :lighting :threading] +[1:24:51][Admire our ray-cast :lighting][:run] +[1:25:03][Increase the light brightness in TestCast()][:lighting] +[1:25:11][Admire our brighter ray-cast :lighting, with misaligned voxel][:run] +[1:26:51][Reflect on the slow :performance of our :lighting solution][:speech] +[1:27:51][Q&A][:speech] +[1:28:39][@somebody_took_my_name][Q: You don't assign the clamp of S back to S in the shader. And is there a bug in the octahedral map? I mean the black pixels in the corners and the line just below][:lighting :hardware] +[1:28:46][Fix CompileZBiasProgram() to set S][:hardware :lighting] +[1:28:57][Admire our :lighting][:run] +[1:29:33][@mattiamanzati][Q: Shouldn't wall side be in light state at the moment?] +[1:29:52][@0lpbm][Q: If we like the voxelized light, can we keep it?][:lighting] +[1:30:07][Comment out the "voxel-smoothing" code in CompileZBiasProgram()][:hardware :lighting] +[1:30:12][Show the apparently voxelised :lighting][:run] +[1:30:25][Let CompileZBiasProgram() smooth out the voxelisation][:hardware :lighting] +[1:30:43][@duckbillphil][Q: Can you show the disassembly of Transpose() in optimized build][:asm :simd] +[1:32:00][Check the assembly of Transpose()][:asm :run :simd] +[1:36:40][@uplinkcoder][Q: Can you zoom out on the octahedral debug drawing?][:"debug visualisation" :lighting] +[1:36:47][@ablindorphan][Q: Why does the clamped light have a kind of heart shape from some angles with the sphere :lighting (two lobes jutting out behind the hero to his left and right when viewing from a low angle)?] +[1:37:34][@xxthebigfoxx][Q: Maybe you fixed it up already but I think you might have a copy-paste error in the border fill. If you look at the sphere test the octahedral maps show a weird black line on each][:lighting] +[1:38:15][Hunt the orphanage for border copies][:lighting :run] +[1:38:48][Toggle on EDGE_COLORING in ComputeLightPropationWork()][:"debug visualisation" :lighting] +[1:39:11][View the light map][:"debug visualisation" :lighting :run] +[1:39:38][Make a note in ComputeLightPropationWork() to verify the border copies][:lighting] +[1:40:30][@rooctag][Q: How will you light the top of the “walls” but make them block light in the middle?][:lighting] +[1:40:42][Check the wall :lighting][:run] +[1:41:21][Switch ComputeLightPropationWork() to TEST_SPHERE][:lighting] +[1:41:34][See that the wall uprights are now lit][:lighting :run] +[1:42:28][Switch ComputeLightPropationWork() to TEST_CAST][:lighting] +[1:42:36][See that the wall uprights are incorrectly lit][:lighting :run] +[1:43:45][@rooctag][Q: Just wondered how you would light the wooden top? Or will that be the moon?][:lighting] +[1:44:22][@sahfortv][Q: I didn't follow what the next step is. I assume you want to merge the test sphere and test cast into their final form. Is that correct?][:lighting] +[1:45:13][@ttbjm][Q: Are you planning in putting in tone mapping?][:lighting] +[1:45:53][@ablindorphan][Q: Does it take a significant amount of time to switch head spaces between different programming projects for you (e.g. between [~hero Handmade Hero] and 1935), and do you have any techniques that you use to re-familiarise yourself about an old project that you haven't worked on in a while?] +[1:46:57][That looks like it][:speech] +[/video]