Index hero/code590

Fix typos in code58{3..5}
This commit is contained in:
Matt Mascarenhas 2020-04-02 02:48:56 +01:00
parent 13032134bb
commit dbf04d7c36
4 changed files with 132 additions and 19 deletions

View File

@ -33,7 +33,7 @@
[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:13:44][Make EndLightingComputation() add the ComputeLightPropagationWork() 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]
@ -41,7 +41,7 @@
[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:18][Switch ComputeLightPropagationWork() 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]
@ -63,14 +63,14 @@
[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:38:48][Toggle on EDGE_COLORING in ComputeLightPropagationWork()][:"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:39:38][Make a note in ComputeLightPropagationWork() 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:21][Switch ComputeLightPropagationWork() 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:28][Switch ComputeLightPropagationWork() 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]

View File

@ -1,17 +1,17 @@
[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Enabling Infinite-Bounce Lighting" vod_platform=youtube id=gCZL4SWJYAI annotator=Miblo]
[0:02][Recap and set the stage for the day][:speech]
[1:13][Describe the problem with black gaps in the light map][:lighting :run]
[1:57][Describe the indexing discrepancy between BuildDiffuseLightMaps() and ComputeLightPropationWork()][:lighting :research]
[4:36][Fix ComputeLightPropationWork() to look up into the light map correctly][:lighting]
[1:57][Describe the indexing discrepancy between BuildDiffuseLightMaps() and ComputeLightPropagationWork()][:lighting :research]
[4:36][Fix ComputeLightPropagationWork() to look up into the light map correctly][:lighting]
[5:17][See the correct :lighting of our world, but not of the hero, and the misaligned simulation region][:run]
[8:32][Determine to enable infinite-bounce :lighting][:run]
[9:15][Switch to TEST_SPHERE in ComputeLightPropationWork()][:lighting]
[9:15][Switch to TEST_SPHERE in ComputeLightPropagationWork()][:lighting]
[9:29][Check out our sphere fall-off :lighting][:run]
[10:36][Let CompileZBiasProgram() clamp the light to brighter values][:lighting]
[11:51][Check out our brighter :lighting][:run]
[12:23][Let CompileZBiasProgram() clamp the light to further brighter values][:lighting]
[12:28][Check out our brighter :lighting with the determination to enable bounce lighting][:run]
[13:56][Toggle off TEST_SPHERE in ComputeLightPropationWork() and fix it to pass Work to FullCast()][:lighting]
[13:56][Toggle off TEST_SPHERE in ComputeLightPropagationWork() and fix it to pass Work to FullCast()][:lighting]
[14:43][Check out our full bright, slower ray-cast :lighting][:run]
[16:33][Prepare to enable distributive ray-casting in FullCast()][:lighting :research]
[17:22][Blank out the MoonColor in FullCast()][:lighting]
@ -25,13 +25,13 @@
[21:15][See a black world][:lighting :run]
[21:18][Try setting a TransferPPS of a quarter full bright white in FullCast()][:lighting]
[21:30][Check out our lit world, noting that the high brightness of the light][:lighting :run]
[23:03][Switch to TEST_CAST in ComputeLightPropationWork()][:lighting]
[23:03][Switch to TEST_CAST in ComputeLightPropagationWork()][:lighting]
[23:51][Check out our test cast :lighting][:run]
[23:57][Try making TestCast() output a known grey light][:lighting]
[24:19][See the light fade][:lighting :run]
[24:27][Try making TestCast() call UpdateVoxel() many times][:lighting]
[24:30][See no difference][:lighting :run]
[24:36][Remove the multiple calls to UpdateVoxel() in TestCast(), and toggle off TEST_CAST in ComputeLightPropationWork()][:lighting]
[24:36][Remove the multiple calls to UpdateVoxel() in TestCast(), and toggle off TEST_CAST in ComputeLightPropagationWork()][:lighting]
[25:08][See our bright light][:lighting :run]
[25:14][Consider the problem to be in pulling light from multiple octahedral offsets][:lighting :research]
[26:39][Check BuildDiffuseLightMaps() for possible bugs][:lighting :research]
@ -42,13 +42,13 @@
[40:23][See if CompileZBiasProgram() samples light based on its direction][:lighting :research :sampling]
[43:00][Diffuse :sampling of cosine-weighted directional light][:blackboard :lighting]
[48:56][Make SumLight() in CompileZBiasProgram() just use the surface normal as the reflection vector when :sampling Lambertian (ideally diffuse) surfaces][:lighting]
[50:23][Switch to TEST_CAST in ComputeLightPropationWork()][:lighting]
[50:23][Switch to TEST_CAST in ComputeLightPropagationWork()][:lighting]
[50:42][See our darkly lit world][:lighting :run]
[50:45][Prevent TestCast() from outputting a known grey light][:lighting]
[50:59][Check out the test ray cast :lighting][:run]
[51:15][Switch to TEST_SPHERE in ComputeLightPropationWork()][:lighting]
[51:15][Switch to TEST_SPHERE in ComputeLightPropagationWork()][:lighting]
[51:25][Check out the correct sphere light][:lighting :run]
[52:34][Toggle off TEST_SPHERE in ComputeLightPropationWork()][:lighting]
[52:34][Toggle off TEST_SPHERE in ComputeLightPropagationWork()][:lighting]
[53:00][Check out the full ray cast :lighting, wondering where falloff comes into it][:run]
[53:40][Reduce the TransferPPS from ×0.25f to ×0.1f in FullCast()][:lighting]
[53:54][See the dimmer light][:lighting :run]
@ -123,7 +123,7 @@
[1:40:24][Make CompileZBiasProgram() only light surfaces that are above Z -999][:lighting :ui]
[1:41:09][Check out our unlit :UI][:lighting :run]
[1:41:57][Make FullCast() be a TIMED_FUNCTION][:"debug system"]
[1:43:57][Check the CPU usage of FullCast() (73%) and ComputeLightPropationWork() (21%)][:lighting :performance :run]
[1:43:57][Check the CPU usage of FullCast() (73%) and ComputeLightPropagationWork() (21%)][:lighting :performance :run]
[1:44:32][Try preventing ComputeVoxelIrradianceAt() from blending the whole :lighting hierarchy]
[1:44:57][FullCast() still uses 73% of our CPU cycles][:lighting :performance :run]
[1:45:19][Make ComputeVoxelIrradianceAt() be a TIMED_FUNCTION][:"debug system" :lighting]

View File

@ -8,10 +8,10 @@
[11:53][Fill in the light_atlas, renaming it to game_light_atlas][:"data structure" :lighting]
[14:41][Consider how to handle specular surfaces][:lighting :speech]
[16:02][Replace the LightVoxel data with a game_light_atlas in game_render_commands, and augment open_gl with game_light_atlas][:"data structure" :lighting]
[17:45][Update ComputeLightPropationWork() and BeginLightingComputation() to use our new game_light_atlas][:lighting]
[17:45][Update ComputeLightPropagationWork() and BeginLightingComputation() to use our new game_light_atlas][:lighting]
[27:26][Introduce v3s overloaded-operator versions of * and /][:language :mathematics]
[28:26][Finish updating BeginLightingComputation() to use our new game_light_atlas][:lighting]
[28:53][Hit a write access violation in ComputeLightPropationWork()][:lighting :run]
[28:53][Hit a write access violation in ComputeLightPropagationWork()][:lighting :run]
[29:11][Make OpenGLInit() initialise our DiffuseLightAtlas][:hardware :lighting]
[31:20][:Run without crashing to see no obvious differences][:lighting :run]
[31:47][Create handmade_light_atlas.h, and rename game_light_atlas to light_atlas][:language :lighting]
@ -36,7 +36,7 @@
[1:13:46][Continue to remove redundant code related to the :lighting, augmenting the light_atlas]
[1:24:47][Consider the :performance implications of removing LIGHT_COLOR_LOOKUP_SQUARE_DIM in relation to DirectionFromTxTy()][:lighting :research]
[1:27:30][Augment light_atlas with OxyCoefficient and OctDimCoefficient for MakeLightAtlas() to compute and DirectionFromTxTy() and GetOctahedralOffset() respectively to take][:"data structure" :lighting]
[1:38:43][Replace all mentions of LIGHT_COLOR_LOOKUP_SQUARE_DIM in ComputeLightPropationWork(), introducing FillLightAtlasBorder() and respecifying VOXEL_OFFSET_C() as LIGHT_ATLAS_OFFSET()][:lighting]
[1:38:43][Replace all mentions of LIGHT_COLOR_LOOKUP_SQUARE_DIM in ComputeLightPropagationWork(), introducing FillLightAtlasBorder() and respecifying VOXEL_OFFSET_C() as LIGHT_ATLAS_OFFSET()][:lighting]
[1:53:11][Replace all mentions of LIGHT_COLOR_LOOKUP_SQUARE_DIM in BuldDiffuseLightMaps()][:lighting]
[1:58:17][:Run unexpectedly successfully][:lighting]
[1:58:46][Determine to sample from the correct maps next stream][:lighting :speech]

View File

@ -0,0 +1,113 @@
[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Starting Raycast Optimizations" vod_platform=youtube id=cprFjrly3BU annotator=Miblo]
[0:02][Welcome to the stream with a plug of the post-stream stream on [@naysayer88 Jon Blow]'s channel[ref
site=twitch
page=naysayer88
url=https://twitch.tv/naysayer88]]
[1:45][Demo our stochastically sampled :lighting, with the determination to optimise the ray caster][:optimisation :run :sampling]
[4:28][Check the :lighting :performance :statistics][:run]
[6:53][Calculate our ray casting cycle budget: 2000 cycles per cast][:admin :lighting :performance]
[9:06][Consider our scope for optimising RayCast()][:lighting :optimisation :performance :research]
[11:04][Comment out two unwanted ifs from RayCast()][:lighting :optimisation]
[11:23][\~350k cycles (70% frame time) spent in 6144 calls to FullCast()][:lighting :performance :run]
[14:09][Make ComputeLightPropagationWork() call the ray caster in a checkerboard pattern][:lighting :optimisation]
[16:48][Check out our :lighting][:run]
[17:19][Toggle on the light maps viewers in OpenGLEndFrame()][:"debug visualisation" :lighting]
[17:41][Check out the light maps][:"debug visualisation" :lighting :run]
[18:00][Make OpenGLChangeToSettings() zoom out of the light maps][:"debug visualisation" :lighting]
[18:44][Check out the light maps][:"debug visualisation" :lighting :run]
[19:09][Double-check out checkerboard code in ComputeLightPropagationWork()][:lighting :optimisation :research]
[20:01][Consider our checkerboard to be correct][:lighting :run]
[20:26][Make ComputeLightPropagationWork() checkerboard the ray caster calls in X][:lighting :optimisation]
[21:06][Check out the checkerboard light maps][:"debug visualisation" :lighting :run]
[21:34][Make ComputeLightPropagationWork() flip the checkerboard mode each frame][:lighting :optimisation]
[23:03][\~175k cycles (62% frame time) spent in 3072 calls to FullCast()][:lighting :performance :run]
[23:59][Make OpenGLChangeToSettings() zoom in to the light maps, and toggle them off in OpenGLEndFrame()][:"debug visualisation" :lighting]
[24:19][Admire our :lighting][:run]
[24:46][@xxthebigfoxx][This makes the propagation twice as slow, though, right?][:lighting]
[26:03][Consider our scope for optimising RayCast(): Casting against bundles of boxes][:lighting :optimisation :performance :research]
[31:42][Ray cast against bundles of boxes, respecifying RayCast() as BoxWiseRayCast() and introducing lighting_box_4x][:"data structure" :lighting :optimisation :performance]
[36:29][Consider how best to determine whether to push a box onto the stack or record a hit][:lighting :optimisation :research]
[40:27][Spec out the box bundle pushing in BoxWiseRayCast(), written to hopefully generate a conditional move][:lighting :optimisation]
[44:46][Consider approaching box-bundle ray casting another way][:lighting :optimisation :research]
[46:48][Consider turning this into a codex-style problem: Writing what we can do, then encoding a hierarchy that accommodates what we've written][:lighting :optimisation :research]
[51:10][Try making BoxWiseRayCast() always load 4-wide, and set a mask as it descends the box hierarchy, introducing light_box_stack_entry][:"data structure" :lighting :optimisation]
[55:12][Consider what the mask gains us][:lighting :optimisation :research]
[56:40][Write our dream version of box-bundle ray casting][:lighting :optimisation]
[57:30][Consider how to push the boxes most efficiently][:lighting :optimisation :research]
[58:43][Work through efficient box bundle pushing in BoxWiseRayCast(), removing light_box_stack_entry and augmenting lighting_box with IsLight_IsLeafContainer][:"data structure" :lighting :optimisation]
[1:08:11][20ms per frame, without ray casting][:lighting :optimisation :performance :run]
[1:08:41][Make SplitBox() set IsLight_IsLeafContainer][:lighting :optimisation]
[1:11:58][The ray casting doesn't fully happen][:lighting :optimisation :run]
[1:12:25][Scour SplitBox() for possible bugs][:lighting :optimisation :research]
[1:14:07][Check the :lighting :performance :statistics: 0 TotalPartitionsTested, 0 TotalPartitionLeavesUsed][:run]
[1:14:25][Scour RayCast() for possible bugs][:lighting :optimisation :research]
[1:15:50][Step in to RayCast(), wondering if ~RemedyBG can freeze threads][:lighting :optimisation :run]
[1:16:35][Disable multithreading in EndLightingComputation()][:threading]
[1:17:00][Step in to RayCast(), see TotalPartitionsTested increment on the first frame, but not on subsequent frames][:lighting :optimisation :run]
[1:21:14][Enable SplitBox() to unset LightBox_IsLeafContainer if it did split][:lighting :optimisation]
[1:22:30][50ms per frame, single-threaded, with a correctly lit world][:lighting :optimisation :performance :run]
[1:23:08][Enable multithreading in EndLightingComputation()][:threading]
[1:23:18][20ms per frame, with a correctly lit world][:lighting :optimisation :performance :run]
[1:25:25][Stop timing FullCast() and ComputeLightPropagationWork()][:"debug system" :lighting :optimisation :performance]
[1:26:11][20ms per frame, EndLightingComputation and Frame Display vying for the top consumer spot][:lighting :optimisation :performance :run]
[1:27:10][Disable the checkerboard in ComputeLightPropagationWork()][:lighting :optimisation]
[1:27:28][30ms per frame, 50% frame time in EndLightingComputation][:lighting :optimisation :performance :run]
[1:28:07][Toggle off the speculardiffuse transform in ComputeLightPropagationWork()][:lighting :optimisation]
[1:28:33][30ms per frame, 47% frame time in Frame Display, 40% frame time in EndLightingComputation][:lighting :optimisation :performance :run]
[1:28:44][Toggle on the speculardiffuse transform in ComputeLightPropagationWork()][:lighting :optimisation]
[1:28:51][2230ms per frame, up to 5070% frame time in EndLightingComputation][:lighting :optimisation :performance :run]
[1:29:36][Try making SplitBox() split boxes into eight][:lighting :optimisation]
[1:29:50][24ms per frame, 67% frame time in EndLightingComputation][:lighting :optimisation :performance :run]
[1:29:58][Try making SplitBox() split boxes into two][:lighting :optimisation]
[1:30:03][24ms per frame, 67% frame time in EndLightingComputation][:lighting :optimisation :performance :run]
[1:30:07][Try making SplitBox() split boxes into four][:lighting :optimisation]
[1:30:11][24ms per frame, 67% frame time in EndLightingComputation][:lighting :optimisation :performance :run]
[1:30:23][Consider casting more rays, four out of the same slot][:lighting :optimisation :research]
[1:31:46][30ms per frame, 48% frame time in EndLightingComputation][:lighting :optimisation :performance :run]
[1:31:56][Toggle off the speculardiffuse transform in ComputeLightPropagationWork()][:lighting :optimisation]
[1:31:58][30ms per frame, 44% frame time in EndLightingComputation][:lighting :optimisation :performance :run]
[1:32:08][Toggle on the speculardiffuse transform in ComputeLightPropagationWork()][:lighting :optimisation]
[1:32:10][30ms per frame, 48% frame time in EndLightingComputation][:lighting :optimisation :performance :run]
[1:32:26][Toggle off the speculardiffuse transform in ComputeLightPropagationWork()][:lighting :optimisation]
[1:32:29][24ms per frame][:lighting :optimisation :performance :run]
[1:32:40][Toggle on the speculardiffuse transform in ComputeLightPropagationWork()][:lighting :optimisation]
[1:32:44][26ms per frame][:lighting :optimisation :performance :run]
[1:33:17][Decrease tUpdateBlend from 8/60 to 4/60 in EndLightingComputation()][:lighting :optimisation]
[1:33:29][Check out the :lighting flicker][:optimisation :performance :run]
[1:33:42][Decrease tUpdateBlend from 4/60 to 1/60 in EndLightingComputation()][:lighting :optimisation]
[1:33:46][Check out the :lighting flicker][:optimisation :performance :run]
[1:33:56][Increase tUpdateBlend from 1/60 to 2/60 in EndLightingComputation()][:lighting :optimisation]
[1:33:58][Check out the :lighting flicker, looking for a stable solution][:optimisation :performance :run]
[1:34:36][Increase tUpdateBlend from 2/60 to 4/60 in EndLightingComputation()][:lighting :optimisation]
[1:34:44][Check out the :lighting flicker][:optimisation :performance :run]
[1:34:48][Decrease tUpdateBlend from 4/60 to 2/60 in EndLightingComputation()][:lighting :optimisation]
[1:34:51][Check out the :lighting flicker, and consider basing the tUpdateBlend on the light's contribution][:optimisation :performance :run]
[1:36:00][Increase tUpdateBlend from 2/60 to 8/60 in EndLightingComputation()][:lighting :optimisation]
[1:36:09][Check out the :lighting flicker][:optimisation :performance :run]
[1:36:52][Try making FullCast() oversample by 4×, modifying the EntropyIndex each loop][:lighting :optimisation :sampling]
[1:38:05][Check out the :lighting flicker][:optimisation :performance :run :sampling]
[1:38:48][Set tUpdateBlend to 2/60 in FullCast()][:lighting :optimisation]
[1:39:05][Admire the flicker-free :lighting][:optimisation :performance :run]
[1:39:43][Remove the oversampling from FullCast()][:optimisation :performance :run :sampling]
[1:42:23][Admire the :lighting][:optimisation :run]
[1:42:37][Q&A][:speech]
[1:43:04][@jim0_o][Q: Did you notice the instability in :timing was connected to the hovering text in the debug UI? The dip seemed correlated with the cursor being on the bar indicating the dip in the debug UI. (When you left the cursor on the same bar it had the dip every time it was passed over, not sure how logical that is.)]
[1:44:20][@srekel][Damn, the scrolling in your editor is just silky smooth, @cmuratori. Is it Emacs, ~4coder?]
[1:44:30][@elegacorp][Q: What do you think causes the flickering in these :lighting calculations? Folks in the chat were discussing it: Do you want the flicker that exists to be more intentional or is it there as a strange side effect of how the lighting is implemented?][:sampling]
[1:46:09][Integration Over Spatial Samples][:blackboard :lighting :sampling]
[1:50:03][@coder_gimmic][Q: As previously mentioned in chat, both isLight and IsLeafContainer were 0x1]
[1:50:17][Fix LightBox_IsLight to be 0x2][:lighting]
[1:51:05][@philoez98][Q: Talking about character :movement, will we implement a transaction system, something like [@naysayer88 Jon]'s?]
[1:52:45][Check [@naysayer88 Jon]'s status[ref
author="Jonathan Blow"
publisher=Twitter
title="People liked the discussion I did with Casey last week about character animation. So we're doing another one, about writing parsers for programming languages. This will happen tomorrow (Sunday) at 2:30pm PST!
I'll post the link when the time comes."
url=https://twitter.com/Jonathan_Blow/status/1244108520133292032]]
[1:53:47][@fcatalan][Q: Is this already the best lit 2-but-3D game in the whole history of gaming?][:lighting]
[1:54:06][@emperormetallix][Q: Are you using a diffusion / heat model to average the texture samples over space / time?][:lighting]
[1:58:52][@star_prankster][Q: Is it okay to use some features from later versions of C++ I may find useful, e.g. lambdas, templates?][:language]
[2:03:52][@jim0_o][Q: Would you mind explaining Transactional and vs. What?]
[2:08:08][Stop the recording now][:speech]
[/video]