Index hero/code605

This commit is contained in:
Matt Mascarenhas 2020-05-29 18:44:40 +01:00
parent 3eb1b43862
commit d5031ddc5e
1 changed files with 78 additions and 0 deletions

View File

@ -0,0 +1,78 @@
[video output=day605 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Cleaning Up the Lighting Code" vod_platform=youtube id=KcUfAVOC13k annotator=Miblo]
[0:00][Recap and set the stage for the day][:speech]
[0:40][Copy into handmade_lighting.h the function signatures of our :lighting system functions]
[1:21][Describe the two-stage :lighting system structure, noting our desire to have only one function, UpdateLighting()][:research]
[3:57][Look into relieving PushLightingRenderValues() of the need to call SetLightBounds()][:lighting :research]
[5:50][Consider storing our light voxel in game_render_commands][:lighting :research]
[8:29][Move the VoxelMinCorner and VoxelInvTotalDim from render_setup to game_render_commands as LightingVoxelMinCorner and LightingVoxelInvTotalDim, and propagate this change][:"data structure" :lighting]
[11:53][Toggle on LIGHTING_USE_FOUR_RAYS][:lighting]
[12:30][Break in ComputeWalkTable()][:lighting :run]
[13:05][Fix the infinite loop in ComputeWalkTable()][:lighting]
[13:17][See a blank screen][:lighting :run]
[13:52][Make the new BuildSpatialPartitionForLighting() only operate if LIGHTING_USE_FOUR_RAYS is disabled][:lighting]
[14:37][See the old :lighting, albeit broken][:run]
[14:56][Build in -O2][:lighting]
[15:11][Check out our broken old :lighting][:run]
[15:28][Collapse SetUpLightingRegion() into UpdateLighting()][:lighting]
[22:05][See a blank screen][:lighting :run]
[22:10][Make UpdateAndRenderWorld() call EnableLighting()][:lighting]
[24:43][Check out our broken, yet streamlined, old :lighting][:run]
[25:22][Clean up and document UpdateLighting()][:lighting]
[33:17][Demo the incorrect :lighting computations and the flash when the :camera moves][:run]
[33:47][Fix UpdateAndRenderWorld() to pass the incoming Camera.SimulationCenter to UpdateLighting()][:camera :lighting]
[35:10][The flash when moving the :camera is fixed][:lighting :run]
[35:31][Finish documenting UpdateLighting()][:lighting]
[36:48][Determine to debug wrong :lighting results and remove the lighting_box storage from lighting_solution][:"data structure" :lighting :research]
[37:41][Prepare to debug wrong :lighting results, removing SplitKd() and trimming out old test cases from RayCast()]
[40:48][The game looks the same][:lighting :run]
[40:53][Remove more stale :lighting code]
[44:26][Demo the wrong :lighting results][:run]
[45:24][Scrutinise RayCast() for errors][:lighting :research]
[49:13][Scrutinise ComputeVoxelIrradianceAt() and related functions for errors][:lighting :research]
[51:16][Scrutinise the :lighting setup code for errors][:research]
[55:08][Fix FullCast() to pass the RayD from the Solution->SamplingSpheres to RayCast()][:lighting]
[57:59][Admire our more correct, old :lighting][:run]
[58:07][Build in -O2][:lighting]
[58:18][Admire our more reasonable, old :lighting][:run]
[58:55][Provide an easy means of toggling between the new grid-based and the old AABB ray caster, renaming RayCast() to AABBRayCast()][:lighting]
[1:08:11][Check out our old AABB ray cast :lighting][:run]
[1:08:35][Split BuildSpatialPartitionForLighting() into GridBuildSpatialPartition() and AABBBuildSpatialPartition()][:lighting]
[1:10:51][Check out our old AABB ray cast :lighting][:run]
[1:11:03][Toggle on LIGHTING_USE_GRID and fix compile errors][:lighting]
[1:11:37][Hit our assertion in FlatIndexFrom()][:lighting :run]
[1:13:40][Make GridBuildSpatialPartition() clip the SpatialGrid down by a CellDim][:lighting]
[1:16:12][Hit our assertion in FlatIndexFrom()][:lighting :run]
[1:17:35][Fix GridBuildSpatialPartition() to pass the BoxBounds to GetIndexForP()][:lighting]
[1:18:10][Admire our moonlight][:lighting :run]
[1:18:36][Build in -O2][:lighting]
[1:18:43][Admire our moonlight][:lighting :run]
[1:19:31][Toggle off LIGHTING_USE_GRID][:lighting]
[1:19:55][Determine to remove the lighting_box storage from lighting_solution][:lighting :run]
[1:20:07][Rename Boxes to AABBBoxes in lighting_solution, remove RootLightBoxIndex, and flow InputBoxes separately through the pipeline][:"data structure" :lighting]
[1:30:01][Hit a write access violation on the ParentBox in SplitBox()][:lighting :run]
[1:30:14][Make AABBBuildSpatialPartition() initialise the AABBBoxCount to 1][:lighting]
[1:30:58][:Run successfully][:lighting]
[1:31:06][Add a toggle between the AABB and grid ray caster data in lighting_solution][:"data structure" :lighting]
[1:33:19][:Run successfully][:lighting]
[1:33:41][Build in -O2][:lighting]
[1:33:48][:Run successfully][:lighting]
[1:34:08][Change the DebugLines in lighting_solution to be allocated][:"debug system" :lighting :memory]
[1:37:41][:Run successfully][:lighting]
[1:38:00][Consider further areas for cleanup][:lighting :research]
[1:42:22][Introduce lighting_update_params][:"data structure" :lighting]
[1:45:35][Plan to split the lighting_solution into pieces][:"data structure" :lighting]
[1:48:44][Q&A][:speech]
[1:49:18][@somebody_took_my_name][Q: Is the MaxNodeIndex supposed to be in bounds or one past the bound?][:lighting]
[1:50:10][@guybru5h_vi][Q: Does the :lighting solution support direct lighting like the sun / moon?]
[1:51:15][@bulmanator][Q: Are you doing this on the CPU purely for educational reasons or is there something else?]
[1:53:26][@billdstrong][Q: We can put mirrors in every level like Labyrinth][:lighting]
[1:54:33][@mindmark42][Q: Can you at some point go over the AVX scatter gather intrinsics?[ref
site=Intel
page="Intel Intrinsics Guide"
url=https://software.intel.com/sites/landingpage/IntrinsicsGuide/]][:isa]
[1:59:38][@poikonomo][Q: Do you have an idea of how the gameplay will look like or will you wait to finish the engine before getting to it?]
[2:00:08][@stuntcoder][Q: (Off-topic) On earlier streams you have trouble with RSI. After decades of typing, I too have RSI. Any tips?][:health]
[2:01:24][@dolseth][Q: Probably covered in some other day, but what's the best update-rate to choose for a game? [@naysayer88 Jon] says it's good to have it high so it looks good on high-update screens, but 120 FPS isn't a multiple of 144 FPS. So what do you recommend?]
[2:04:20][@cleffing][Q: Why not take a stab at game design when it's done? Just not interested?]
[2:05:08][Thank you, everybody][:speech]
[/video]