[video output=day596 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Fleshing Out Kd-Tree Traversal" vod_platform=youtube id=uD7bL5VUy0c annotator=Miblo]
[0:01][Welcome to the stream][:speech]
[0:52][Determine to implement the k-d tree loop, demoing the :lighting variance][:run]
[1:47][Describe our current k-d tree code in RayCast()][:lighting :research]
[6:23][Stackless k-d tree traversal][:lighting :research]
[8:33][More efficient k-d tree side selection][:lighting :optimisation :research]
[10:54][Make RayCast() directly index the StartSide and EndSide, rather than masked Select() them][:lighting :optimisation]
[15:52][On the need to disambiguate the negative and positive sides, to correctly test the EndSideBit][:lighting :optimisation :research]
[18:11][Disambiguating the negative and positive sides: Storing a multiplier, -1 or 1][:lighting :optimisation :research]
[19:46][Check out the old blackboard.mlt][:blackboard]
[21:10][~milton feature request: Display the save file location; or Auto-save to our designated (non-temporary) file path][:admin]
[23:18][Launch and set the Overlay][:admin]
[24:11][Side Bit Masks][:blackboard :"data structure" :lighting :simd]
[27:58][Make RayCast() set the EndSide using a PlaneTestPattern][:"data structure" :lighting]
[30:34][Set up to store the data needed for our k-d tree][:"data structure" :lighting]
[31:23][Plan our k-d tree data storage][:"data structure" :lighting :research]
[32:54][Make RayCast() track IsLeafContainer in the BoxStack][:"data structure" :lighting]
[35:43][:Run hhlightprof][:lighting :optimisation]
[35:58][Augment lighting_solution with the k-d tree data, introducing kd_tree_node][:"data structure" :lighting]
[40:41][Make RayCast() use our new kd_tree_node][:"data structure" :lighting]
[48:42][Begin to update SplitBox() to use our new kd_tree_node][:"data structure" :lighting]
[51:12][Consider packing the LeafCount in the BoxStack][:"data structure" :lighting :research]
[52:21][Undo our changes to SplitBox()][:"data structure" :lighting]
[52:26][Key & Peele diner order authenticity sketch: "Forget everything I said"][:speech]
[54:09][Make RayCast() identify leaf nodes from a KdStack PackedValue][:"data structure" :lighting]
[1:08:47][@dithinas][I feel like there needs to be an algorithm / :"data structure" named after Key & Peele]
[1:09:11][Make RayCast() encode the PackedValue in the KdStack, introducing PACK_KD_STACK(), UNPACK(), UNPACK_PLANE_D(), UNPACK_LEAF_COUNT(), UNPACK_NODE_INDEX(), UNPACK_PLANE_TEST_PATTERN() and UNPACK_KD_INDEX(), and kd_stack_pack][:"data structure" :lighting]
[1:22:36][Fix compile errors in RayCast()][:"data structure" :lighting]
[1:28:41][Consider our k-d tree routine to be fully sketched out][:"data structure" :lighting :speech]
[1:29:51][Determine to make SplitBox() build our k-d tree tomorrow][:"data structure" :lighting :speech]
[1:30:55][Q&A][:speech]
[1:31:30][@internationalizationist][Q: Nice hair!]
[1:31:49][@sharlock93][Q: Side stuff: How is that course on C coming along?]
[1:32:12][@internationalizationist][Q: What about writing a plugin for ~4coder that highlights unclosed parentheses?]
[1:32:59][@vtlmks][Q: It's Day 596]
[1:33:43][@x13pixels][Q: Looks like you can recover the ~milton temp file from %APPDATA%\\MiltonPaint\\data]
[1:33:49][Check %APPDATA%\\MiltonPaint\\data][:admin]
[1:35:04][@tgapache][Q: Where do I get the info about the C course?[ref
    site="Molly Rocket"
    page="Follow Molly Rocket"
    url=https://mollyrocket.com/follow]]
[1:35:38][@internationalizationist][Q: Today [@naysayer88 Jon] said that deferred :rendering is a bad idea. Why?]
[1:37:06][@themeshpotato][Didn't [@naysayer88 he] just mean that almost no one uses deferred :rendering anymore?]
[1:37:26][Consult Adrian Courrèges' 'DOOM (2016) Graphics Study',[ref
    site="Adrian Courrèges"
    page="DOOM (2016) - Graphics Study"
    url=http://www.adriancourreges.com/blog/2016/09/09/doom-2016-graphics-study/] 'Metal Gear Solid V - Graphics Study'[ref
        site="Adrian Courrèges"
        page="Metal Gear Solid V - Graphics Study"
        url=http://www.adriancourreges.com/blog/2017/12/15/mgs-v-graphics-study/] and 'GTA V - Graphics Study'[ref
        site="Adrian Courrèges"
        page="GTA V - Graphics Study"
        url=http://www.adriancourreges.com/blog/2015/11/02/gta-v-graphics-study/]][:rendering :research]
[1:39:10][@kennyalive0][New DOOM does not use it][:rendering]
[1:39:26][Wonder what technique [@naysayer88 Jon] was referring to][:rendering]
[1:41:34][@mindmark42][Q: Could you explain the == 0000 1111 k-d side test thing again?][:"data structure" :lighting]
[1:42:00][k-d side testing: 0000 or 1111][:blackboard :"data structure" :lighting]
[1:47:00][Walk through the k-d side testing code in RayCast()][:"data structure" :lighting :research]
[1:48:12][@mindmark42][Q: Yes, what is the initial t value?][:"data structure" :lighting]
[1:49:07][@internationalizationist][Q: Someone also mentioned learning OpenGL with its tutorials about deferred :rendering and he said "be careful who you learn from". Is it (deferred rendering) has some pitfalls or something bad that only pro programmers know about? Just confused]
[1:49:44][@guybru5h_vi][Q: You could theoretically go full forward using clustered shading. It makes using many lights fairly straightforward. I wrote a blog post about it a while ago.[ref
    site="Ángel Ortiz"
    page="A Primer On Efficient Rendering Algorithms & Clustered Shading"
    url=http://www.aortiz.me/2018/12/21/CG.html] It also explains what most people mean as deferred and why it's good in principle][:rendering]
[1:50:10][Clustered :rendering in DOOM[ref
    site="Adrian Courrèges"
    page="DOOM (2016) - Graphics Study"
    url=http://www.adriancourreges.com/blog/2016/09/09/doom-2016-graphics-study/]][:research]
[1:52:19][@guybru5h_vi][Q: Call of Duty does it, but they call it z-binning and it's 10x crazier][:rendering]
[1:53:14][@guybru5h_vi][Q: This one[ref
    author="Michal Drobot"
    title="Improved Culling for Tiled and Clustered Rendering"
    url=http://advances.realtimerendering.com/s2017/2017_Sig_Improved_Culling_final.pdf]][:rendering]
[1:55:56][@guybru5h_vi][Q: It's faster but, god, is it harder to understand what they're doing][:rendering]
[1:56:55][@guybru5h_vi][Q: Worked faster in our engine, but it's early days yet][:rendering]
[1:57:21][@sori_daijin][I still think [@naysayer88 he] was just mixing naming, problem is we can't ask [@naysayer88 him] because [@naysayer88 he] is angry about it]
[1:58:05][@srgpqt][I think Carmack said deferred :rendering doesn't work so well in :VR]
[1:58:43][@rupan3][:VR is the future]
[2:00:30][Wrap it up with a plug of the Meow the Infinite printed comic Kickstarter[ref
    site=Kickstarter
    page="Meow the Infinite: Book One"
    url=https://www.kickstarter.com/projects/annarettberg/meow-the-infinite-book-one]][:speech]
[/video]
