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

90 lines
8.5 KiB
Plaintext
Raw Permalink Normal View History

[video output=day552 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Generating Sampling Spheres into an INL" vod_platform=youtube id=1RKMpFH73gA annotator=Miblo]
2019-09-02 21:37:16 +00:00
[0:00][Recap and set the stage for the day, with a plug of Daily MOBA Hero[ref
site=Twitter
page="Daily MOBA Hero"
url=https://twitter.com/dailymobahero]][:speech]
[2:21][Demo the presence of :lighting probes in the world, with a view to colouring them][:run]
[6:15][Set up to: 1) Plug together the light probes from the :"entity system" and :lighting system; 2) Insert the light probes into the spacial index; and 3) Build our directional :sampling support structures][:"data structure" :lighting :speech]
[8:12][Check how light probes are stored in the 'Dynamic Diffuse Global Illumination with Ray-Traced Irradiance Fields' paper[ref
title="Dynamic Diffuse Global Illumination with Ray-Traced Irradiance Fields"
author="Jean-Philippe Guertin, Derek Nowrouzezahrai, Morgan McGuire"
url=http://jcgt.org/published/0008/02/01/]][:lighting :research]
[12:09][Note the problem of :sampling the corner of a cube][:lighting :research]
[14:46][:Sampling Contribution][:blackboard :lighting]
[19:22][Enable ComputeLightPropagation() to perform a blended gather from all six sides of the cube, introducing light_sampling_sphere for lighting_solution to contain][:lighting]
[28:20][Note the problem that our LIGHTING_PATTERN_GENERATOR() generates hemispherical patterns][:lighting :research]
[30:30][Remove LIGHTING_PATTERN_GENERATOR() in favour of the lone GeneratePoissonSamples(), and make the latter generate samples around the entire sphere][:lighting :sampling]
[38:06][Consider how to produce a well-distributed spherical :sampling pattern, e.g. using blue noise][:lighting :speech]
[39:56][Create hhsphere.cpp to generate handmade_sampling_spheres.inl for handmade_lighting.h to include][:lighting :sampling]
[44:05][Spec out an example handmade_sampling_spheres.inl][:lighting :sampling]
[50:08][See that our light probes exist as usual][:lighting :run]
[50:41][Set up LightingTest() to draw our light probe :sampling directions][:"debug visualisation" :lighting]
[57:20][See our lone :sampling direction][:"debug visualisation" :lighting :run]
[57:44][Embark on the generation of handmade_sampling_spheres.inl, introducing OutputBlah()][:metaprogramming :lighting :sampling]
[1:04:52][A few thoughts on spherical harmonics][:speech]
[1:05:43][Finish up our initial handmade_sampling_spheres.inl generator, renaming OutputBlah() to OutputSphereINL()][:"file io" :lighting :metaprogramming :sampling]
[1:11:22][Invoke hhsphere and check out our handmade_sampling_spheres.inl][:admin :lighting :sampling]
[1:12:32][Make GenerateLightingPattern() call GeneratePoissonSamples()][:lighting :sampling]
[1:14:15][Consider :sampling slices of a blue-noise covered sphere][:lighting]
[1:16:20][Make GenerateLightingPattern() generate a white noise set of samples, from which each sphere is sliced randomly, introducing cube_store and sphere_store][:lighting :sampling]
[1:28:08][Enable OutputSphereINL() to output our generated spheres and main() to call GenerateLightingPattern()][:lighting :metaprogramming :sampling]
[1:34:41][~RemedyBG feature request: Take debugee-arguments on the command line][:admin]
[1:37:50][Step through hhsphere to see what it generates][:lighting :run :sampling]
[1:40:12][Check out our generated handmade_sampling_spheres.inl][:admin]
[1:40:48][Make OutputSphereINL() suffix float values with "f"][:metaprogramming]
[1:42:16][See nothing new in the game][:lighting :sampling :run]
[1:42:23][Regenerate our handmade_sampling_spheres.inl][:admin :lighting :sampling]
[1:42:50][Investigate the compile error in handmade_sampling_spheres.inl][:language]
[1:54:24][Make OutputSphereINL() surround the data with extra braces][:language :metaprogramming]
[1:54:51][Regenerate our handmade_sampling_spheres.inl][:admin :lighting :sampling]
[1:55:33][Investigate the compile error in handmade_sampling_spheres.inl][:language]
[1:56:58][Make OutputSphereINL() surround the data with extra braces][:language :metaprogramming]
[1:57:15][Regenerate our handmade_sampling_spheres.inl][:admin :lighting :sampling]
[1:57:35][Hit a "Too many braces" error][:language :programming :rant]
[1:59:38][Change OutputSphereINL() to generate the sampling directions as one huge array of floats][:metaprogramming]
[2:01:50][Find that our flat array compiles okay][:admin :language]
[2:02:18][Make OutputSphereINL() set the LightSamplingSphereFloatTable as global and 16-byte aligned,[ref
site="Microsoft Docs"
page="align (C++)"
url=https://docs.microsoft.com/en-us/cpp/cpp/align-cpp?view=vs-2019] pointed to by our actual light_sampling_sphere :"data structure"][:language :metaprogramming]
[2:06:12][Regenerate our handmade_sampling_spheres.inl][:admin]
[2:06:23][Check out our single :sampling sphere][:"debug visualisation" :lighting :run]
[2:06:51][Enable LightingTest() to use all of our generated spheres][:lighting :sampling]
[2:08:03][Check out all our (overlapping) spheres][:"debug visualisation" :lighting :run]
[2:08:06][Make LightingTest() elevate the sphere][:lighting :sampling]
[2:08:34][Check out our :sampling sphere][:"debug visualisation" :lighting :run]
[2:08:53][Make LightingTest() elevate the sphere higher still]
[2:09:05][Check out our floating :sampling sphere][:"debug visualisation" :lighting :run]
[2:09:49][Q&A][:speech]
[2:11:01][@hetoan2][Q: Have you considered using Julia :language to do any sort of game development?]
[2:11:08][@uplinkcoder][Q: I am surprised the cast works as an initializer][:language]
[2:11:58][@iwrestledabeer][Q: Why does C++ suck so badly?][:language]
[2:12:47][@mmozeiko][Q: Can you replace __declspec(align) with C++11 alignas? Because non-Windows people won't have declspec. See example code here[ref
site="cppreference.com"
page="alignas specifier (since C++11)"
url=https://en.cppreference.com/w/cpp/language/alignas]][:language]
[2:14:01][@invertedgold][Q: What advice would you give Bjarne Stroustrup?][:language]
[2:14:48][@bulmanator][Q: If you were to make this a more full 3D game (models, animations etc.) how would you go about modifying the renderer to support submission of these? Would you keep the single vertex buffer setup etc?][:rendering]
[2:15:47][@sawii00][Q: Sorry, I just logged in. What happened for you to turn on C++ so harshly?][:language]
[2:16:09][@mmozeiko][Q: Yes, you can put it before variable, not on struct][:language]
[2:16:18][Make OutputSphereINL() use alignas(16) on the LightSamplingSphereTable][:language :metaprogramming]
[2:17:03][@brimonk][Q: Since we're asking off-topic questions, is SPIR-V in the direction of getting programmable ISAs for graphics hardware, or am I incorrect? Thoughts on SPIR-V in general?][:isa]
[2:18:53][@oliverthebestcat][@cmuratori I've sure you've been asked, but what do you think about Rust? If anyone in chat knows something for me to look at, a link would be helpful!][:language]
[2:19:30][@filter160][Q: What happened to [@sssmcgrath Shawn McGrath]?[ref
site=Twitter
page="Shawn McGrath"
url=https://twitter.com/sssmcgrath]]
[2:20:17][@zenzutsu][Q: Can you build an entire game in a data-oriented mindset? Will it be a mess?][:language]
[2:20:25][@wubbleduff][Q: I'm a CS student and I want to learn about rigid body :physics. It seems resources I find on the internet are very basic tutorials or advanced academic papers. Is there a resource I can use with a not as steep learning curve?]
[2:20:54][@uplinkcoder][Q: light_sampling_sphere has no padding then?][:language]
[2:21:21][Make OutputSphereINL() add Padding to light_sampling_sphere][:language]
[2:27:27][Regenerate handmade_sampling_spheres.inl and calculate our new light_sampling_sphere alignment][:admin :language]
[2:28:56][Fix the Padding computation in OutputSphereINL()][:language]
[2:30:00][Regenerate handmade_sampling_spheres.inl to see our new light_sampling_sphere alignment][:admin :language]
[2:30:38][Prevent OutputSphereINL() from outputting Padding if light_sampling_sphere is already aligned][:language]
[2:31:49][Regenerate handmade_sampling_spheres.inl to see our unpadded light_sampling_sphere][:admin :language]
[2:32:55][@oliverthebestcat][@cmuratori The one thing Rust has that makes it better than C++: no header files. That's enough right there][:language]
[2:33:41][@wubbleduff][Q: That learning curve seems to be the case with most complicated programming topics such as graphics. How did you learn these topics when you started out?][:physics]
[2:35:15][Thanks for joining us][:speech]
[/video]