[video output=day600 member=cmuratori stream_platform=twitch stream_username=handmade_hero  project=code title="Better AABB Normal Derivation" vod_platform=youtube id=l05e2eBPREI annotator=Miblo]
[0:01][Welcome to the stream 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]
[0:41][Recap our ongoing move to grid-based ray casting][:lighting :speech]
[1:56][@i___d___k][Yeah, [@cmuratori he]'s been saying "only gameplay code now" since day 300]
[2:54][Toggle on the normal derivation code in GridRayCast()][:"data structure" :lighting]
[3:19][Refresh our memories on the :SIMD grid-based ray casting][:"data structure" :lighting :research]
[5:12][Floating-point ALUs, and when to drop down from wide to scalar operations][:"data structure" :lighting :performance :research :simd]
[7:40][Continue to refresh our memories on the ray hit extraction in GridRayCast()][:"data structure" :lighting :research :simd]
[9:20][Make GridRayCast() set ProbeSamplePSingle and ProbeSampleNSingle][:"data structure" :lighting :simd]
[11:09][Producing the normal of the box surface we hit][:"data structure" :lighting :research :simd]
[12:39][Embark on making GridRayCast() produce the normal of the box surface we hit][:"data structure" :lighting :simd]
[27:14][Consult ComputeVoxelIrradianceAt() for :SIMD potential][:lighting :research]
[28:26][Rewrite our ShuffleTable in GridRayCast()][:"data structure" :lighting]
[37:53][Try making GridRayCast() test the box surfaces unpacked][:"data structure" :lighting]
[44:01][Consider unpacked testing to be worse][:"data structure" :lighting :research :simd]
[44:29][Switch our attention to making GridRayCast() test the box surfaces while packed, renaming ShuffleTable to ClearMaskTable][:"data structure" :lighting]
[51:39][Make GridRayCast() pack up the ray hit[ref
    site=Intel
    page="Intel Intrinsics Guide"
    url=https://software.intel.com/sites/landingpage/IntrinsicsGuide/]][:"data structure" :lighting]
[58:45][Consider the :performance of our ray packing][:"data structure" :lighting :research]
[59:29][Determine to set up the SpatialGridNodes and SpatialGridLeaves, and pre-generate the WalkTable][:"data structure" :lighting :research]
[1:02:14][Introduce light_sample_direction for GridRayCast() to take][:"data structure" :lighting]
[1:06:12][Consider the :performance of our grid-based ray casting][:"data structure" :lighting :research]
[1:08:53][Ray Hit Normal Derivation][:blackboard :geometry :lighting]
[1:15:06][On the possibility to remove the PShufB() calls if the BoxMin and BoxMax were not shuffled][:"data structure" :lighting :research]
[1:15:49][Consider what information obtained while picking the tRay may we use to derive the box surface normal][:"data structure" :lighting :research]
[1:19:05][Temporarily relieve GridRayCast() of storing the HitBoxMin and HitBoxMax[ref
    site=Intel
    page="Intel Intrinsics Guide"
    url=https://software.intel.com/sites/landingpage/IntrinsicsGuide/]][:"data structure" :lighting]
[1:23:52][Change GridRayCast to store HitTMinX and HitTMinY rather than HitBoxMin and HitBoxMax][:"data structure" :lighting]
[1:27:22][Make GridRayCast() more efficiently derive the box surface normal][:"data structure" :lighting]
[1:38:26][Consider GridRayCast() to be done][:"data structure" :lighting :research]
[1:41:22][Fix up compile errors in GridRayCast()][:"data structure" :lighting]
[1:42:29][:Run hhlightprof successfully][:"data structure" :lighting]
[1:43:30][Q&A][:speech]
[1:43:55][@somebody_took_my_name][Q: Nice upgrade of the routine! Just wanted to let you know there is a double PShufB() in the creation of tRaySingle. Which leads me to a question, what do the P and B in PShufB() stand for, position and bit?][:lighting]
[1:44:13][Relieve GridRayCast() of calling PShufB() twice in the creation of tRaySingle][:lighting]
[1:44:21][What PShufB stands for: Packed Shuffle Bytes[ref
    site=uops.info
    url=https://uops.info/table.html]][:isa :research :simd]
[1:49:34][@miltondts][Q: Hi [@cmuratori Casey], love your show. Lately you seem to be having some problems with your voice (breaking, coughing). Have you considered visiting a speech therapist?][:health]
[1:49:51][@Miblo][Q: Mostly off-topic: Happy 600th Day! The stars have aligned and the Episode Guide[ref
    site="Handmade Hero"
    page="Episode Guide"
    url=https://handmadehero.org/watch#EpisodeGuide] has received an update]
[1:51:03][@pancelor][Q: Could you explain the math and diagram behind why the sign bits are the inverse of the ray's sign again? I showed up halfway through that and I think I'm missing some context][:geometry :lighting]
[1:51:25][Plug(?) "Behind the Curve"][:blackboard :geometry]
[1:56:01][Understanding why the sign of the hit surface normal is the inverse of that of the ray, in infinite planes][:blackboard :geometry]
[1:58:55][Understanding why the sign of the hit surface normal is the inverse of that of the ray, in boxes][:blackboard :geometry]
[2:02:19][@pancelor][But it forms nine quadrants, not four quadrants? I guess we know we're not stuck in between the fake heavens somehow?][:geometry]
[2:02:48][Deterministically knowing which surface we hit when our ray is in the edge octants][:blackboard :geometry]
[2:04:38][@pancelor][But assuming that we know we're in the four corner quadrants, and that the boxes are axis-aligned, then that all makes sense now][:geometry]
[2:04:49][The utility of transforming into an axis-aligned space for hit testing][:blackboard :geometry]
[2:09:32][@stovecat][Is it faster to do the matrix rotation or the dot product, though? I guess there's only one rotation and plenty of dot products][:geometry]
[2:10:33][Signed distance fields[ref
    site="Handmade Hero"
    page="Episode Guide"
    url=https://handmadehero.org/watch#EpisodeGuide]][:geometry :research]
[2:11:51][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]
