[video output=day393 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Planning Lighting from Depth Peels" vod_platform=youtube id=QEJKHpqlTSs annotator=Miblo] [0:07][Recap and set the stage for the day] [2:24][Run the game to show off the renderer and camera movement] [5:55][Launch the code with a few words on the tweaked 4coder UI, and our intentions for the light textures] [9:09][Blackboard: Light accumulation pass] [13:08][Run the game and note that there's no shadowing, with a few words on shadow maps] [17:18][Blackboard: Using our depth peels as geometry for the bounce lighting] [18:59][Blackboard: Screen-space ambient occlusion (SSAO)] [20:49][Blackboard: Voxel cone tracing] [23:05][Hunt for a paper on ambient occlusion] [26:19]["I don't want pirate stuff, I want Pirates of the Caribbean"][quote 580] [29:52][Consult 'Dynamic Ambient Occlusion and Indirect Lighting'[ref site="NVIDIA Developer" page="Chapter 14. Dynamic Ambient Occlusion and Indirect Lighting" url="https://developer.nvidia.com/gpugems/GPUGems2/gpugems2_chapter14.html"]] [35:13][Blackboard: Writing out the normal with the depth buffer, filtered down in resolution] [39:01][Blackboard: The expense of this scheme] [43:35][Blackboard: Sampling from the textures[ref site="NVIDIA Developer" page="Chapter 14. Dynamic Ambient Occlusion and Indirect Lighting" url="https://developer.nvidia.com/gpugems/GPUGems2/gpugems2_chapter14.html"]] [47:48]["We are out in complete La La Land, and I admit that, but, I mean, it's lighting, what do you want from me?"][quote 582] [47:57][Blackboard: Multigrid lighting, modulating incoming values at successively finer resolutions] [56:42]["That's my stupid idea. I hope you like it"][quote 583] [56:54][Blackboard: Possible discontinuities caused by the mipmap boundaries] [58:22][Consider going for this hierarchically merged lighting idea] [1:00:55][Blackboard: Lighting memory requirements] [1:08:25][Blackboard: Hardware capability requirements] [1:13:18][Consult the OpenGL Hardware Database[ref site="OpenGL" page="Hardware Database" url="http://opengl.gpuinfo.org/"] and OpenGL Core Profile 4.4[ref site="Khronos" page="OpenGL 4.4 Core Profile" url="https://khronos.org/registry/OpenGL/specs/gl/glspec44.core.pdf"]] [1:16:09][handmade_opengl.h: Add MaxColorAttachments and MaxSamplersPerShader to open_gl, and enable OpenGLInit() to poll for those values[ref site="Khronos" page="glcorearb.h" url=https://www.khronos.org/registry/OpenGL/api/GL/glcorearb.h]] [1:20:06][Run the game and inspect the MaxColorAttachments and MaxSamplersPerShader values for our card] [1:20:44][Consult the OpenGL Hardware Database for GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS[ref site="OpenGL" page="Hardware Database" url="http://opengl.gpuinfo.org/"]] [1:22:19][Go for it, considering first how many mip levels to use] [1:30:11][handmade_opengl.h: Introduce light_buffer and add an array of them to the open_gl struct] [1:36:43][handmade_opengl.cpp: Enable OpenGLChangeToSettings() to free and allocate lighting framebuffers] [1:39:08][handmade_opengl.cpp: Try to make FramebufferTexImage() pass 0 as the Format, Type and Data to glTextImage2D()] [1:41:33][Run the game and hit a GL_INVALID_ENUM error] [1:41:51][handmade_opengl.cpp: Enable OpenGLChangeToSettings() to attach our textures to the lighting framebuffer[ref site="Khronos" page="Sampler (GLSL)" url=https://www.khronos.org/opengl/wiki/Sampler_(GLSL)]] [1:51:58][Run the game and see our surfaces ready to go] [1:52:44][Q&A][:speech] [1:53:28][@dautor][Are you planing on taking a different / non-conventional approach to lighting?] [1:53:43][@itsaunicorndog][Any recommended programs to use for a noob?] [1:54:18][@x13pixels][Is that metal music coming from the stream or am I trippin'?] [1:54:38][@dautor][Will you port the game to JAI? Or make a part of it in JAI once it comes out, and just link to the original?] [1:55:37][@willsch][Which do you think will take longer, coding the engine or coding the actual game?] [1:57:59][@itsaunicorndog][Editor for programming] [1:59:07][@hholst80][Do you work on Handmade Hero outside of the streaming time? How representative is the time on stream to the total time you put down on the programming / architecture?] [2:01:16][@garryjohanson][Off-topic and not really a question: There exists an IDE in Linux called "code::blox". It works great but I don't know if it has feature parity with vs. But something to look into, perhaps] [2:02:08][@macielda][About Retained and Immediate mode, do you think these paradigm boxes work for game code (as opposed to engine code) as well?] [2:04:15][Retention] [2:08:28][@macielda][If so, would you write your game logic code in Immediate mode or Retained mode?] [2:10:25][@dautor][I plan on starting a project this summer, a 4D perspective projection voxel game. May I ask you for some tips on graphics, then? (Like, how do I utilize the graphics card the best, because it is not optimized for 5x5 matrices and it's hard to think with other concepts for me?)] [2:11:02][Blackboard: GPUs aren't actually \[XYZW\] vectors] [2:16:19][Wind it down][:speech] [/video]