cinera_handmade.network/cmuratori/hero/code/code427.hmml

89 lines
8.8 KiB
Plaintext
Raw Normal View History

2018-02-22 21:50:55 +00:00
[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Debugging Lighting Flicker" vod_platform=youtube id=wvkWI22gV3U annotator=Miblo]
[0:01][Recap and set the stage for the day doing :lighting :optimisation][:rendering :speech]
[2:37][:Run the game to see our current :lighting situation][:rendering]
[4:10][Determine to enable OpenGLRenderCommands() to correctly clear the backbuffer][:hardware :research]
[6:16][Step in to OpenGLRenderCommands() to see that it may be clearing the wrong render target][:hardware :rendering]
[7:02][Read through OpenGLRenderCommands(), to see if we are indeed clearing the wrong target][:hardware :rendering :research]
[8:05][Step through OpenGLRenderCommands() watching the OnPeelIndex][:hardware :rendering :run]
[8:37][Make OpenGLRenderCommands() increment the HeaderAt pointer inside the commands loop][:hardware :rendering]
[10:49][:Run the game to see that the clear is back to the correct behaviour][:hardware :rendering]
[12:31][Read through the :lighting code with a view to optimising it][:optimisation :rendering :research]
[15:33][:Run the game and point out that we are not leveraging our previously computed :lighting][:optimisation :rendering]
[16:27][Enable LightingTest() to use the previously computed :lighting emission][:optimisation :rendering]
[20:36][:Run the game to see flickering :lighting][:optimisation :rendering]
[21:07][Make LightingTest() save the new :lighting emission back]
[22:30][:Run the game to see that we're a lot slower][:lighting :optimisation :rendering]
[22:51][Reduce the RayCount in ComputeLightPropagation()][:lighting :optimisation :rendering]
[23:16][:Run the game to see that the :lighting is still very flickery][:optimisation :rendering]
[24:03][Increase the RetainedEmissionCoefficient in LightingTest()][:lighting :research :rendering]
[24:16][:Run the game to see the light spreading][:lighting :optimisation :rendering]
[25:24][Change ComputeLightPropagation() to use a power-decaying scheme][:lighting :rendering]
[27:50][:Run the game to see more reasonable :lighting][:optimisation :rendering]
[28:01][Tweak the BlendAmount, RayCount and IterationCount in ComputeLightPropagation()][:lighting :optimisation :rendering]
[29:32][:Run the game and consider that a single pass on the :lighting may be usable][:optimisation :rendering]
[30:39][Determine to rework ComputeLightPropagation() to compute the :lighting in a single pass][:optimisation :rendering :research]
[33:52][Rework ComputeLightPropagation() to compute the :lighting using a single-pass point collection-style scheme][:optimisation :rendering]
[47:31][Resolving discontinuities caused by snapping the :lighting samples to spatial partitions][:blackboard :geometry :rendering]
[53:09][Enable ComputeLightPropagation() to blend the :lighting emission by the DistanceSq][:optimisation :rendering]
[55:43][Describe the InvDistanceSq computation (1 / (1 + x²)) via a graph[ref
site=Google
page="graph (1 / (1 + x^2))"
url=https://encrypted.google.com/search?q=graph+%281+%2F+%281+%2B+x%5E2%29%29]][:mathematics :research]
[58:06][Continue to enable ComputeLightPropagation() to accumulate, blend and attenuate the light][:lighting :optimisation :rendering]
[1:16:47][:Run the game to see that we get a little grey :lighting, and step through ComputeLightPropagation()][:optimisation :rendering]
[1:18:03][Remove NextFree from lighting_point][:lighting :rendering]
[1:18:30][Continue to step through ComputeLightPropagation() inspecting the :lighting values][:rendering :run]
[1:22:06][Increase the Power value in ComputeLightPropagation()][:lighting :rendering]
[1:22:48][:Run the game to see that the :lighting is still flickering][:optimisation :rendering]
[1:24:24][Make ComputeLightPropagation() propagate forwards the previously computed :lighting][:optimisation :rendering]
[1:25:30][:Run the game and still see flicker, due to the unpredictable moonlight sampling][:lighting :rendering]
[1:28:09][Enable the BlendAmount in ComputeLightPropagation() to work as expected][:lighting :optimisation :rendering]
[1:31:10][:Run the game without the skylight, to find that BlendAmount works as expected][:lighting :optimisation :rendering]
[1:31:55][Reconsider the problem in light of the fact that a lower BlendAmount does not reduce the flicker][:lighting :rendering :research]
[1:36:38][Make ComputeLightPropagation() and AccumulateSample() sum the :lighting identically][:optimisation :rendering]
[1:38:37][:Run the game to see that it is exactly as it was, and step through ComputeLightPropagation()][:lighting :optimisation :rendering]
[1:40:50][Enable ComputeLightPropagation() to measure the total light removed and distributed][:lighting :optimisation :rendering]
[1:42:30][Step through ComputeLightPropagation() to see that TotalAdded is less than TotalRemoved, and that a very low BlendAmount still fails to prevent the flicker][:lighting :rendering :run]
[1:49:04][Read carefully through LightingTest() to double-check our assumptions][:lighting :optimisation :rendering :research]
[1:50:23][Make ComputeLightPropagation() sum in (and not clear) the AverageDirectionToLight][:lighting :optimisation :rendering]
[1:51:47][:Run the game to see the flicker-free :lighting][:optimisation :rendering]
[1:52:20][Work on the transmission amount in ComputeLightPropagation()][:lighting :optimisation :rendering]
[1:59:12][:Run the game and consider that we have a bug in the light removal][:lighting :optimisation :rendering]
[2:01:30][Q&A][:speech]
[2:03:04][@hengo][Q: I don't think your :lighting approach (it's kinda like photon mapping but in weird) will work. I think it's worth to rethink your whole idea][:rendering]
[2:03:33][@vateferfout][Q: Doesn't a surface need a hit to have its light reduced? If nothing hits the surface, the light will remain constant][:lighting :rendering]
[2:04:47][@enyo_enev][Q: EmitC += Weight*ContribC, isn't that wrong? It should be RemovedC I think. I may be wrong of course]
[2:05:21][@steplery][Q: What editor are you using?]
[2:05:28][@printf_armin][Q: Is the RPI still a thing?]
[2:05:41][Consider the bidirectional nature of the :lighting][:rendering :research]
[2:07:14][@hengo][Q: I study game engineering, so I had some courses about :rendering and :lighting. What you try is kinda over the top for a live game. I would advise to look into radiosity]
[2:08:46][@jamoflaw][Q: Raspberry Pi]
[2:10:00][Determine to make ComputeLightPropagation() bidirectional, using one array, tomorrow[ref
site=Wikipedia
page="Radiosity (computer graphics)"
url=https://en.wikipedia.org/wiki/Radiosity_(computer_graphics)]][:lighting :rendering :research]
[2:13:26][@hengo][Q: I thought radiosity approximates the light for one area and not trace single rays to the areas][:lighting :rendering]
[2:14:27][@kareshikraise][Q: McGuire's 2016 paper "Deep G Buffer for Stable Global Illumination"[ref
site=NvIDIA
page="Deep G-Buffers for Stable Global Illumination Approximation"
url=http://research.nvidia.com/publication/deep-g-buffers-stable-global-illumination-approximation] has a very good implementation of radiosity and his implementation of a deep g buffer is analogous to the depth peeling you are using in [~hero Handmade Hero]]
[2:16:51][@inlibertate][Are you implementing transparency?][:rendering]
[2:17:33][Reenable the particles and :run the game to show the transparency][:"particle system" :programming]
[2:18:18][@enyo_enev][Q: When you remove the light of the current frame RemoveC after, say, 5 frames, you have to in some way clear DestC and add only SourceC and restart the blend, otherwise it will add forever? Very small portions will get added constantly. Did I misunderstand something?][:lighting :rendering]
[2:20:07][Try to make ComputeLightPropagation() accumulate to a constant amount of light][:lighting :optimisation :rendering]
[2:24:31][:Run the game to see that this doesn't seem to be working, and step through it to see why][:lighting :optimisation :rendering]
[2:26:25][Try hard-setting SourceSum][:lighting :optimisation :rendering]
[2:27:40][:Run the game to see the effects of this][:lighting :optimisation :rendering]
[2:31:53][Double-check in ComputeLightPropagation() that the light is being clamped][:lighting :optimisation :rendering]
[2:32:49][:Run the game to determine that we still have issues][:lighting :optimisation :rendering]
[2:34:53][Consider that we are close to this working reliably][:lighting :rendering :speech]
[2:36:22][@staythirsty90][Q: What comes after :lighting? Any ideas?][:rendering]
[2:37:10][@inlibertate][Q: How big is the current codebase, loc wise?[ref
site=GitHub
page="AlDanial/cloc"
url=https://github.com/AlDanial/cloc]]
[2:39:23][@naysayer88][@cmuratori Can you work Yakety Sax into this program somehow?]
[2:40:25][@naysayer88][@cmuratori Change one note, like Vanilla Ice did]
[2:41:01][Shut it down][:speech]
[/video]