[video output=day566 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Moving to a Voxels-only Lighting Approach" vod_platform=youtube id=b6DkdOEEDSs annotator=Miblo]
[0:03][Recap and set the stage for the day streaming from a new location][:speech]
[1:11][Demo our new signed distance field-based :lighting solution][:run]
[4:39][Determine to work on our light transport, with an eye on outputting it to our signed distance field voxel grid][:lighting :run]
[7:14][Light transport: 1) :Sampling][:lighting :run]
[8:02][Light transport: 2) Storage (in light probes) for reconstruction per voxel, e.g. spherical harmonics, k-means clustering][:lighting :run]
[15:31][Determine to start with direct ray casting of one light][:lighting :run]
[18:36][Turn off all but one of the test lights in EndLightingComputation()][:lighting]
[19:18][See our single light source, and plan to: 0) Move to screen-space voxel for light reconstruction; then 1) Compute direct ray casting of one ray][:lighting :run]
[21:50][Update the checkerboard to handle one light source in EndLightingComputation()][:lighting]
[23:04][Our checkerboard still works][:lighting :run]
[23:15][Begin to update the light probes code in EndLightingComputation()][:lighting :research]
[25:45][Consider moving to a voxels-only :lighting approach][:speech]
[31:18][Mostly replace light probes in lighting_solution with a newly introduced light_voxel_cell][:"data structure" :lighting]
[38:05][Switch EndLightComputation() over from light probes to cells][:lighting]
[42:18][We got a [@Molly puss]][:speech]
[43:59][Make EndLightingComputation() initialise our larger voxel, from where we access our small voxel cell][:lighting]
[55:13][Fix compile errors, making InitLighting() handle our new light_voxel_cell][:lighting]
[59:11][Determine to get the voxels tracking properly][:lighting :speech]
[1:01:58][Stably position the :lighting voxel grid in absolute world space, making UpdateAndRenderWorld() pass the Camera.P to BeginLightingComputation()]
[1:10:03][Begin to make BeginLightingComputation() align the :lighting voxel grid with our view]
[1:26:12][Gather peanuts][:admin]
[1:26:31][:afk]
[1:26:47][Return to crunch on some peanuts and consider how to align our view to a whole-number multiple of the voxel call dimension][:lighting :speech]
[1:30:01][Day 566][:blackboard]
[1:31:52][Aligned Voxels][:blackboard :lighting]
[1:43:21][:Research modulus distribution[ref
    site="Khan Academy"
    page="Modular multiplication"
    url=https://www.khanacademy.org/computing/computer-science/cryptography/modarithmetic/a/modular-multiplication]][:mathematics]
[1:45:42][Modular multiplication,[ref
    site="Khan Academy"
    page="Modular multiplication"
    url=https://www.khanacademy.org/computing/computer-science/cryptography/modarithmetic/a/modular-multiplication] or using a light cell dimension of a power of 2 to easily align the grid with our view][:blackboard :mathematics]
[1:49:18][Enable BeginLightingComputation() to align the :lighting voxel grid with our view]
[1:54:20][Q&A][:speech]
[1:54:35][@somebody_took_my_name][Q: It's day 566]
[1:55:02][@longboolean][Q: You talking about non-realism but good looking art got me thinking, do you plan on having game entities that manipulate light in extremely non-real ways? Like light absorption that sucks the light out of an area or perverts it in some way? (Inversion, RGB-swapping, messing with normals etc.) I'm thinking like dark magic kind of effect.][:lighting]
[1:55:55][@maliusarth][Q: Why not use % directly?]
[1:57:41][@sagian2005][Q: Couldn't you contrive it so that ChunkDim is always an even multiple of LightCellDim?][:lighting]
[1:58:41][Consider deriving our LightCellDim from the WorldChunkDimInMeters, for easy alignment][:lighting]
[1:59:42][@culdevu][Q: A thing that I have trouble with is what happened to you a few minutes ago. I found the math.stackexchange pages perfectly readable, and I'd have no idea that anyone wouldn't be able to read it. How do you put yourself in other people's shoes when you teach? If I'm writing things online, should I always try to state things in terms of notation that beginners would understand?]
[2:00:01][@rationalcoder][Q: I'm missing something fundamental about spherical harmonics. I get the idea of decomposing areas into spheres, but I don't get how you could use something like that to accumulate some representation of light that you could reconstruct. Would be willing to provide an intro sometime?][:lighting]
[2:03:58][@culdevu][Q: Yeah, essentially, or maybe anything with lots of jargon that's kinda essential to working with the subject seriously. I find myself on the other side a lot when I'm doing, like, FPGA stuff and I have no idea what people are talking about, but once I learn all of the jargon it becomes second nature to think about things in those terms. If that makes sense[ref
    site=Wikipedia
    page=Orthogonality
    url=https://en.wikipedia.org/wiki/Orthogonality][ref
        site=Wikipedia
        page="Fourier transform"
        url=https://en.wikipedia.org/wiki/Fourier_transform]][:mathematics]
[2:16:27][@rationalcoder][Q: Thanks. I guess I put too much emphasis on accumulation and reconstruction. I can reason about what you just said about orthogonality and addition. My misunderstanding is more fundamental. I understand how you can use ray tracing to get light intensities and colors at probe points, which can be passed to your fragment shader, but I don't get how you can get some spherical representation of light at probe points, and what the heck your fragment shader would do with it][:lighting]
[2:20:17][That's the end of the Qs][:speech]
[2:20:43][We are looking for generally applicable novice questions[ref
    author=@cmuratori
    title="Dear aspiring or novice programmers, What programming concepts, techniques, or processes do you most want explained and tutorialed? Please email faq@mollyrocket.com. I am collecting questions for an upcoming @handmade_hero project and would like to know what is most needed."
    publisher=Twitter
    url=https://twitter.com/cmuratori/status/1187101704027721728]][:speech]
[2:23:36][That's it for today][:speech]
[/video]
