[video output=day409 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Smoother Blending of Lighting Samples" vod_platform=youtube id=_ba1Mxaa2Ks annotator=Miblo] [0:08][Recap and set the stage for the day, proceeding with lighting] [1:00][Run the game to see our current lighting solution] [4:48][Milton feature request: Hide title bar] [5:39][Blackboard: Light Interpolation] [11:50][Blackboard: Weighted sampling of multiple lighting samples per voxel] [16:35][Run the game to see the lighting discontinuities] [17:05][handmade_opengl.cpp: Make SumVoxelLight() in CompileZBiasProgram() map the lighting sampling to the radial dimensions of the voxels] [18:33][Run the game to see the circular blending] [19:15][handmade_opengl.cpp: Make SumVoxelLight() in CompileZBiasProgram() constrain the lighting sampling to each voxel] [24:49][Run the game to see the constrained and sparse circular lighting] [26:22][handmade_opengl.cpp: Reduce the size of the voxels] [27:08][Run the game to see the denser lighting] [30:38][handmade_opengl.cpp: Try to set the surface reflectance directly to the lighting colour] [31:08][Run the game to see that we are not storing the lighting premultiplied] [33:31][handmade_opengl.cpp: Increase the size of the voxels] [34:23][Run the game to visualise the lighting sampling, and consider how to improve the voxel lookup scheme] [40:09][handmade_opengl.cpp: Make CompileZBiasProgram() only sum eight voxels] [41:57][Blackboard: Interpolating lighting between fewer voxels] [43:38][handmade_opengl.cpp: Make CompileZBiasProgram() sample from the centre of voxels] [45:22][Run the game to see the incorrect sampling] [46:14][Blackboard: Sampling from the centre of voxels] [47:20][handmade_opengl.cpp: Correctly make CompileZBiasProgram() offset the lighting sampling to the voxel centres] [47:53][Run the game to see the incomplete sampling] [48:23][handmade_opengl.cpp: Enable SumVoxelLight() in CompileZBiasProgram() to normalise the lighting samples in each voxel, and then interpolate between the voxels] [56:27][Run the game to see the square, yet incorrect blending] [57:43][handmade_opengl.cpp: Correctly compute VoxF] [59:27][Run the game to see the stable, bilinearly filtered lighting] [1:01:22][handmade_opengl.cpp: Make SumVoxelLight() modulate the voxel's lighting by a contribution value] [1:03:21][Run the game to see the modulated lighting] [1:03:51][handmade_platform.h: Reduce the size of the voxels] [1:04:20][Run the game to see the light blending] [1:04:45][handmade_opengl.cpp: Play with the contribution computation] [1:06:23][Run the game and consider adding directional information to the voxels] [1:09:56][handmade_platform.h: Consider the possibility of shrinking the lighting data] [1:12:18][handmade_platform.h: Add D (direction) to the lighting_textures struct] [1:14:32][handmade_opengl.cpp: Introduce a DSampler] [1:23:12][Run the game to see that everything is black] [1:23:31][handmade_render_group.cpp: Determine to enable the lighting scheme to use the lighting directions] [1:27:38][handmade_render_group.cpp: Read LightingTest() and determine that it is incorrect] [1:34:44][handmade_render_group.cpp: Reorganise LightingTest()] [1:42:56][Run the game to see our lighting looking roughly the same] [1:43:49][handmade_render_group.cpp: Add IncidentLight and AverageDirectionToLight to the lighting_element] [1:47:18][Close the stream as normal][:speech] [/video]