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

128 lines
11 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 output=day579 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Debugging Octahedral Shading" vod_platform=youtube id=CcK-Yshqg1w annotator=Miblo]
[0:03][Recap and set the stage for the day][:speech]
[0:31][Demo our octahedral light map][:"debug visualisation" :lighting :run]
[3:23][Understanding the Octahedron[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 :research]
[4:55][Orienting the octahedral wrapping by importance][:"debug visualisation" :lighting :run]
[6:06][Determine to fill in the cracks and sample the octahedron in the shaders][:lighting :speech]
[7:36][Make SampleLighting() in CompileZBiasProgram() light the pixels by their position within voxels][:"debug visualisation" :lighting]
[9:32][Check out our lit voxels][:"debug visualisation" :lighting :run]
[10:43][Determine to sample from our octahedral map][:lighting :research :run :sampling]
[12:28][Set up SampleLighting() to sample from the octahedral light map][:lighting :sampling]
[15:54][Make SampleLighting() compute the location from where to sample the octahedral light map][:lighting :sampling]
[27:33][Set up CompileZBiasProgram() to pass the values required by SampleLighting() to lookup into the octahedral light map][:lighting :sampling]
[28:43][Consider not using different resolutions for the light and depth maps[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]
[34:04][Set up CompileZBiasProgram() to pass the LIGHT_LOOKUP_SQUARE_DIM to SampleLighting()][:lighting :sampling]
[34:50][Voxel Atlas UVs][:blackboard :mathematics]
[40:40][Make SampleLighting() compute the dimensions required to lookup into the octahedral light map][:lighting :sampling]
[48:19][Hit shader errors][:lighting :run :sampling]
[49:18][Fix the Result assignments in SampleLighting()][:lighting :sampling]
[49:51][See our darkly and incorrectly lit world][:lighting :run :sampling]
[50:49][Change SampleLighting() to orient our lookup around the octahedron centres][:lighting :sampling]
[55:22][Hit shader errors][:lighting :run :sampling]
[55:30][Fix naming in SampleLighting()][:lighting :sampling]
[55:42][See our discontinuously lit world][:lighting :run :sampling]
[58:13][Try making SampleLighting() lookup into a shrunken area of the octahedral light map][:lighting :sampling]
[58:48][See no improvement][:lighting :run :sampling]
[59:41][Introduce VOXEL_OFFSET_C() and VOXEL_OFFSET_D() for EndLightingComputation() to call][:lighting]
[1:03:57][Verify that our new macros work][:lighting :run]
[1:04:09][Set up to copy the values at the seams around the octahedron[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 :research]
[1:06:40][Make EndLightingComputation() copy the values at the seams around the octahedron[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:09:12][Check out the light map][:lighting :run]
[1:09:39][Toggle on the coloured octahedron in EndLightingComputation(), and make OpenGLChangeToSettings() zoom in to it][:"debug visualisation" :lighting]
[1:10:31][Check out the light map to see no copying][:lighting :run]
[1:10:47][Make EndLightingComputation() copy in to the bottom row of the octahedron][:lighting]
[1:11:39][See copying in the light map][:lighting :run]
[1:11:58][Make EndLightingComputation() copy in to the top row of the octahedron][:lighting]
[1:12:38][See copying in the light map][:lighting :run]
[1:12:52][Temporarily make EndLightingComputation() copy in coloured values][:lighting]
[1:13:05][See our correctly flipped copying in the light map][:lighting :run]
[1:13:19][Make EndLightingComputation() copy in to the left and right columns of the octahedron][:lighting]
[1:16:56][See copying in the light map, only missing the corners][:lighting :run]
[1:17:10][Check our leftright vertical copies with the paper[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 :research]
[1:17:46][Make EndLightingComputation() copy in to the corners of our octahedron][:lighting]
[1:19:30][See our fully filled light map][:lighting :run]
[1:19:41][Let EndLightingComputation() populate the light map with real values][:lighting]
[1:19:49][See our full light map, with no improvement to our discontinuity][:lighting :run]
[1:21:05][Scour CompileZBiasProgram() for octahedral mapping bugs][:lighting :research :sampling]
[1:24:11][Explicitly write out the OctMapCenterUV and OctExteriorUVDim initialisations in SampleLighting(), and continue to scour this function for bugs][:lighting :programming :research :sampling]
[1:28:21][Fix OctMapInteriorUVDimC.y in SampleLighting()][:lighting :sampling]
[1:29:43][Hit shader error][:lighting :run :sampling]
[1:29:59][Fix typo in SampleLighting()][:lighting :sampling]
[1:30:20][See different :lighting discontinuities][:run :sampling]
[1:30:40][Continue to scour SampleLighting() for bugs][:lighting :research :sampling]
[1:31:58][Take a close look at our :lighting discontinuities, and wonder if we have a blending error][:run]
[1:33:58][Centred, Padded Lookup][:blackboard :mathematics]
[1:34:51][Consider SampleLighting() to be doing a correct lookup][:lighting :research :sampling]
[1:35:52][Toggle on the coloured octahedron in EndLightingComputation()][:"debug visualisation" :lighting]
[1:36:25][Observe the :lighting discontinuities along with the light map][:"debug visualisation" :run]
[1:37:41][Make CompileZBiasProgram() colour the world directly with light][:"debug visualisation" :lighting]
[1:37:58][Observe the :lighting discontinuities with the world coloured with light][:"debug visualisation" :run]
[1:39:31][Let EndLightingComputation() populate the light map with real values][:lighting]
[1:39:37][Note that the :lighting discontinuities are not at copy points][:"debug visualisation" :run]
[1:39:54][Toggle on the coloured octahedron in EndLightingComputation()][:"debug visualisation" :lighting]
[1:39:58][Realise why we're not smoothly interpolating between adjacent, non-copied octants][:"debug visualisation" :lighting :run]
[1:40:55][Toggle on linear blending in OpenGLChangeToSettings()][:lighting]
[1:41:22][Admire our continuous :lighting][:"debug visualisation" :run]
[1:41:28][Let EndLightingComputation() populate the light map with real values][:lighting]
[1:41:54][Admire our continuous, yet popping :lighting][:"debug visualisation" :run]
[1:42:24][Shoulder the :Owl of Shame]
[1:42:50][Admire our :lighting][:owl :run]
[1:43:07][Revert CompileZBiasProgram() to modulate the world's real colours with light][:lighting :owl]
[1:43:21][Admire our :lighting, noting its directionality][:owl :run]
[1:44:54][Make CompileZBiasProgram() colour the world directly with light][:"debug visualisation" :lighting :owl :programming]
[1:44:59][Check out our :lighting seam][:"debug visualisation" :owl :run]
[1:45:21][Toggle on the coloured octahedron in EndLightingComputation()][:"debug visualisation" :lighting :owl :programming]
[1:45:30][Consider the seam to be along the wrapping border][:"debug visualisation" :lighting :owl :run]
[1:45:39][Let EndLightingComputation() populate the light map with real values][:lighting :owl :programming]
[1:45:50][Consider the seam not to be along the wrapping border][:"debug visualisation" :lighting :owl :run]
[1:45:59][Toggle on the coloured octahedron in EndLightingComputation()][:"debug visualisation" :lighting :owl :programming]
[1:46:00][Consider the seam to be straight down the middle of the pink][:"debug visualisation" :lighting :owl :run]
[1:46:39][Let EndLightingComputation() populate the light map with real values][:lighting :owl :programming]
[1:46:49][See the seam run in a different orientation][:"debug visualisation" :lighting :owl :run]
[1:46:59][Toggle on the coloured octahedron in EndLightingComputation()][:"debug visualisation" :lighting :owl :programming]
[1:47:06][Inspect our seam][:"debug visualisation" :lighting :owl :run]
[1:47:58][Let EndLightingComputation() populate the light map with real values][:lighting :owl :programming]
[1:48:13][Note the brightening as the character hops up][:"debug visualisation" :lighting :owl :run]
[1:49:42][Try making SumLight() sample the :lighting from the direction you're pointing, ignoring the actual reflection vector][:owl :programming :sampling]
[1:49:57][See no :lighting discontinuities][:"debug visualisation" :lighting :owl :run]
[1:51:21][Revert SumLight() to use the reflection vector][:owl :programming :sampling]
[1:52:02][Wonder if EndLightingComputation() is populating the octahedron incorrectly][:lighting :owl :research]
[1:53:16][:Sampling Within Pixels][:blackboard]
[1:55:08][Fix EndLightingComputation() to offset the light population by half a pixel][:lighting :owl :programming]
[1:56:29][Still see the seam][:"debug visualisation" :lighting :owl :run]
[1:56:49][Toggle EndLightingComputation() between offsetting the light population and not, to see difference but no improvement][:lighting :owl :programming :run]
[1:58:29][Q&A][:speech]
[1:59:01][@somebody_took_my_name][Q: Can you vary the light height to see its impact?][:lighting]
[1:59:29][@somebody_took_my_name][Either way][:lighting]
[1:59:30][@uplinkcoder][Q: Can you draw in the light probe positions?][:lighting]
[2:00:15][Make EndLightingComputation() draw the light probes, introducing IsInDebugVoxDim()][:"debug visualisation" :lighting]
[2:07:18][See our misplaced light probes][:"debug visualisation" :lighting :run]
[2:07:39][Fix the position of the light probe drawing in EndLightingComputation()][:"debug visualisation" :lighting]
[2:09:52][See our light probes, and consider the brightening to be due to a Z-discontinuity][:"debug visualisation" :lighting :run]
[2:11:36][@snubbykins][Q: Should you gutter copy from the opposite / flipped sides of the octal mapping so the bilinear blend will blend correctly?[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]
[2:12:50][Make UpdateAndRenderWorld() vary the height of the light][:lighting]
[2:14:35][See no light popping][:lighting :run]
[2:14:48][Increase the height variance of the light in UpdateAndRenderWorld()][:lighting]
[2:15:02][See light popping as the light passes through probes][:lighting :run]
[2:18:48][Remove the light height varying code][:lighting]
[2:18:58][Call it for today][:speech]
[/video]