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

129 lines
12 KiB
Plaintext
Raw Permalink Normal View History

[video output=day586 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Finishing Indirect Diffuse Sampling" vod_platform=youtube id=BoWkXfSgJdE annotator=Miblo]
2020-03-18 01:06:07 +00:00
[0:02][Mention the 'Handmade Collectives Worldwide" thread in the handmade.network forums[ref
author="Casey Muratori"
publisher=Twitter
title="It looks like @handmade_net folks are starting a list of low-level programmers by geography…"
url=https://twitter.com/cmuratori/status/1238588103280832512][ref
site="handmade.network Forums"
page="Handmade Collectives around the world"
url=https://handmade.network/forums/t/7212-handmade_collectives_around_the_world][ref
site="Google Sheets"
page="Handmade Collectives Worldwide"
url=https://docs.google.com/spreadsheets/d/1FzUm4A3ZB5XDtegEy4PocR7_nU1XLMOVfGWYZvhocnw/edit#gid=0]][:research]
[3:44][Fix typo in CompileZBiasProgram()][:hardware :lighting]
[5:17][Show our current specular indirect-bounce :lighting][:run]
[6:14][Embark on the switch to looking up into the diffuse light atlas, guided by the removal of light_voxel_cell from lighting_solution][:"data structure" :lighting]
[6:56][Consider relieving the :lighting system of keeping stale data around][:lighting :research]
[8:36][Respecify light_voxel_cell as light_atlas_tile][:"data structure" :lighting]
[9:57][Update LookUpVoxelClamped() to use the light_atlas_tile, rename it to GetTileClamped(), and introduce GetTileRowStride()][:lighting]
[14:01][Augment light_atlas with a TileRowStride for MakeLightAtlas() to set and LIGHT_ATLAS_OFFSET() to use][:"data structure" :lighting]
[17:44][Remove Stride from light_atlas_tile, rename its Base to Texel and update ComputeVoxelIrradianceAt() to sample from the DiffuseAtlas as a light_atlas_tile][:"data structure" :lighting]
[24:13][Set up ComputeVoxelIrradianceAt() to sample based on the surface reflection direction][:lighting]
[26:04][Update UpdateVoxel() to use our light_atlas_tile, respecifying the latter as light_atlas_texel containing a Value, introducing OffsetFromTexel()][:"data structure" :lighting]
[30:28][Update TestCast(), TestSphere(), FullCast() and ComputeLightPropagationWork() to use our light_atlas_texel][:lighting]
[34:08][Update ComputeLightPropagationWork() to blur from the SpecAtlas to the DiffuseAtlas, introducing a version of OffsetFromTexel() that takes a Tx and Ty][:lighting]
[39:23][Respecify BlockCopyVoxel() as BlockCopyAtlas()][:lighting]
[44:41][Introduce CopyTile(), a light_atlas_texel version of AdvanceRow(), and ZeroTile()][:lighting]
[49:56][Update BeginLightingComputation() to use BlockCopyAtlas() on both atlases][:lighting]
[50:40][Consider adding assertions in our new code to aid testing][:lighting :research]
[51:23][Hit a read access violation in FillLightAtlasBorder()][:lighting :run]
[52:05][:Run in debug mode without crashing][:lighting]
[52:49][Hit a read access violation in FillLightAtlasBorder() in release mode][:lighting :run]
[53:27][Introduce GetTileUnclamped() to CopyTile() and ZeroTile() to use, asserting that we are looking up within the bounds of the atlas][:lighting]
[56:04][@somebody_took_my_name][It's all just moving :memory around]
[56:26][Fix compile error][:lighting]
[56:31][Hit a read access violation in ComputeLightPropagationWork(), and determine to hunt for classes of bugs][:lighting :run]
[57:32][Assert in GetTileUnclamped() that Tx and Ty are in bounds, and there and also in OffsetFromTexel() and AdvanceRow() that the resulting pointer is in bounds, introducing PointerIsInBounds()][:lighting]
[1:01:42][Hit our PointerIsInBounds() assertion in GetTileUnclamped()][:lighting :run]
[1:02:24][Remove the LIGHT_LARGE_VOXEL_DIM definitions from lighting_solution, and propagate this change][:"data structure" :lighting]
[1:05:05][Embark on updating BeginLightingComputation() to place our hot voxel, removing LIGHT_CHUNK_COUNT, augmenting lighting_solution with LightingEnabled and turning off the :lighting for now]
[1:08:28][See no :lighting][:run]
[1:08:58][Disable the :lighting in CompileZBiasProgram()][:hardware]
[1:09:08][See the orphanage with no :lighting, hop to the neighbouring room and hit our PointerIsInBounds() assertion in GetTileUnclamped()][:run]
[1:10:17][:Run in debug mode to investigate our PointerIsInBounds() assertion hit in GetTileUnclamped()][:lighting]
[1:11:13][Fix PointerIsInBounds() to find the atlas extents using GetLightAtlasSize()][:lighting]
[1:11:36][Hit our PointerIsInBounds() assertion in AdvanceRow(), called by ZeroTile()][:lighting :run]
[1:12:59][Remove the PointerIsInBounds() assertion from AdvanceRow(), instead asserting the same within CopyTile() and ZeroTile()][:lighting]
[1:14:04][Hit no assertions in the light_atlas_tile code][:lighting :run]
[1:14:25][Make BeginLightingComputation() draw the voxels][:"debug visualisation" :lighting]
[1:15:13][Hit an assertion in GetTileUnclamped(), called by BlockCopyAtlas() within BeginLightingComputation()][:lighting :run]
[1:22:05][Fix BlockCopyAtlas() to correctly operate within bounds][:lighting]
[1:25:12][:Run without hitting any assertions in GetTileUnclamped(), with a few words on paranoid bounds checking][:lighting]
[1:26:42][Check out the unexpectedly large and correctly centred :lighting voxel][:"debug visualisation" :run]
[1:27:30][Re-enable the :lighting in BeginLightingComputation()]
[1:27:38][Double-check the :lighting distribution code in EndLightingComputation()][:research]
[1:27:56][:Run in debug mode without hitting any assertions][:lighting]
[1:28:23][:Run in release mode and hit a read access violation in ComputeLightPropagationWork()][:lighting]
[1:29:58][Toggle off the speculardiffuse atlas blurring code in ComputeLightPropagationWork()][:lighting]
[1:30:14][:Run successfully in release mode][:lighting]
[1:30:54][Toggle on the speculardiffuse atlas blurring code in ComputeLightPropagationWork()][:lighting]
[1:31:08][Consider removing LIGHT_ATLAS_OFFSET()][:lighting :research]
[1:32:03][Scour for bugs the speculardiffuse atlas blurring code in ComputeLightPropagationWork()][:lighting :research]
[1:34:51][Toggle off the store calls in ComputeLightPropagationWork()][:lighting]
[1:35:11][Break on the final Transpose() call in ComputeLightPropagationWork() and check the :asm to ensure the blurring loop has not been optimised out][:lighting :run]
[1:35:50][Continue to :run without storing, but also without crashing][:lighting]
[1:36:05][Fix ComputeLightPropagationWork() to use the DiffuseTexel.Value pointer itself, rather than its address][:language :lighting]
[1:36:38][:Run successfully with the speculardiffuse blurring and bouncing][:lighting]
[1:37:01][Re-enable the :lighting in CompileZBiasProgram()][:hardware]
[1:37:20][Admire our diffuse :lighting][:run]
[1:38:33][Try hard-setting the SampleRefColor to 70% in FullCast()][:lighting]
[1:39:41][See the light brighten and brighten][:lighting :run]
[1:40:04][Try decreasing the SampleRefColor from 70% to 25% in FullCast()][:lighting]
[1:40:15][See the light's brightness remain stable][:lighting :run]
[1:40:30][Try increasing the SampleRefColor from 25% to 50% in FullCast()][:lighting]
[1:40:35][Hit a write access violation in the debug arena][:"debug system" :lighting :run]
[1:40:51][Admire our diffuse :lighting][:run]
[1:41:06][Remove the commented out reflectance code from ComputeVoxelIrradianceAt(), and the SampleRefColor hard-setting from FullCast()][:lighting]
[1:42:19][Try modifying the W by ×0.25 in BuildDiffuseLightMaps()][:lighting]
[1:43:09][See our :lighting bounce less][:run]
[1:43:17][Try increasing the W modification from ×0.25 to ×0.5 in BuildDiffuseLightMaps()][:lighting]
[1:43:19][Hit a write access violation in DEBUGGetArena()][:"debug system" :run]
[1:43:42][Check out our ×0.5 bounced :lighting][:run]
[1:44:01][Try increasing the W modification from ×0.5 to ×0.75 in BuildDiffuseLightMaps()][:lighting]
[1:44:03][Check out our more correct ×0.75 bounced :lighting][:run]
[1:45:29][Try increasing the W modification from ×0.75 to ×0.85 in BuildDiffuseLightMaps()][:lighting]
[1:45:38][Check out our ×0.85 bounced :lighting, with the determination to tighten our lighting equation][:run]
[1:46:54][Try increasing the W modification from ×0.85 to ×0.9 in BuildDiffuseLightMaps()][:lighting]
[1:46:56][Check out our ×0.9 bounced :lighting][:run]
[1:47:39][Try increasing the W modification from ×0.9 to ×0.95 in BuildDiffuseLightMaps()][:lighting]
[1:47:43][Check out our still stable ×0.95 bounced :lighting][:run]
[1:48:58][Remove the W modification from BuldDiffuseLightMaps()][:lighting]
[1:49:07][Check out our (slowly destabilising) bounced :lighting][:run]
[1:49:54][Q&A][:speech]
[1:50:30][@picklebobdogflog][Q: What is the cause of the flickering in the :lighting? Will you do some de-noising or cast more rays in the future to try to fix it?]
[1:50:54][Try modifying the W by ×0.975 in BuildDiffuseLightMaps()][:lighting]
[1:52:17][@somebody_took_my_name][Q: I think you might have flipped the tx / /ty in TestSphere() while rewriting the code][:lighting]
[1:52:33][@xxthebigfoxx][Q: Could it be useful to have it print a value like the average texel color of the diffuse and / or specular maps on the screen?][:"debug visualisation" :lighting]
[1:53:05][@vaualbus][Q: Are you using different level on assert also for release build? Or you only use asserts on debug builds?]
[1:53:10][Disable HANDMADE_INTERNAL and HANDMADE_SLOW in build.bat][:language]
[1:53:24][Hit a read access violation in OpenGLEndFrame(), and identifier not found compile errors][:"debug system" :hardware :rendering]
[1:53:46][Make HANDMADE_INTERNAL define the macros that HANDMADE_SLOW within HANDMADE_INTERNAL would have been able to define][:"debug system" :language]
[1:55:24][:Run with both HANDMADE_INTERNAL and HANDMADE_SLOW disabled, but asserts enabled][:lighting]
[1:56:53][@yesyesyourmother][Can't find anything with DuckDuckGo[ref
site=DuckDuckGo
url=https://duckduckgo.com/]]
[1:57:27][@sahfortv][Q: How slow are we? Is there any significant change in speed from the changes today?][:lighting :performance]
[1:57:30][Check out the :performance of our :lighting][:run]
[2:01:06][@sahfortv][Q: And was the goal is to get to 30FPS in debug mode?][:performance]
[2:01:16][@vaualbus][Q: So we are faster than the previous solution? I don't remember the :performance of the old system][:lighting]
[2:01:48][Consider removing all mentions of LIGHT_LOOKUP_VOXEL_DIM][:lighting :research]
[2:02:49][Temporarily reduce LIGHT_LOOKUP_VOXEL_DIM_POW_2 from 5 to 4][:lighting]
[2:02:59][Admire our much faster :lighting][:performance]
[2:03:42][Revert our LIGHT_LOOKUP_VOXEL_DIM_POW_2 to 5][:lighting]
[2:04:09][@mattiamanzati][Q: Can you still parameterise the voxel size? I'm curious if decreasing voxel size will remove some cubeness][:lighting]
[2:04:42][@pragmascrypt][Q: For what are you still using voxels?][:lighting]
[2:05:40][@data_pi][Q: Off-topic: Do you see Rust replacing C / C++ in the game industry in the next 510 years?][:language]
[2:11:05][@ravarix][Interesting that you think Rust doesn't help with swizzling. There are many libs for it just like C. It's not really a :language problem]
[2:12:03][@s0imn][Q: Are there any :language features in C++ (that is not borrowed from C) that you like, and are there other language features than :metaprogramming, that you want in a new language?]
[2:13:39][@ravarix][Have you looked at the macro power of Rust? You can manipulate the AST as desired][:language]
[2:14:02][@etheraxx][Functional languages like Haskell allow developing embedded DSLs and you can write compiler extensions to do symbol replacement][:language]
[2:16:22][@fierydrake][Procedural Macros?[ref
site="The Rust Reference"
page="Procedural Macros"
url=https://doc.rust-lang.org/reference/procedural-macros.html]][:language]
[2:17:46][@ravarix][@handmade_hero Oh sorry, I wasn't asking for specific detail. I was just curious if you had looked at it at all][:language]
[2:18:49][@maliusarth][Q: Where can I find Moustache?]
[2:19:01][@maliusarth][Q: What do you think of clang tooling to create such AST manipulation tools as part of the build pipeline?][:language]
[2:19:29][Wrap this up][:speech]
[/video]