[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Smoothing Light Samples Over Time" vod_platform=youtube id=0Kz7OnS2E-8 annotator=Miblo] [0:01][Recap and set the stage for the day][:speech] [1:26][:Run the game to see the flickering :lighting][:rendering] [2:42][Flicker / Sampling: "Monte Carlo" → "Random" → "Stochastic"][:blackboard :lighting :prng :rendering] [6:49][How Monte Carlo - as opposed to uniform - sampling can effectively estimate shapes][:blackboard :prng] [13:50]["Importance" sampling][:blackboard :prng] [15:23]["Importance" sampling in the context of :lighting][:blackboard :prng :rendering] [17:43][The cosθ property of surfaces][:blackboard :geometry] [22:33][Our current "Pure Monte Carlo" sampling scheme, and how SampleHemisphere() is biased][:blackboard :lighting :prng :rendering] [26:18][Our problem: Low Sampling Rate vs Discontinuities in the Function][:blackboard :lighting :rendering] [33:35][:Run the game to see the flickering][:lighting :rendering] [34:03][Make ComputeLightPropagation() use a different random series every frame][:lighting :rendering] [35:13][:Run the game to see this even more pronounced flickering][:lighting :rendering] [37:03][Provide the ability to toggle the :lighting computation][:rendering] [39:23][:Run the game and recompute the :lighting at will][:rendering] [40:07][Dramatically increase the RayCount in ComputeLightPropagation()][:lighting :rendering] [40:20][:Run the game to see less flicker][:lighting :rendering] [40:46][Reduce the RayCount in ComputeLightPropagation()][:lighting :rendering] [40:55][:Run the game to see more flicker][:lighting :rendering] [42:14][Consider how to perform temporal smoothing on the :lighting][:rendering :speech] [45:51]["Spatial Correspondence"][:blackboard :lighting :rendering] [47:38][Remembering light indices][:blackboard :lighting :memory :rendering] [51:32][Add a LightingIndex to entity_visible_piece][:lighting :memory :rendering] [56:05][Consider examples of poor spatial correspondence][:rendering :speech] [57:41][Upgrade PushQuad() to set a LightingIndex][:lighting :rendering] [59:24][:Run the game and see no :lighting][:rendering] [59:51][Make PushCube() set LightCount and LightIndex][:lighting :rendering] [1:02:07][:Run the game to see :lighting restored on the cubes but not the sprites][:rendering] [1:02:43][Enable PushCube() to read from the LightIndexStore][:lighting :rendering] [1:09:40][:Run the game to see that it doesn't work][:lighting :rendering] [1:10:12][Add DebugLightIndex to game_mode_world for PushLight() to use][:lighting :rendering] [1:11:54][:Run the game to see our :lighting][:rendering] [1:13:13][Enable ExtractReflectorsFromQuads() to use the LightIndex][:lighting :rendering] [1:15:22][:Run the game to see that the light isn't stable][:lighting :rendering] [1:17:11][Step in to ExtractReflectorsFromQuads() and inspect the Solution][:lighting :rendering :run] [1:20:17][Add LastEmit and LastDirection to the lighting_solution so ExtractReflectorsFromQuads() can mix in those values at the end of the routine][:lighting :rendering] [1:25:37][:Run the game to see that we have four frames of lag on the :lighting][:rendering] [1:25:49][Enable ComputeLightPropagation() to use our tracked LastEmit and LastDirection][:lighting :rendering] [1:27:30][:Run the game to see that the walls didn't get any :lighting][:rendering] [1:28:45][:Run the game to see less flicker][:lighting :rendering :run] [1:29:16][Make ComputeLightPropagation() interpolate the :lighting across 10 frames][:rendering] [1:29:20][:Run the game to see the :lighting][:rendering] [1:29:36][Make ComputeLightPropagation() interpolate the :lighting across 20 frames][:rendering] [1:29:38][:Run the game to see the :lighting][:rendering] [1:29:46][Make ComputeLightPropagation() interpolate the :lighting across 100 frames][:rendering] [1:29:49][:Run the game to see the :lighting][:rendering] [1:30:26][Make ComputeLightPropagation() interpolate the :lighting across 10 frames, and cast more rays][:rendering] [1:30:42][:Run the game and tweak our latency and RayCount][:lighting :rendering] [1:32:00][Step in to ComputeLightPropagation() and inspect the Solution][:lighting :rendering :run] [1:34:08][Make ComputeLightPropagation() normalize or zero the AverageDirectionToLight interpolation][:lighting :rendering] [1:34:41][:Run the game to see that that fixed it][:lighting :rendering] [1:35:06][Reinsert the snake][:"entity system"] [1:35:35][:Run the game to see the :lighting with the snake, and the more noticeable lag][:rendering] [1:36:32][Q&A][:speech] [1:37:00][Note in ComputeLightPropagation() to finish implementing and debugging :lighting][:admin :rendering] [1:38:36][@ataradov][Q: Yesterday someone asked if it will be beneficial to have more test scenes for :lighting tests. And this was never answered][:rendering] [1:38:48][@areriff][Q: Don't you use the todo.txt in the code directory to make notes?] [1:39:09][@longboolean][Q: Found this video,[ref site="YouTube" page="AI Learns Noise Filtering For Photorealistic Videos | Two Minute Papers #215" url=https://www.youtube.com/watch?v=YjjTPV2pXY0] seems related to what we are talking about (render denoising). What is your take on the use of machine learning to approach problems like these?][:rendering :ai] [1:39:38][Wrap up early][:speech] [/video]