diff --git a/cmuratori/hero/code/code648.hmml b/cmuratori/hero/code/code648.hmml index e1b3748..78a4e21 100644 --- a/cmuratori/hero/code/code648.hmml +++ b/cmuratori/hero/code/code648.hmml @@ -109,15 +109,15 @@ [2:42:07][The lighting clearly blinks when copying the atlases][:"debug visualisation" :lighting :run] [2:43:29][Scour BlockCopyAtlas() for bugs][:lighting :research] [2:44:32][Toggle on the LIGHT_ATLAS_ASSERT for VALIDATE_TEXEL_ATLAS() to fire][:lighting] -[2:44:43][Trap on VALIDATE_TEXEL_ATLAS of the DiffuseAtlas][:lighting :run] +[2:44:43][Trap on VALIDATE_TEXEL_ATLAS() of the DiffuseAtlas][:lighting :run] [2:45:11][Make ValidateTexelComponent() consider a component of between -100 and 100 to be valid][:lighting] -[2:45:30][Immediately trap on VALIDATE_TEXEL_ATLAS of the SpecAtlas][:lighting :run] +[2:45:30][Immediately trap on VALIDATE_TEXEL_ATLAS() of the SpecAtlas][:lighting :run] [2:45:44][Consider deferring until next time the investigation of our out-of-bounds lighting values][:lighting :research] [2:49:13][Introduce VoxelIndexIsInDim() for GridRayCast() to assert that the sample fetch is in bounds][:lighting] [2:55:54][Hit our IsInBounds assertion in GridRayCast()][:lighting :run] [2:58:36][Get it][:lighting :research] [3:00:34][Toggle off the ray drawing in PushLightingRenderValues(), and toggle on DebugDrawSpatialGrid() in UpdateLighting()][:"debug visualisation" :lighting] -[3:01:36][Immediately trap on VALIDATE_TEXEL_ATLAS of the SpecAtlas][:lighting :run] +[3:01:36][Immediately trap on VALIDATE_TEXEL_ATLAS() of the SpecAtlas][:lighting :run] [3:01:49][Toggle off the LIGHT_ATLAS_ASSERT][:lighting] [3:01:57][Our bug: We can sample garbage in Z when not hitting an occluder][:"debug visualisation" :lighting :run] [3:06:26][GridRayCast() is already clamping][:lighting :research] diff --git a/cmuratori/hero/code/code649.hmml b/cmuratori/hero/code/code649.hmml new file mode 100644 index 0000000..c654c36 --- /dev/null +++ b/cmuratori/hero/code/code649.hmml @@ -0,0 +1,116 @@ +[video output=day649 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Removing Lighting Walk Tables" vod_platform=youtube id=kcmku4TMTek annotator=Miblo] +[0:02][Recap and set the stage for the day debugging :lighting][:speech] +[1:03][Demo our light bleed bug][:lighting :run] +[1:45][Demo our light copying bug][:lighting :run] +[6:00][Describe BlockCopyAtlas()][:lighting :research] +[7:09][Assert in BlockCopyAtlas() that the Z loop doesn't happen][:lighting] +[7:50][Hit our Z loop assertion in BlockCopyAtlas()][:lighting :run] +[8:49][Move our Z loop assertion in BlockCopyAtlas() down to the Z clearing loop][:lighting] +[9:11][Hit our Z clearing loop assertion in BlockCopyAtlas()][:lighting :run] +[9:45][Inspect the BlockCopyAtlas() values in an -Od build][:lighting :run] +[11:26][Comment out the Z clearing loop in BlockCopyAtlas()][:lighting] +[11:51][Try to eyeball our light copying bug][:lighting :run] +[12:14][Toggle off DebugDrawSpatialGrid() in UpdateLighting()][:"debug visualisation" :lighting] +[12:44][Our light copying / flashing bug seems to still occur][:lighting :run] +[14:47][Uncomment the Z clearing loop in BlockCopyAtlas()][:lighting] +[15:14][Scour BlockCopyAtlas() for bugs][:lighting :research] +[18:07][Remove the minus 1 from the StopZ computation in BlockCopyAtlas()][:lighting] +[18:35][We still see a little bit of flashing][:lighting :run] +[18:54][Enable LIGHT_ATLAS_ASSERT][:lighting] +[19:25][Immediately trap on VALIDATE_TEXEL_ATLAS() of the SpecAtlas][:lighting :run] +[19:35][Toggle off the VALIDATE_TEXEL_ATLAS() calls in UpdateLighting()][:lighting] +[19:47][Trap on VALIDATE_TEXEL_ATLAS() in BlockCopyAtlas()][:lighting :run] +[19:54][Toggle off the VALIDATE_TEXEL_ATLAS() calls using #if TEMPORARY][:lighting] +[20:19][Trap on VALIDATE_TEXEL_ATLAS() at the end of BlockCopyAtlas()][:lighting :run] +[20:29][Toggle off the final VALIDATE_TEXEL_ATLAS() call using #if TEMPORARY][:lighting] +[20:43][Successfully :run without fetching out of bounds][:lighting :run] +[21:02][Remove the minus 1 from the StopX and StopY computations in BlockCopyAtlas()][:lighting] +[21:22][We have :lighting movement across tiles][:run] +[23:25][Decrease tUpdateBlend from 1 to 15/60 in UpdateLighting()][:lighting] +[23:49][Still see the :lighting shift][:run] +[24:13][Decrease tUpdateBlend from 15/60 to 1/60 in UpdateLighting()][:lighting] +[24:29][The shift is due to the light being recomputed differently][:lighting :run] +[25:22][Toggle off the -1 to 1 origin cube in UpdateAndRenderWorld()][:"debug visualisation" :lighting] +[26:59][The wall tiles darken after shifting][:lighting :run] +[28:07][Toggle off PushLight() on the DebugLightP in UpdateAndRenderWorld()][:lighting] +[28:26][The room still seems to brighten when we enter][:lighting :run] +[30:18][The light bleed takes longer with our slower tUpdateBlend][:lighting :run] +[31:01][Increase tUpdateBlend from 1/60 to 1 in UpdateLighting()][:lighting] +[31:50][The copy is now fine, but the ray casting differs when shifting the lighting voxel][:lighting :run] +[34:12][Prevent UpdateLighting() from offsetting VoxCameraOffset.Y by 2][:lighting] +[35:03][The lighting region is now centred][:lighting :run] +[36:38][Scour GridRayCast() for a reason for differences when shifting the lighting voxel][:lighting :research] +[41:16][Scour ComputeWalkTable() for bugs][:lighting :research] +[42:40][Make WalkTableOffset be an array of 4 in sample_direction, for ComputeWalkTable() to use][:"data structure" :lighting] +[43:12][The light doesn't seem to have changed][:lighting :run] +[43:58][Double-check ComputeWalkTable() for correctness][:lighting :research] +[45:16][Consider removing lighting walk tables][:lighting :research] +[46:56][The ray casting still differs when shifting the lighting voxel][:lighting :run] +[47:27][Consider making UpdateLighting() force dVoxel to be a multiple of 2 so the quadrant doesn't change][:lighting :research] +[48:32][@gir33][The problem changed, though, there's still a dark spot but it doesn't move now][:lighting] +[48:51][Demo the moving dark spot][:lighting :run] +[49:46][@gir33][I mean it seems like it only moved when leaving the room but not while moving within the room as before, no?][:lighting] +[50:07][Demo the changing dark spot when the lighting voxel alignment changes within a room][:lighting :run] +[50:59][Consider removing lighting walk tables][:lighting :research] +[55:15][@mallesbixie][FruFru is a great variable name, though] +[55:20][Consider removing lighting walk tables][:lighting :research] +[56:18][Check GridRayCast() to inform our lighting walk table removal decision][:lighting :research] +[59:50][Toggle on WalkTable stepping in GridRayCast()][:lighting] +[1:00:06][Traverse the orphanage into a relatively stably lit room][:lighting :run] +[1:00:17][Change the CostMetric-based ray casting loop in GridRayCast() to iterate over a hard-bounded GridWalkIteration][:lighting] +[1:00:47][The lighting looks the same][:lighting :run] +[1:00:56][Remove CostMetric entirely from GridRayCast()][:lighting] +[1:01:23][The lighting remains fine][:lighting :run] +[1:01:46][Consider formulating an exit criterion in GridRayCast() upon leaving the spatial partition][:lighting :research] +[1:04:29][Determine to make GridRayCast() work without a walk table][:lighting :research] +[1:09:25][Sketch out walk table-eliminated grid stepping in GridRayCast()][:lighting] +[1:45:42][@spacenaming][DirCurP is 2*DirCurP+dX/Y at the moment][:lighting] +[1:46:06][@spacenaming][XStepV have it included already][:lighting] +[1:46:35][Determine to remove lighting walk tables][:lighting :research] +[1:47:31][Break][:admin] +[1:48:10][:afk] +[1:50:06][Return and centre the camera][:admin] +[1:52:25][Implement on-the-fly grid stepping in GridRayCast()][:lighting] +[2:13:50][Hit an overflow read access violation on SpatialGridLeaves in GridRayCast()][:lighting :run] +[2:14:03][Introduce a CheckGridIndex to separate out the two grid stepping routines in GridRayCast()][:lighting] +[2:14:46][The lighting behaves the same as before][:lighting :run] +[2:15:11][Break in to GridRayCast() and compare the values of the two grid stepping routines][:lighting :run] +[2:16:33][Fix the dGridIndexXBase and dGridIndexYBase computations in GridRayCast()][:lighting] +[2:16:51][Break in to GridRayCast() and compare the values of the two grid stepping routines][:lighting :run] +[2:17:51][Assert in GridRayCast() that GridIndex and CheckGridIndex match][:lighting] +[2:18:14][:Run the game][:lighting] +[2:18:24][Update ~remedybg from 0.3.5.0 to 0.3.6.4][:admin] +[2:20:21][Hit the GridIndex and CheckGridIndex matching assertion in GridRayCast()][:lighting :run] +[2:21:49][Swap in the new on-the-fly grid stepping in GridRayCast()][:lighting] +[2:22:49][Our ray casting correctly no longer differs when shifting the lighting voxel][:lighting :run] +[2:24:19][Consider how to update tTerminate][:lighting :research] +[2:29:46][Make GridRayCast() compute tTerminate on the fly][:lighting] +[2:38:43][Our lighting happily looks no different][:lighting :run] +[2:39:08][Remove the :lighting walk tables][:lighting] +[2:41:08][:Run successfully and briefly consider our remaining light bleed bug][:lighting] +[2:44:28][Reflect on today's work and consider further simplifications][:lighting :speech] +[2:45:35][\~82% frame time (\~400,000,000 cycles) on ComputeLightPropagationWork][:lighting :performance :run] +[2:46:43][Make GridRayCast() only cast one ray][:lighting] +[2:47:05][\~35% frame time (\~35,000,000 cycles) on ComputeLightPropagationWork][:lighting :performance :run] +[2:47:36][Make GridRayCast() cast the full LIGHTING_OCTAHEDRAL_RAYS_PER_TEXEL][:lighting] +[2:47:42][\~82% frame time (\~400,000,000 cycles) on ComputeLightPropagationWork][:lighting :performance :run] +[2:48:00][Make GridRayCast() only cast no rays][:lighting] +[2:48:08][\~11% frame time (\~8,800,000 cycles) on ComputeLightPropagationWork][:lighting :performance :run] +[2:48:24][Make GridRayCast() cast the full LIGHTING_OCTAHEDRAL_RAYS_PER_TEXEL][:lighting] +[2:48:27][\~82% frame time (\~400,000,000 cycles) on ComputeLightPropagationWork][:lighting :performance :run] +[2:48:58][Make GridRayCast() cast half of the LIGHTING_OCTAHEDRAL_RAYS_PER_TEXEL][:lighting] +[2:49:12][Admire the cool red light bleed][:lighting :run] +[2:49:49][Make GridRayCast() double the RayWeight to compensate for the halved number of rays][:lighting] +[2:50:09][Admire the apparently structured light bleed bug][:lighting :run] +[2:51:28][Let GridRayCast() cast all the rays, at their appropriate weight][:lighting] +[2:51:51][Disable LIGHT_ATLAS_ASSERT][:lighting] +[2:52:10][\~28ms frame time][:lighting :performance :run] +[2:52:36][Disable HANDMADE_SLOW] +[2:52:48][\~24ms frame time][:lighting :performance :run] +[2:53:33][That's it for today][:speech] +[2:54:12][@gir33][Are the GPU shaders just lerping from the results that the CPU is doing?][:lighting] +[2:57:07][@gir33][Is that like a spherical harmonics encoding?][:lighting] +[3:01:02][That's it for today, with a glimpse into the future and reflections on the engine][:speech] +[3:02:42][@vaualbus][Can Z be re-added in an easier way now that the system is easier?][:lighting] +[3:05:13][That's it][:speech] +[/video]