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

135 lines
13 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Sampling Octahedral Atlases" vod_platform=youtube id=djWM1u7ZrNk annotator=Miblo]
[0:05][Recap and set the stage for the day debugging and making meaningful our Octahedral Encoding][:lighting :speech]
[3:13][Show our unlit game][:lighting :run]
[4:30][Prepare to draw our octahedral light map][:"debug visualisation" :lighting :research]
[10:17][Make OpenGLInit() generate octahedral light map vertices for the purposes of drawing them, augmenting open_gl with LightMapDebugBuffer][:"debug visualisation" :lighting]
[14:48][Make OpenGLEndFrame() draw our octahedral light map vertices[ref
site=docs.GL
page=glDrawArrays
url=http://docs.gl/gl3/glDrawArrays]][:"debug visualisation" :lighting]
[16:31][See our light map vertices covering the whole screen][:"debug visualisation" :lighting :run]
[17:02][Investigate why our light map vertices cover the whole screen][:"debug visualisation" :lighting :research]
[18:28][Make OpenGLEndFrame() end the FinalStretch program before binding the LightMapDebugBuffer and restarting the FinalStretch program][:"debug visualisation" :lighting]
[19:02][See our light map vertices correctly located][:"debug visualisation" :lighting :run]
[20:40][Make OpenGLInit() generate an enlarged central subset of our light map][:"debug visualisation" :lighting]
[25:31][See our zoomed in light map vertices][:"debug visualisation" :lighting :run]
[26:25][Make OpenGLInit() generate a square portion of the light map, adjusting for the window's aspect ratio][:"debug visualisation" :lighting]
[30:03][Producing a square on a non-square window][:blackboard :geometry]
[31:52][Make OpenGLInit() correctly invert the window's 16:9 aspect ratio][:"debug visualisation" :lighting]
[32:09][See our square light map vertices][:"debug visualisation" :lighting :run]
[32:39][Understanding the extraction of a square from a non-square][:"debug visualisation" :lighting :research]
[33:57][Fix OpenGLInit() to extract a non-stretched square from the entire light atlas][:"debug visualisation" :lighting]
[34:45][See our square (but empty) light map vertices][:"debug visualisation" :lighting :run]
[35:00][Make OpenGLInit() generate a more readily adjustable proportion of the light map][:"debug visualisation" :lighting]
[35:57][See our light map][:"debug visualisation" :lighting :run]
[36:11][Make OpenGLChangeToSettings() generate the octahedral light map, so the :"debug visualisation" may be hot-reloaded][:"hot reloading" :lighting]
[37:38][Adjust the octahedral light map drawing in OpenGLChangeToSettings()][:"debug visualisation" :lighting :programming :run]
[41:02][Take a good look at our octahedral light map][:"debug visualisation" :lighting :run]
[43:00][Determine to carefully test the octahedral mapping][:lighting :speech]
[44:02][Make OpenGLChangeToSettings() responsible for binding and setting the parameters of our light atlas textures][:lighting]
[46:08][Disable linear blending of the light atlas visualisation while running][:"debug visualisation" :"hot reloading" :lighting :programming :run]
[47:12][Make EndLightingComputation() draw all blue into our octahedral light map][:"debug visualisation" :lighting]
[48:22][See all blue][:"debug visualisation" :lighting :run]
[48:36][Make EndLightingComputation() colour the sampling directions per coordinate][:"debug visualisation" :lighting]
[50:17][Check out our octahedral light map][:"debug visualisation" :lighting :run]
[50:36][Make EndLightingComputation() differentiate between the positive and negative directions][:"debug visualisation" :lighting]
[52:10][See that our light map does not look like an octahedron][:"debug visualisation" :lighting :run]
[52:43][Make EndLightingComputation() draw the leftright in increasingly red and the updown in green][:"debug visualisation" :lighting]
[53:46][Check out our light map][:"debug visualisation" :lighting :run]
[54:21][Make OpenGLChangeToSettings() zoom way in to our light map][:"debug visualisation" :lighting]
[54:47][Check out our light map][:"debug visualisation" :lighting :run]
[55:17][Make EndLightingComputation() shift our light colours into the 0 to 1 range][:"debug visualisation" :lighting]
[56:15][See 10 steps in X, as expected, but only 5 in Y][:"debug visualisation" :lighting :run]
[56:34][Investigate our apparent octahedral light map error in EndLightingComputation()][:lighting :research]
[1:01:40][Fix EndLightingComputation() to correctly stride through and populate the octahedral light map][:lighting]
[1:06:56][Make OpenGLChangeToSettings() zoom out and draw the bottom-left corner of the light map][:"debug visualisation" :lighting]
[1:07:42][Check out our more correct light map][:"debug visualisation" :lighting :run]
[1:07:50][Make OpenGLChangeToSettings() zoom in to the light map][:"debug visualisation" :lighting]
[1:08:09][Make EndLightingComputation() populate the whole light map][:lighting]
[1:10:10][See our much more valid light map][:"debug visualisation" :lighting]
[1:10:14][Make EndLightingComputation() colour the sampling directions per coordinate][:"debug visualisation" :lighting]
[1:10:53][Check out our light map][:"debug visualisation" :lighting :run]
[1:11:30][Make EndLightingComputation() leave a 1px border around each octahedron][:"debug visualisation" :lighting]
[1:12:54][Check out our offset octahedral light map][:"debug visualisation" :lighting :run]
[1:14:32][Step through EndLightingComputation() and inspect the Oxy][:"debug visualisation" :lighting :run]
[1:15:30][Fix the 1px bordering in EndLightingComputation()][:"debug visualisation" :lighting]
[1:16:25][Check out our more correct octahedral light map][:"debug visualisation" :lighting :run]
[1:17:26][Make EndLightingComputation() produce a coloured octahedron][:"debug visualisation" :lighting]
[1:19:07][See that our octahedron is not quite correct][:"debug visualisation" :lighting :programming :run]
[1:20:17][Make EndLightingComputation() just leave the z-blue of our octahedron][:"debug visualisation" :lighting]
[1:20:35][See that our z-blue looks correct][:"debug visualisation" :lighting :run]
[1:21:00][Make EndLightingComputation() just leave the x-red of our octahedron][:"debug visualisation" :lighting]
[1:21:08][See that our x-red might be correct][:"debug visualisation" :lighting :run]
[1:21:34][Make EndLightingComputation() just leave the y-green of our octahedron][:"debug visualisation" :lighting]
[1:21:47][See that our y-green might be correct][:"debug visualisation" :lighting :run]
[1:21:51][Let EndLightingComputation() draw the whole octahedron][:"debug visualisation" :lighting]
[1:21:55][Check out our whole octahedron][:"debug visualisation" :lighting :run]
[1:22:05][Toggle on our actual octahedral mapping in EndLightingComputation()][:"debug visualisation" :lighting]
[1:22:42][Admire our octahedral light map][:"debug visualisation" :lighting :run]
[1:23:32][Make OpenGLChangeToSettings() zoom out of the light map][:"debug visualisation" :lighting]
[1:23:53][Admire our octahedral light map][:"debug visualisation" :lighting :run]
[1:24:41][Determine to use the :lighting][:run]
[1:25:27][~4coder feature request: Syntax highlighting of here docs][:admin]
[1:26:28][Make CompileZBiasProgram() sample our octahedral :lighting][:sampling]
[1:42:31][:Research OpenGL's sign()[ref
site="Khronos"
page="sign"
url=https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/sign.xhtml] and the signNotZero() implementation in 'Survey of Efficient Representations for Independent Unit Vectors'[ref
title="Survey of Efficient Representations for Independent Unit Vectors"
author="Zina H. Cigolle, Sam Donow, Daniel Evangelakos, Michael Mara, Morgan McGuire, Quirin Meyer"
url=http://jcgt.org/published/0003/02/01/]][:mathematics]
[1:44:37][Implement SignOf(), continuing to make CompileZBiasProgram() sample our octahedral :lighting][:sampling]
[1:45:51][Hit shader errors][:lighting :run]
[1:46:24][Fix shader errors, stubbing out SampleLighting()][:lighting]
[1:47:32][Hit shader errors][:lighting :run]
[1:47:50][Fix typo in CompileZBiasProgram()][:lighting]
[1:48:01][:Run successfully][:lighting :run]
[1:48:36][Q&A][:speech]
[1:49:23][@uplinkcoder][Q: Can you show the octahedral map with linear blending?][:lighting]
[1:49:38][Show the octahedral map][:lighting :run]
[1:50:03][Enable linear blending in OpenGLChangeToSettings()][:lighting]
[1:50:52][Show the blended octahedral map][:lighting :run]
[1:51:22][@the_8th_mage][Q: Can you say a few words about octahedral mapping?[ref
title="Survey of Efficient Representations for Independent Unit Vectors"
author="Zina H. Cigolle, Sam Donow, Daniel Evangelakos, Michael Mara, Morgan McGuire, Quirin Meyer"
url=http://jcgt.org/published/0003/02/01/]][:lighting]
[1:52:16][@euphius][Q: Kinda off-topic. Have you ever been at a point where you thought that programming might not be the right thing for you?]
[1:57:50][@snubbykins][Q: Have you ever used / heard of Spherical Gaussians before?][:lighting]
[1:59:27][@xxthebigfoxx][Q: I remember we moved away from manual trilinear :filtering on voxel samples because it was a lot of texture bandwidth. How is this better than the old approach?][:lighting :performance]
[2:01:54][@math_daemon_][Q: Do you think step(x) * 2 - 1 could be faster than our current sign implementation?][:mathematics]
[2:03:01][@rooctag][Q: Why is the depth not red squares?][:"debug visualisation" :lighting]
[2:04:16][@fierydrake][I think you just didn't apply the fix to the depth buffer][:lighting]
[2:04:40][Fix EndLightingComputation() to correctly stride through the depth buffer][:lighting]
[2:05:08][Check out our correct depth buffer][:"debug visualisation" :lighting :run]
[2:05:31][@aidsjorb][Q: Do you have any opinion on potential new computing devices / platforms, i.e. "mobile" operating systems, tablets, multi screen devices, etc? Is there anything interesting going on, or are companies just throwing stuff at the wall?]
[2:05:46][@mycon_][Q: What do you think of Carmack working on general :AI? I hear he's going to use Sesame Street as the learning data]
[2:06:47][@mollycat123][Q: Some people have probably already mentioned this but it'd be cool to see more handmade chats / talks with guests etc. similar to the data compression talk with Charles]
[2:06:58][@xxthebigfoxx][Q: Is the bilinear :sampling from the octahedral map exact, then, or is there some distortion due to the way we are mapping the sphere in 2 dimensions?][:lighting]
[2:08:09][@ablindorphan][Q: Would you ever consider doing a tutorial on testing for something like a :library, where it's important to be thorough?]
[2:08:28][@math_daemon_][Q: I thought ours might be scalar. But was just a guess]
[2:09:09][@kniffel5][Q: What other than the games at Molly Rocket, are you working on? (Referring to the "cleaning up other people's mess" you said earlier, maybe I misunderstood?)]
[2:12:53][@quickshift_][Q: step(x) might be :hardware accelerated. It works on v2 and is branchless. Not sure how impactful it actually is][:performance]
[2:16:53][@osor_io][Q: Did you get any traction on your "The Thirty Million Line Problem" video? In terms of people wanting to collaborate with better programming of the hardware directly, ISAs for the GPU, etc, etc. Things in that direction]
[2:17:07][@litmusik][Q: I enjoyed your talk on :API design, but I see that it's ~15 years old. Have your thoughts changed or is it still the model you follow?]
[2:18:15][@xsinxdx][Q: Where could one find concrete resources on 2D :lighting? I can't seem to find anything useful on google, just unity and godot stuff]
[2:18:40][@devsigner][Q: I agree with you that software generally sucks, but do you think you're letting it get to you too much? There's something to say about staying positive, despite the madness]
[2:19:12][@mollycat123][Q: What are some of the major changes you have made to ~4coder worth mentioning?]
[2:20:02][@bewwyss][Q: Is it possible to implement the idea of dynamic :language without garbage collection, e.g implementing ECMAScript?]
[2:20:34][@erdomina][Q: When is your C course coming out? I missed the beta]
[2:21:09][@jessem3y3r][Q: Can you elaborate on the issue C made with tying types strongly with operations?][:language]
[2:22:57][@kniffel5][Q: How many people pre-ordered the source code (I certainly did!)?]
[2:23:35][@kniffel5][Q: If SendOwl continues to be shady, is there a plan to switch platforms, so people will still be able to get it if something happens?]
[2:26:27][@binarytoshokan][Q: What are the challenges with finding good distribution platforms?]
[2:29:05][@alexkelbo][Q: What about itch.io?[ref
site=itch.io
url=https://itch.io/]]
[2:31:56][@jessem3y3r][GOG?]
[2:32:12][@strangezak][You might be able to get permission. The people at Epic who are running the Epic Game Store are good people]
[2:32:49][@kniffel5][Q: Does Steam have any requirements to put their DRM into any program that's being uploaded, or is that up to the programmer?]
[2:34:06][@megafunksa][Sweeney seems like a great guy]
[2:36:18][@biinkster][Is there anything of Steam to improve? It does what it does right?]
[2:38:01][@genos3][Q: What are your thoughts on undefined behaviour?][:language]
[2:40:23][@genos3][Q: Is there an advantage to having undefined behaviour?][:language]
[2:40:54][Wrap it up][:speech]
[/video]