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

77 lines
6.5 KiB
Plaintext

[video output=day408 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Finishing Debugging Volume Textures" vod_platform=youtube id=aRQ4aSUA5Gs annotator=Miblo]
[0:03][Recap and set the stage for the day]
[0:38][Fix the monitor's colour]
[1:55][Resume our investigations into the volume texture lookup]
[4:46][Determine to use structured art to verify that we are transmitting the correct values]
[7:58][handmade_render_group.cpp: Make OutputLightingTextures() write a monotonically increasing value into the lookup sampler]
[10:30][handmade_opengl.cpp: Make CompileZBiasProgram() use that value directly]
[13:12][handmade_render_group.cpp: Temporarily disable OutputTextureDebug()]
[13:55][Run the game and see nothing]
[15:03][handmade_world_mode.cpp: Prevent UpdateAndRenderWorld() from calling OutputLighting()]
[16:32][Run the game and hunt for a key binding to capture a frame]
[18:53][Capture a frame and see that the lookup sampler contains all 0]
[20:18][Run the game, run PushLighting() and capture a frame to see our expected values in the lookup sampler]
[21:55][handmade_render_group.cpp: Make OutputLightingTextures() set the fragment shader's lighting texels and colour to known values]
[25:16][Capture a frame, but find that the compiler has optimised out the lighting texels and colour]
[26:33][handmade_opengl.cpp: Investigate why the texelFetch in CompileZBiasProgram() is not using our structured art, with a few words on graphics programming]
[31:13][handmade_opengl.cpp: Verify VoxP in CompileZBiasProgram() by colouring the voxels by their address]
[32:21][Run the game to see our colour-coded representation of the voxel lookup]
[33:10][handmade_opengl.cpp: Make CompileZBiasProgram() set the colour from the VoxP after flooring]
[33:41][Run the game to see that this is still as expected]
[34:48][handmade_opengl.cpp: Make CompileZBiasProgram() perform texelFetch() on our verified values]
[36:59][Run the game and still see black]
[37:28][Consult the OpenGL Shading Language Specification for texelFetch()[ref
site="Khronos"
page="The OpenGL Shading Language 4.40"
url=https://khronos.org/registry/OpenGL/specs/gl/GLSLangSpec.4.40.pdf]]
[44:08][handmade_opengl.cpp: Initialise LightI as a uint, and continue to wonder why we are not successfully fetching from the LookupSampler]
[50:48][handmade_opengl.cpp: Try setting the UseLightC to individual colours from the LookupSampler, to see exactly what texelFetch() returns]
[54:39][Run the game to see that the alpha channel unexpectedly is a high value before submitting the texture]
[56:03][Reflect on our findings, that texelFetch() is returning 0, 0, 0, 1]
[1:00:54][@macielda][Maybe up your level of debug message notifications?]
[1:01:12][handmade_opengl.cpp: Print out all of the debug messages]
[1:03:32][@bestalloys][3rd comment: https://stackoverflow.com/questions/26770216/why-is-texelfetch-always-returning-0-for-a-1d-single-channel-texture]
[1:07:05][handmade_opengl.cpp: Make OpenGLChangeToSettings() set GL_TEXTURE_MIN_FILTER and GL_TEXTURE_MAG_FILTER to GL_NEAREST]
[1:11:47][Run the game to see that this totally fixed it, and wonder why texelFetch() applied filtering]
[1:15:44][Consult the OpenGL Specification for texelFetch()[ref
site="Khronos"
page="OpenGL 4.4 (Core Profile)"
url="https://khronos.org/registry/OpenGL/specs/gl/glspec44.core.pdf"]]
[1:19:02][Read about Texture Completeness[ref
site="Khronos"
page="OpenGL 4.4 (Core Profile)"
url="https://khronos.org/registry/OpenGL/specs/gl/glspec44.core.pdf"]]
[1:23:05][handmade_opengl.cpp: Enable CompileZBiasProgram() to use our structured art fetched from the LookupSampler]
[1:32:53][handmade_opengl.cpp: Enable CompileZBiasProgram() to sample our real lighting values]
[1:34:01][Run the game to see that we are getting the colours we'd expect]
[1:34:45][handmade_opengl.cpp: Make the lighting grid more coarse]
[1:36:17][Run the game and note that we are not covering all the space with light]
[1:37:18][handmade_opengl.cpp: Introduce SumVoxelLight() to enable CompileZBiasProgram() to sample from neighbouring voxels]
[1:46:03][Run the game to see that running fast]
[1:47:48][handmade_opengl.cpp: Make CompileZBiasProgram() modulate the texture colours by the lighting values]
[1:48:29][Run the game to see our lit scene]
[1:48:51][handmade_opengl.cpp: Enable CompileZBiasProgram() to weight the lighting values by their proximity]
[1:52:24][Run the game to see that we don't have dense enough lighting coverage]
[1:52:48][handmade_opengl.cpp: Make the lighting grid more fine grained]
[1:53:09][Run the game to see our more smoothly lit scene]
[1:55:01][handmade_opengl.cpp: Change the coarseness of the lighting grid]
[1:56:49][Q&A][:speech]
[1:57:14][@bestalloys][Why no indentation on the shader code?]
[1:58:29][@butwhynot1][Have you tried CUDA? Do you think it's a reasonable way to do GPU programming? AMD is trying to get a CUDA compatible compiler so it could be usable on both vendors soon]
[2:00:28][@4bitlightning][Could you try to use #include and the multi line strings together for the shader code?]
[2:01:20][@poohshoes][I've just started a project and am working through the setup on Day 002. You had set up a PatBlt on WM_PAINT to alternate black and white. If I made no mistakes then it doesn't work on windows 10, I'm instead getting all white and if I drag the window around, the new part of the window becomes black? Do you know if there are any caveats for windows 10 I should be worried about? Should I keep going or is it important to get this working exactly the same?]
[2:02:19][@nxsy][Do you have any suggestions on how to start going about voxelising more complex 3D meshes rather than simpler geometric shapes? Break them up into simpler geometric version / LOD meshes first? Should each mesh be pre-voxelised, or do you need to recalculate relative to the world / view position (and possibly distance from camera)?]
[2:04:08][@nxsy][Not necessarily doing it on the GPU, but to provide what the GPU needs to do this sort of lighting with more complex meshes]
[2:06:54][Blackboard: 2D rasterization]
[2:08:16][Blackboard: Conservative rasterization]
[2:12:17][Blackboard: Faster voxelization, using Reyes rendering[ref
site="Wikipedia"
page="Reyes rendering"
url="https://en.wikipedia.org/wiki/Reyes_rendering"]]
[2:17:24][Recommend crawling references[ref
site="CiteSeerX"
page="Interactive Indirect Illumination Using Voxel Cone Tracing"
url="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.225.5903"]][:research]
[2:22:29][Close down the stream][:speech]
[/video]