[video output=day595 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Sketching Out A K-d Tree Loop" vod_platform=youtube id=3vWqM96zT-w annotator=Miblo]
[0:57][Show RayCast() with the determination to use our ray cast hits as a k-d tree][:lighting :optimisation :research]
[1:37][Demo hhlightprof (6.538543 total seconds elapsed)][:lighting :optimisation :run]
[2:50][Print out the number of partitions and leaves tested over repeated runs][:lighting :optimisation]
[6:14][hhlightprof tested 229860 partitions, and 524241 leaves][:lighting :optimisation :profiling :run]
[6:27][Always print out the number of partition and leaves tested, including the single-run case][:lighting :optimisation :profiling]
[6:44][hhlightprof tested 2338596 partitions, and 524285 leaves][:lighting :optimisation :profiling :run]
[6:53][Revert hhlightprof to print the number of partitions and leaves tested in the multiple-run case][:lighting :optimisation :profiling]
[7:03][Print partitions per leaf][:lighting :optimisation :profiling]
[8:32][hhlightprof tested 2339860 partitions and 524241 leaves, at 4.46 partitions per leaf][:lighting :optimisation :profiling :run]
[8:55][Print total partitions plus leaves][:lighting :optimisation :profiling]
[9:35][hhlightprof tested 2864101 total boxes, 2339860 partitions and 524241 leaves, at 4.46 partitions per leaf][:lighting :optimisation :profiling :run]
[11:25][Determine to make a special-purpose design for the k-d tree][:"data structure" :lighting :optimisation :speech]
[24:56][Initialise our desired data for k-d tree-style categorisation in RayCast()][:"data structure" :lighting :optimisation]
[32:23][Our menu of operations: 1) Push both boxes; 2) Push one box; 3) Push no boxes][:"data structure" :lighting :optimisation :research]
[33:06][Pushing no boxes][:blackboard :"data structure" :lighting :optimisation]
[34:29][Set up RayCast() to push onto our BoxStack the boxes on the close side and, optionally, the far side][:"data structure" :lighting :optimisation]
[37:38][Consider the resource-usage implications of four rays sharing the same origin][:"data structure" :lighting :optimisation :research :simd]
[46:38][Determine to use :SIMD lanes suboptimally for now, then read the literature on k-d trees to inform any improvements][:"data structure" :lighting :optimisation :research]
[57:52][Consider how to classify the EndSide in terms of signedness][:"data structure" :lighting :optimisation :research]
[1:03:04][Work through the EndSide classification, XOR'ing the sides into a mask][:"data structure" :lighting :optimisation]
[1:06:46][Consider restructuring the box categorisation loop][:"data structure" :lighting :optimisation :research]
[1:07:30][Restructure the box categorisation loop such that a box pulled off the stack is always known to be on the far side][:"data structure" :lighting :optimisation]
[1:12:22][Set up to take a timing]
[1:13:03][hhlightprof total seconds elapsed: 6.362055][:lighting :optimisation :run]
[1:13:35][Restructure the ray hit testing loop within the categorisation loop, to avoid unnecessary box pushes][:lighting :optimisation]
[1:18:13][hhlightprof total seconds elapsed: 6.110083][:lighting :optimisation :run]
[1:18:41][Remove stale code from RayCast()][:lighting :optimisation]
[1:19:41][Continue to work through the box categorisation routine][:"data structure" :lighting :optimisation]
[1:21:53][hhlightprof total seconds elapsed: 6.173270][:lighting :optimisation :run]
[1:22:11][Print out the Expected ms][:lighting :optimisation :profiling]
[2:12:15][@ymm0][Q: I'm bit behind on the VoDs. Do you ever trace secondary rays that bounce off in random directions that might lead to incoherent ray packets? (You mentioned the ray origins are always the same)][:lighting]
[2:13:36][@uplinkcoder][Q: Can't C++11 use something like 0b1111[ref
[2:15:49][@sneiderlein][Q: In an IMGUI situation, how do you create a unique ID for a :UI control? What I don't get is, if you draw everything immediately, if some condition changes, won't the ID also change?]
[2:16:39][@mjt_au][Q: Has [~hero Handmade Hero] gone as you planned, or did you not have any expectations or scope when you set off on this journey?]
[2:17:02][@nulligor][Q: How many % is [~hero Handmade Hero] done?]
[2:17:45][@i_simian][Q: Would you consider moving [~hero Handmade Hero] to JAI when it releases, or perhaps have another project to help showcase the :language? I assume it'd be something that would at least interest you]
[2:18:24][Wrap it up with a plug of the Meow the Infinite printed comic Kickstarter[ref