[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Improving Light Distribution" vod_platform=youtube id=tKi-DkS0YVo annotator=Miblo] [0:06][Recap and set the stage for the day][:speech] [0:30][Plug the SendOwl-powered contribution page[ref site="Handmade Hero" page="Handmade Community Recurring Contributions" url=https://handmadehero.org/patreon.html]][:admin] [7:44][:Run the game to see our current :lighting solution][:"debug visualisation" :rendering] [11:25][Read through ComputeLightPropagation()][:lighting :rendering :research] [15:37][Bouncing light between emitters and reflectors][:blackboard :lighting :rendering] [18:03][Try to make ComputeLightPropagation() reduce the ray count per iteration][:lighting :rendering] [18:54][:Run the game to see how that looks][:lighting :rendering] [22:54][Try to decrease the voxel resolution][:lighting :rendering] [23:30][:Run the game to see much smoother :lighting][:rendering] [24:23][Make RayCast() tint the scene grey][:lighting :rendering] [24:54][:Run the game to see how that looks with the skylight][:lighting :rendering] [25:48][:Lighting Improvement][:blackboard :rendering] [29:22][Check out Ward's 'Irradiance Caching Algorithm'[ref author="Gregory J. Ward" title="Irradiance Caching Algorithm" url=http://cgg.mff.cuni.cz/~jaroslav/papers/2008-irradiance_caching_class/03-greg-ic.pdf]][:lighting :rendering :research] [31:36][Irradiance cache][:blackboard :lighting :rendering] [33:21][Photon tracing][:blackboard :lighting :rendering] [34:07][Replace the notion of next emission weight from ComputeLightPropagation() with an ever-decreasing accumulation of colour per ray cast iteration][:lighting :rendering] [35:46][:Run the game to see that the light looks a little more correct][:lighting :rendering] [36:16][Prevent RayCast() from producing ambient light][:lighting :rendering] [36:36][:Run the game to check out the :lighting solution without the ambient light][:rendering] [37:06][Remove NextEmitW from lighting_element][:lighting :rendering] [37:39][:Run the game to see the straight photon distribution][:lighting :rendering] [39:36][Consider how to record the photon distribution][:lighting :rendering] [40:24][Try to make ComputeLightPropagation() accumulate the emittance colour][:lighting :rendering] [42:17][:Run the game to see the scene getting brighter with each iteration][:lighting :rendering] [45:46][Try toggling off the hero in AddPlayer()][:"entity system" :rendering] [46:19][:Run the game to see the :lighting solution without the hero obscuring great swathes of it][:rendering] [47:10][Try to prevent GatherFinalLighting() from accumulating light but just use the emitter colour and destination normal directly][:lighting :rendering] [48:46][:Run the game to see the :lighting solution without the final gather][:rendering] [50:00][Try to make ComputeLightPropagation() modify the AverageDirectionToLight by its power][:lighting :rendering] [53:02][:Run the game to see how that looks, and consider improving the voxel scheme, hemisphere sampling and sprite cards][:lighting :rendering] [56:37][Enable ComputeLightPropagation() to apply skylight contribution specially][:lighting :rendering] [1:02:46][:Run the game with our skylight in place][:lighting :rendering] [1:05:09][Make ExtractReflectorsFromQuads() clear the IncidentLight and AverageDirectionToLight][:lighting :rendering] [1:06:38][:Run the game to see the more correct :lighting solution][:rendering] [1:07:31][Check out CodeItNow's 'Better Sampling' article[ref site=CodeItNow page="Better Sampling" url=http://www.rorydriscoll.com/2009/01/07/better-sampling/]][:lighting :rendering :research] [1:12:31][Make SampleHemisphere() merely flip the result if the randomly chosen sample is in the reverse hemisphere][:lighting :rendering] [1:14:34][:Run the game to see how that looks][:lighting :rendering] [1:15:35][Consider adding a Sun-style light to ComputeLightPropagation()][:lighting :rendering] [1:16:58][Install ColorCop[ref site=ColorCop url=http://colorcop.net/]][:admin] [1:18:49][Introduce the notion of a Sun-style light in ComputeLightPropagation()][:lighting :rendering] [1:23:15][:Run the game to see our sunlit scene][:lighting :rendering] [1:24:25][Make ComputeLightPropagation() create a more powerful sun, and sample its direction][:lighting :rendering] [1:29:37][:Run the game to see how that looks][:lighting :rendering] [1:29:57][Prevent ComputeLightPropagation() from bundling the sky color into the sun color][:lighting :rendering] [1:30:29][:Run the game to see this more directional sun][:lighting :rendering] [1:31:59][Introduce AccumulateSample() for ComputeLightPropagation() to call][:lighting :rendering] [1:37:23][:Run the game to see no change][:lighting :rendering] [1:37:54][Temporarily try to get rid of the sunlight][:lighting :rendering] [1:38:10][:Run the game without the sunlight][:lighting :rendering] [1:38:39][Replace IncidentLight from lighting_element with the Hadamard product of EmitC][:lighting :rendering] [1:41:01][:Run the game to see how that looks][:lighting :rendering] [1:41:27][Toggle off most of ComputeLightPropagation()][:lighting :rendering] [1:41:56][:Run the game to see no light][:lighting :rendering] [1:42:03][Reenable UpdateAndRenderWorld() to call PushLight()][:lighting :rendering] [1:42:17][:Run the game to see the current :lighting solution][:rendering] [1:42:51][Glimpse into the future][:speech] [1:43:20][Q&A][:speech] [1:43:43][@praet_a51][Q: Why is there a dark horizontal band on the Red / Blue voxels (approximately at the height of bottom of the push light box)? Note: Possibly fixed at the end of stream render] [1:45:23][Try to increase the voxel resolution][:lighting :rendering] [1:45:36][:Run the game to see that our :lighting samples are now too isolated][:rendering] [1:46:58][@ataradov][Q: Is there a good tutorial for using (modern) OpenGL in CAD-like applications, where you need to draw many sharp and precise lines and filled planes, mostly in 2D?[ref author="Nicolas P. Rougier" title="Antialiased 2D Grid, Marker, and Arrow Shaders" url=http://jcgt.org/published/0003/04/01/paper.pdf]] [1:49:14][@onanymous][Q: Has anyone tried to give you an actual 3D model of a cartoon spruce by now?] [1:49:25][@inked_in_java][Q: I remember you mentioning you didn't go to college... how did you learn C?][:language] [1:50:30][@pytzy][Q: In how much time did you learn :"game development"?][quote 606] [1:52:03][@sired22][Q: What's the most "oops, I may have deleted the database" thing you have seen?] [1:53:01][@onanymous][Q: Does C++17 bring anything you like? Do your metaprograms output templates at all?][:language] [1:54:57][@sneakybob_wot][Q: What's your favourite game from your youth? M.U.L.E. on the Atari 8-bit for me] [1:55:44][@demiplume][Q: I'm looking for the best tools to begin learning coding / :"game design" from scratch. Is visual studio, in your opinion, a good start?] [1:56:33][@quickshift_][Q: Did you have any input on JAI?][:language] [1:58:24][@winter_squirrel][Q: Do you have any :language in mind to replace C++?] [2:01:27][@printf_armin][Q: What is your experience with macOS, especially their “cocoa :API”?] [2:01:31][@inked_in_java][Q: I see you switched to ~4coder from emacs. How do you like 4coder compared to emacs?] [2:02:34][@onanymous][Q: Do you agree with those who say "source code is text" or do you think we should push for more structure awareness in editors and tools?] [2:02:44][@quiensab3][Q: What will come next after we're done with :lighting?] [2:03:05][@winter_squirrel][Q: Is there ever gonna be a handmade compiler?] [2:03:29][Close this down with another plug of the SendOwl-powered contribution page[ref site="Handmade Hero" page="Handmade Community Recurring Contributions" url=https://handmadehero.org/patreon.html]][:speech] [/video]