[video output=day412 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Debugging Voxel Interpolation" vod_platform=youtube id=x0hWfKH4x_w annotator=Miblo]
[0:07][Recap and set the stage for the day][:speech]
[2:01][:Run the game to see our current :lighting situation][:rendering]
[5:42][Consider the current problems in the :lighting][:rendering :run]
[9:14][Determine to validate RayCast()][:speech]
[12:44][Make RayCast() tint the light grey][:lighting :rendering]
[14:13][:Run the game to see less light in the scene][:lighting :rendering]
[14:41][Investigate the possibility that we are wrapping][:lighting :rendering]
[16:46][Make GatherFinalLighting() set the IncidentLight to pure red][:lighting :rendering]
[17:21][:Run the game and do not see a red scene][:lighting :rendering]
[18:20][:Run the game and switch away from the "just emitters" :"debug visualisation"][:lighting :rendering]
[19:04][Scrutinise the :lighting code][:rendering :research]
[22:46][Make CompileZBiasProgram() multiply the DirFalloff in to the final result][:hardware :lighting :rendering]
[27:20][:Run the game to see a little difference, but still no ambient :lighting][:rendering]
[28:27][Read through GatherFinalLighting() and OutputLightingTextures()][:research :lighting :rendering]
[30:17][Step in to OutputLightingTextures() and inspect the IncidentLight, Colour and Directional values][:lighting :rendering]
[32:15][Note that we don't have a way to directly visualise :lighting quads][:"debug visualisation" :rendering :run]
[35:05][Make CompileZBiasProgram() renormalise the contribution colour if the alpha is greater than 0][:hardware :lighting :rendering]
[36:04][:Run the game to see still nonsense results][:lighting :rendering]
[36:40][Hard set the :lighting colour to green in CompileZBiasProgram()][:hardware :rendering]
[36:59][:Run the game to see pure green, except on the blue surface][:lighting :rendering]
[37:37][Verify that all pure colours hard set by CompileZBiasProgram() produce the expected results][:hardware :lighting :rendering]
[38:56][:Run to see pure white and note that the voxel interpolation isn't totally busted][:lighting :rendering]
[39:27][Hard set the LightC to white and the DirFalloff to 1.0f in CompileZBiasProgram()][:hardware :lighting :rendering]
[41:06][:Run the game to see white light, but some incorrectly dark spots][:lighting :rendering]
[43:14][Try to make CompileZBiasProgram() set the colour to pure yellow where there is no light sample][:hardware :lighting :rendering]
[44:25][:Run the game to see spots of yellow in unexpected places][:lighting :rendering]
[44:51][Temporarily prevent CompileZBiasProgram() from setting the colour to yellow, and instead set the SurfaceReflect directly to the light colour, rather than multiplying it in][:hardware :lighting :rendering]
[45:45][:Run the game to see the incoming light colour][:lighting :rendering]
[46:04][Make CompileZBiasProgram() set the colour to pure yellow where there is no light sample][:hardware :lighting :rendering]
[46:20][:Run the game to see yellow where we cannot compute :lighting results][:rendering]
[47:09][Try to make CompileZBiasProgram() set the colour to red][:hardware :lighting :rendering]
[47:18][:Run the game to see some red places][:lighting :rendering]
[47:39][Make CompileZBiasProgram() track the Contrib value all the way down the pipeline and introduce VoxLerp() to use this value][:hardware :lighting :rendering]
[50:56][:Run the game to see that it already looks better][:lighting :rendering]
[51:34][Begin to enable VoxLerp() to handle the case when the :lighting contribution is 0][:hardware :rendering]
[53:01][Consider how better to handle voxels that have no :lighting contribution][:rendering :speech]
[53:38][Revert the passing of Contrib() all down the pipe in CompileZBiasProgram()][:hardware :lighting :rendering]
[54:17][Take a quick break][:admin]
[55:03][:Run the game to see our current red-tinted :lighting situation][:rendering]
[55:44][Make OutputLightingTextures() gather the colour of voxels whose :lighting contribution is 0 from their neighbour][:lighting :rendering]
[1:00:48][:Run the game to see no difference][:lighting :rendering]
[1:01:27][Make OutputLightingTextures() zero-initialise the Neighbour][:lighting :rendering]
[1:01:36][:Run the game and consider that the artifacts may only be occurring on voxels at the edge of the scene][:lighting :rendering]
[1:04:47][Temporarily assert in OutputLightingTextures() that Neighbor != 0][:lighting :rendering]
[1:05:10][:Run the game to determine that we are doing some filling][:lighting :rendering]
[1:07:44][Make CompileZBiasProgram() colour the voxels by their location][:"debug visualisation" :hardware :lighting :rendering]
[1:09:10][:Run the game to see this :"debug visualisation" confirming that the voxel interpolation is fine][:lighting :rendering]
[1:10:02][Make CompileZBiasProgram() colour the voxels green / red to indicate the presence / absence of :lighting samples][:"debug visualisation" :hardware :rendering]
[1:10:49][:Run the game to see this :"debug visualisation"][:lighting :rendering]
[1:12:14][Toggle OutputLighting() on][:"debug visualisation" :lighting :rendering]
[1:12:27][:Run the game to see the :lighting solution visualised in voxel form][:"debug visualisation" :rendering]
[1:14:06][Change OutputLightingTextures() to perform the Neighbor filling in a for() loop expanded to the whole voxel][:lighting :rendering]
[1:17:36][:Run the game to see that we are filling nearly everything][:"debug visualisation" :lighting :rendering]
[1:17:55][Introduce ClampVox() to clamp the voxel lookups only to the neighbouring voxels that are in the scene][:hardware :lighting :rendering]
[1:20:17][:Run the game to see that the red patches are gone][:"debug visualisation" :lighting :rendering]
[1:20:55][Make CompileZBiasProgram() take the LIGHT_LOOKUP positions to enable easy tweaking of the clamp][:hardware :lighting :rendering]
[1:23:37][:Run the game to see the same :"debug visualisation"][:lighting :rendering]
[1:23:50][Remove the red / green :"debug visualisation" from CompileZBiasProgram()][:hardware :lighting :rendering]
[1:24:17][:Run the game to see spherical weirdness][:"debug visualisation" :lighting :rendering]
[1:24:50][Consider how CompileZBiasProgram() should compute the Contrib value][:hardware :lighting :rendering :speech]
[1:29:36][Make CompileZBiasProgram() multiply in the VoxInvCelDim to the Contrib value][:hardware :lighting :rendering]
[1:32:30][:Run the game and still see the weird gradient falloff patterns][:lighting :rendering]
[1:33:12][Temporarily make CompileZBiasProgram() hard code the Contrib to 1][:"debug visualisation" :hardware :lighting :rendering]
[1:34:27][:Run the game to see no gradient falloff pattern][:lighting :rendering]
[1:34:35][Try to make CompileZBiasProgram() factor in the dimensions of all neighbouring voxels to the Contrib value][:hardware :lighting :rendering]
[1:36:09][:Run the game to see that it's a little better][:lighting :rendering]
[1:36:29][Make CompileZBiasProgram() factor in to the Contrib value merely the :lighting sample distance][:hardware :rendering]
[1:37:12][:Run the game to see no gradient falloff][:"debug visualisation" :lighting :rendering]
[1:37:36][Prevent CompileZBiasProgram() from stomping on the LightC][:hardware :lighting :rendering]
[1:38:02][:Run the game to see fewer artifacts][:lighting :rendering]
[1:38:24][Make CompileZBiasProgram() hard set the DirFalloff to 1.0f][:hardware :lighting :rendering]
[1:39:18][:Run the game to see pure red everywhere][:lighting :rendering]
[1:39:58][Make CompileZBiasProgram() set the LightC to the LightD][:"debug visualisation" :hardware :lighting :rendering]
[1:41:00][:Run the game to see this :"debug visualisation"][:lighting :rendering]
[1:45:00][Read through the :lighting code to consider which routines we could verify][:lighting :rendering :research]
[1:48:44][Make CompileZBiasProgram() set the LightC to WorldN][:"debug visualisation" :hardware :lighting :rendering]
[1:48:56][:Run the game to see that the world normals look reasonable][:"debug visualisation" :lighting :rendering]
[1:49:56][Prevent CompileZBiasProgram() from stomping on the LightC][:"debug visualisation" :hardware :lighting :rendering]
[1:50:02][:Run the game and consider what may be causing the artifacts][:lighting :rendering]
[1:53:00][Prevent GatherFinalLighting() from stomping on the IncidentLight and AverageDirectionToLight][:"debug visualisation" :lighting :rendering]
[1:53:11][:Run the game to see the :lighting solution][:rendering]
[1:53:53][Prevent RayCast() from tinting the light grey][:lighting :rendering]
[1:54:17][:Run the game and note that we're getting closer to sane][:lighting :rendering]
[1:54:48][Make CompileZBiasProgram() attenuate the SurfaceReflect by the Light][:hardware :lighting :rendering]
[1:55:15][:Run the game to see that it's getting a lot better][:lighting :rendering]
[1:58:33][Consider the next steps][:lighting :rendering :run]
[1:59:48][Re-enable RayCast() to tint the light grey][:lighting :rendering]
[2:00:08][:Run the game to see the brighter scene][:lighting :rendering]
[2:00:44][Make GatherFinalLighting() divide the RayCount in to the IncidentLight][:lighting :rendering]
[2:01:57][:Run the game to see the ambient grey light][:lighting :rendering]
[2:03:15][Q&A][:speech]
[2:03:47][@sadisttrombone][Q: Regarding win calc, the size of the window determines how many buttons are shown. You can either stretch the window vertically or you can press the up arrow button (in the UI) to make the shown buttons shift into the other set like 1/x and e^x]
[2:04:45][@vkar2][Q: I think the error in the color are in the same position where the normals calculation looks funny][:lighting :rendering]
[2:05:43][@radovik][Q: Not sure if you heard, but someone rewrote depends.exe for win 10[ref
    site=GitHub
    page=lucasg/dependencies
    url=https://github.com/lucasg/dependencies]]
[2:08:22][@dragoonx6][Q: Seeing you used emacs without code completion, and now ~4coder, how do you work without code completion? Don't you think it could help you with both productivity and discoverability? I'm a fan of YouCompleteMe for vim]
[2:10:26][@longboolean][Q: When the :lighting is in realtime will that tend to hide some of the more minor artifacts?][:rendering]
[2:11:37][@dragoonx6][Q: Like in this gif[ref
    site=SadBart-Small.gif
    url=https://s3.amazonaws.com/f.cl.ly/items/2P0b0c3N2m2m2l2L273B/SadBart-Small.gif]]
[2:13:05][@dragoonx6][Q: It's showing a heads up display of the possible arguments]
[2:13:56][@sired22][Q: I know finding a bad API is not hard, but out of curiosity did you ever run into an API that was great to work with? One that you seemed to magically just click with?]
[2:17:48][@dragoonx6][What about this gif?[ref
    site="GitHub User Content"
    url=https://camo.githubusercontent.com/1f3f922431d5363224b20e99467ff28b04e810e2/687474703a2f2f692e696d6775722e636f6d2f304f50346f6f642e676966]]
[2:20:40][Close everything down][:speech]
[/video]
