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

66 lines
4.9 KiB
Plaintext

[video output=day385 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Trying Multisampled Depth Peels" vod_platform=youtube id=vOre9E5hJzc annotator=Miblo]
[0:28][Recap and set the stage for the day]
[1:46][Run the game and demo the aliasing around our geometric primitives]
[6:28][Describe the two processes at play: Artistic and Analytical Antialiasing]
[10:55][Consider our two options for handling this: Multisampling and Conservative Rasterization[ref
site="Khronos"
page="NV_conservative_raster"
url="https://www.khronos.org/registry/OpenGL/extensions/NV/NV_conservative_raster.txt"]]
[18:09][handmade_opengl.cpp: Review our depth peeling for sprite rendering]
[21:44][handmade_opengl.cpp: Determine to enable OpenGLChangeToSettings() to perform multisampling only on the front-most depth peel buffer]
[26:20][handmade_opengl.cpp: Consider how to perform the composite]
[31:02][handmade_opengl.cpp: Add ResolveHandle to opengl_framebuffer, and introduce SetDefaultFramebufferTextureParameters() and FramebufferTexImage()]
[41:02][handmade_opengl.cpp: Enable CreateFramebuffer() to create a ResolveFramebuffer for multisampling]
[43:27][Run the game to make sure that it works okay]
[43:38][handmade_opengl.cpp: Enable the multisampling path]
[47:29][Note that we cannot render from a multisampled texture as if it was a regular texture]
[49:00][handmade_opengl.cpp: Look into making OpenGLRenderCommands() conditionally bind depending on whether or not we're multisampling]
[49:54][handmade_opengl.cpp: Back out our changes and instead just create two framebuffers: one multisampled, one not]
[53:13][handmade_opengl.cpp: Make OpenGLRenderCommands() set the correct PeelBuffer for multisampling]
[54:38][handmade_opengl.cpp: Introduce GetDepthPeelReadBuffer()]
[56:23][Run the game to see a black screen, as expected]
[56:43][handmade_opengl.cpp: Enable OpenGLRenderCommands() to resolve our framebuffers]
[1:00:12][Run the game to see that everything appears at first glance to be working, but is a lot slower than we'd like]
[1:03:23][Consider using conservative rasterization]
[1:05:33][Determine to do everything multisampled, consulting the OpenGL documentation for sampler2DMS[ref
site="OpenGL Registry"
page="The OpenGL Shading Language 1.50 Quick Reference Card"
url=https://www.khronos.org/files/opengl-quick-reference-card.pdf][ref
site="OpenGL Registry"
page="The OpenGL Shading Language"
url=https://khronos.org/registry/OpenGL/specs/gl/GLSLangSpec.1.50.pdf]]
[1:14:26][When evaluating a given sample from a multisampled buffer, we want to get its corresponding depth sample[ref
site="OpenGL Registry"
page="The OpenGL Shading Language 1.50 Quick Reference Card"
url=https://www.khronos.org/files/opengl-quick-reference-card.pdf]]
[1:17:52][Note that conservative rasterization would definitely solve our problem]
[1:19:31][Consult the OpenGL Hardware Database to see which cards support GL_NV_conservative_raster[ref
site="OpenGL Hardware Database"
page="GL_NV_conservative_raster"
url=http://opengl.gpuinfo.org/gl_listreports.php?listreportsbyextension=GL_NV_conservative_raster] and GL_INTEL_conservative_rasterization[ref
site="OpenGL Hardware Database"
page="GL_INTEL_conservative_rasterization"
url=http://opengl.gpuinfo.org/gl_listreports.php?listreportsbyextension=GL_INTEL_conservative_rasterization]]
[1:20:44][Run the game and consider what's causing the slowness]
[1:22:37][handmade_opengl.cpp: Toggle back to non-multisampling, run the game to see that the frame rate is fine, and continue considering the slowness]
[1:24:37][handmade_opengl.cpp: Determine to enable the multisampling path to pick the closest depth value[ref
site=docs.GL
page=glBlitFramebuffer
url=http://docs.gl/gl3/glBlitFramebuffer][ref
site="OpenGL Registry"
page="OpenGL 3.2 (Core Profile)"
url=https://khronos.org/registry/OpenGL/specs/gl/glspec32.core.pdf]]
[1:30:49][handmade_opengl.cpp: Introduce ResolveMultisample()]
[1:38:31][handmade_opengl.cpp: Introduce CompileResolveMultisample() shader]
[1:45:49][Begin to consider the dilemma surrounding the averaging process]
[1:47:48][handmade_opengl.cpp: Fix compile errors]
[1:48:53][Q&A][:speech]
[1:49:46][@flyingsolomon][I think it will be useful to bind a key to topmost window as there is a key to full screen, then you will not have to resize your editor for live code editing. Also, since I bound the ` key to -> in my editor I'm a very happy panda, warm recommendations]
[1:50:27][@ravarix][Why s32 for the count, instead of u32?]
[1:51:03][@dragoonx6][Could you up the bitrate? It's really hard to watch when there's too much movement on the screen. It gets all blurry and pixelated. Not exaggerating when I say it makes my eyes watery]
[1:52:50][Wrap things up with a plug of the episode guide's new search feature[ref
site="Handmade Hero"
page="Episode Guide"
url="https://hero.handmade.network/episodes"]][:research]
[/video]