[video output=day395 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Basic Multigrid Lighting Down Iteration" vod_platform=youtube id=poQ4PZ_vQz0 annotator=Miblo]
[0:07][Recap and set the stage for the day]
[1:12][Run the game and consider how to make the light spread further]
[2:48][handmade_opengl.cpp: Make CompileFakeSeedLighting() set the Front and Back emitter colours to 100]
[3:40][Run the game and check out the light propagation]
[6:04][Blackboard: Multigrid Up and bilinear sampling]
[9:59][handmade_opengl.cpp: Introduce ManualSample() in CompileMultiLightUp()]
[12:21][Run the game to see everything is fine]
[12:29][handmade_opengl.cpp: Determine to enable ManualSample() to perform the bilinear sampling[ref
    site="OpenGL Registry"
    page="The OpenGL Shading Language 1.50 Quick Reference Card"
    url="https://www.khronos.org/files/opengl-quick-reference-card.pdf"]]
[16:27][handmade_opengl.cpp: Force OpenGLChangeToSettings() to set the TexWidth to 1024 and TexHeight to 512]
[16:44][Run the game to see how the downsampling occurs at this perfect 2:1 ratio]
[18:55][Blackboard: Blending light sources]
[23:25][Blackboard: Destructive downsampling]
[27:26][handmade_opengl.cpp: Make OpenGLChangeToSettings() perform a safe divide-by-two and use the RenderWidth and RenderHeight again]
[28:19][Run the game and see the light propagating up correctly]
[29:46][handmade_opengl.cpp: Introduce Light() in CompileFakeSeedLighting(), and create a second light source]
[38:45][Run the game to see how the lights blend]
[41:45][handmade_opengl.cpp: Make CompileFakeSeedLighting() black out the whole area]
[42:53][Run the game and consider having separate textures for emission and surface]
[46:56][handmade_opengl.cpp: Make CompileFakeSeedLighting() set the NP to 0, 1, -10, and run the game to see that]
[48:14][Determine to implement downward propagation in CompileMultiLightDown()]
[50:29][Blackboard: Downward light propagation, with reflectance from neighbours]
[57:14][Consult 'Dynamic Ambient Occlusion and Indirect Lighting'[ref
    site="NVIDIA Developer"
    page="Chapter 14. Dynamic Ambient Occlusion and Indirect Lighting"
    url="https://developer.nvidia.com/gpugems/GPUGems2/gpugems2_chapter14.html"]]
[1:05:48][Blackboard: Disk-to-disk form factor approximation[ref
    site="NVIDIA Developer"
    page="Chapter 14. Dynamic Ambient Occlusion and Indirect Lighting"
    url="https://developer.nvidia.com/gpugems/GPUGems2/gpugems2_chapter14.html"]]
[1:15:24][Consider having our reflectors as disks and emitters as spheres]
[1:16:45][handmade_opengl.cpp: Implement downward propagation in CompileMultiLightDown()]
[1:19:47][Blackboard: Sampling light from the parent and neighbour grids]
[1:23:43][handmade_opengl.cpp: Enable CompileMultiLightDown() to sample from the parent grid[ref
    site="OpenGL Registry"
    page="The OpenGL Shading Language 1.50 Quick Reference Card"
    url="https://www.khronos.org/files/opengl-quick-reference-card.pdf"]]
[1:35:51][handmade_opengl.cpp: Introduce TransferLight() in CompileMultiLightDown()]
[1:39:50][Blackboard: Computing NPz]
[1:40:45][handmade_opengl.cpp: Complete the implementation of ParentSample() in CompileMultiLightDown()]
[1:43:44][handmade_opengl.cpp: Introduce ReconstructNormal() and ReconstructPosition() for ParentSample() to call in CompileMultiLightDown()]
[1:45:40][handmade_opengl.cpp: Fix compile errors in CompileMultiLightDown()]
[1:48:44][handmade_opengl.cpp: Implement the downward phase in ComputeLightTransport(), transferring light from less-detailed light buffers to higher-detailed ones]
[1:54:05][handmade_opengl.cpp: Introduce a version of UseProgramBegin() for multigrid_light_down_program]
[1:55:37][handmade_opengl.cpp: Fix compile errors]
[1:58:48][Run the game, but simply running is not going to get us very far]
[1:59:56][Q&A][:speech]
[2:00:08][handmade_opengl.cpp: Fix up the DestFrontEmit and DestBackEmit computations]
[2:01:00][@desuused][Have you seen Doom 2016 rendering paper?[ref
    site="Adrian Courrèges"
    page="DOOM (2016) - Graphics Study"
    url="http://www.adriancourreges.com/blog/2016/09/09/doom-2016-graphics-study/"]]
[2:01:24][@fierydrake][You have an Up in your Down line]
[2:01:29][handmade_opengl.cpp: Fix up the TransferLight Down call]
[2:01:34][On Doom's rendering]
[2:02:47][@elitetk][I'm on Day 18 and I'm looking at the stream for the first time and I'm wondering, what happened? I have these sweet-ass colourful gradients and sound, and all you have is two round circles!]
[2:03:04][handmade_opengl.cpp: Toggle off the debug lighting and run the game to show our actual state]
[2:04:28][@sharlock93][Do you usually do a lot of programming before you run, like you did today, or do you program a bit then run and debug? Is it because you know what you are doing that you take big chunks of programming then run?]
[2:06:03][@vaualbus][Try running now that we fixed the stupid error in the shader]
[2:06:47][@traxirage][How long do you think this project is gonna take?]
[2:07:03][@flagmyname][New here, sorry if this was asked before. If you were working on this on your own time (not streaming / teaching or anything), how long do you think it would take you to complete?]
[2:08:51][@justsaul][Do you think that game engines have a place or is it just pure evil?]
[2:10:23][@bialy90722][Do you have any good practice to keep your brain motivated after months and months of programming?]
[2:12:26][@sharlock93][If we feed you sandwiches and keep you alive, what would you work on for the rest of your life?]
[2:13:27][@sharlock93][I'm down with patreoning Molly so I think you have no worries if we all chip in]
[2:14:24][@theonlyrealtodd][Have you found the need to write certain algorithms directly in assembly for performance reasons?]
[2:17:46][@zilarrezko][Any word on getting other programmers to work on some code on Handmade Hero? Shawn (adult hour edition) for graphics, Fabian for optimizations, Jon for game design, Sean to dance and party, etc.]
[2:21:05][@garryjohanson][So you know stuff about 360 hardware? How much of a problem was in-order execution? Did that cause performance problems? Do you view out-of-order execution as the performance convenience it claims to be, at least with respect to instruction-level parallelism?]
[2:26:52][A few words on the Load-Hit-Store penalty of PowerPC]
[2:30:33][@Zilarrezko][If you had SIMD code for SSE2 but also had the same algorithms for AVX 256-bit, is there a way to only run the AVX in the shipping version if the hardware supports it? Must it be decided at compile time?]
[2:33:37][Wind it down][:speech]
[/video]
