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

75 lines
7.1 KiB
Plaintext

[video output=day398 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Applying Lighting Back to Depth Peels" vod_platform=youtube id=f4Pzk8R8Sy4 annotator=Miblo]
[0:07][Recap and set the stage for the day]
[1:44][Run the game to show where we left off with the lighting]
[6:00][A few words on playing around with new rendering techniques, considering what to do now]
[7:19][handmade_opengl.cpp: Prevent TransferLight() in CompileZBiasProgram() from attentuating based on the facing direction, and run the game to show that]
[8:57][Determine to produce an output image using the lighting data]
[12:16][handmade_opengl.cpp: Consider how to extend CompilePeelComposite() to use our lighting data]
[14:34][handmade_opengl.cpp: Augment CompilePeelComposite() to pull in the normals for each peel sampler]
[17:50][handmade_opengl.cpp: Introduce LightPeel() in CompilePeelComposite()]
[20:00][handmade_opengl.cpp: Introduce UnpackNormal2() and UnpackNormal3() in the GlobalShaderHeaderCode]
[23:27][handmade_opengl.cpp: Continue to implement LightPeel() in CompilePeelComposite(), performing our lighting equation computation[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"]]
[35:15][handmade_opengl.cpp: Introduce MaxLightIntensity global_variable, as a poor person's tone mapping]
[37:28][Blackboard: Light Value Mapping]
[42:38][Blackboard: Picking a "response curve" based on film stock]
[44:53][handmade_opengl.cpp: Enable CompilePeelComposite() to sample and compute a response curve for LightC]
[49:53][handmade_opengl.cpp: Pass ToCamera to LightPeel()]
[50:06][handmade_opengl.cpp: Try and #define BeginShaderString and EndShaderString to enable 4coder to indent the heredocs]
[53:27][handmade_opengl.cpp: Introduce ExtendNormalZ() for CompilePeelComposite() to call]
[56:20][handmade_opengl.cpp: Enable CompilePeelComposite() to link up our samplers and bind our textures]
[1:01:19][handmade_opengl.cpp: Make CompilePeelComposite() set ToCamera]
[1:03:40][Run the game to see what it does]
[1:03:46][Toggle off the debug lighting visualisation and run the game to see a pure black screen]
[1:04:22][handmade_opengl.cpp: Investigate why CompilePeelComposite() is failing to correctly light the scene]
[1:07:24][handmade_opengl.cpp: Make CompilePeelComposite() write out the normal directly, and run the game to see that]
[1:08:24][handmade_opengl.cpp: Make CompilePeelComposite() write out RefN, and run the game to see that it does not look good]
[1:09:03][handmade_opengl.cpp: Fix UnpackNormal2() and PackNormal2() for CompilePeelComposite() to call]
[1:12:04][Run the game to see more sane normals]
[1:12:27][handmade_opengl.cpp: Make CompilePeelComposite() write out the DiffuseInner, and run the game to see that]
[1:14:03][handmade_opengl.cpp: Make CompilePeelComposite() write out the SpecInner, and run the game to see that that is the problem]
[1:14:50][handmade_opengl.cpp: Prevent CompilePeelComposite() from raising SpecInner to the power, and to make SpecularPower range from 1 to 16]
[1:15:41][Run the game to see that]
[1:16:08][handmade_opengl.cpp: Make CompilePeelComposite() output our computed lighting and run the game to see that it is sane]
[1:16:26][handmade_opengl.cpp: Prevent CompilePeelComposite() from accounting for the LightC, and run the game to see nothing]
[1:16:56][handmade_opengl.cpp: Prevent OpenGLRenderCommands() from calling FakeSeedLighting(), and make it call ComputeLightTransport() before binding the ResolveFramebuffer]
[1:18:03][Run the game to see our lit scene]
[1:19:10][handmade_opengl.cpp: Try to make LightPeel() in CompilePeelComposite() use the computed LightN, and run the game to see almost black]
[1:19:37][handmade_opengl.cpp: Revert LightPeel() to overwrite that LightN again]
[1:20:36][Run the game]
[1:21:08][handmade_opengl.cpp: Enable OpenGLRenderCommands() to switch between all the lighting buffers]
[1:25:15][Run the game to switch between the lighting buffers]
[1:25:18][win32_handmade.cpp: Swap the keys in Win32ProcessPendingMessages() for shifting up and down the levels of detail]
[1:25:41][Run the game and switch between the different buffers]
[1:26:23][handmade_opengl.cpp: Start to investigate the artifacting]
[1:29:15][Check the time][quote 587]
[1:29:43][Blackboard: Diffuse mapping, sampling an entire hemisphere of incoming light]
[1:34:25][Consider treating the light like a fluid, or at least making the down sample be more controlled]
[1:37:37][handmade_opengl.cpp: Determine to make the texture dimensions in CompileMultiLightUp() not based on the render dimensions]
[1:39:33][handmade_intrinsics.h: Introduce FindMostSignificantSetBit()]
[1:40:56][handmade_opengl.cpp: Make CompileMultiLightUp() set the lighting texture dimensions to the closest power of two to the render dimensions]
[1:43:33][Run the game to see the lighting buffers are more squat than expected, and investigate why]
[1:44:24][handmade_opengl.cpp: Make CompileDepthPeelToLighting() take the FragUV]
[1:47:25][Run the game to see that we're in better shape]
[1:48:21][handmade_opengl.cpp: Consider setting the normals to something more sane]
[1:49:13][Run the game and consider basing the lights' directional values on where they came from]
[1:52:12][Blackboard: Building a vertex buffer of reflector facing directions]
[1:58:33][Blackboard: Writing reflectors directly into a 3D texture, rather than using the depth peel pass]
[2:00:39][Q&A][:speech]
[2:01:46][@tricksterzorua][So, I would like to ask something: Any advice for beginners? Most likely asked before, but I just heard about this, and while I am interested in game development and programming in general, I never managed to learn a language. I want to try again with C# and a course from Microsoft]
[2:02:36][@asafgartner][Is there going to be a top-level that doesn't have a ceiling and instead would have direct sunlight?]
[2:03:40][@cad97][Does "no library" include no standard library?]
[2:04:44][@soysaucethekid][To do smooth edges, do you need to do the multisampling on all the buffers (normal, diffuse, etc)?]
[2:05:42][@kilo_pasztetowej][Any advice to working with all-OOP 'n' const programmers?]
[2:08:34][@stephenlast][Does GL have support for fully 3D textures?]
[2:09:24][@ravarix][As someone who was taught and always worked with OO programming, how does one enlighten themselves?]
[2:14:47][@emmacrantz][Could you overlay an additive gradient on top of the "card" geometry to make them seem to have more depth (to emulate more of a cone shape)?]
[2:16:08][@cubercaleb][Wouldn't trilinear sampling for a 2D texture imply sampling across different MIP levels? If so, what T value does the GPU use to interpolate between the layers?]
[2:16:47][Blackboard: Picking the correct MIP level for trilinear sampling]
[2:23:27][@karroffel][What are your opinions on DRM?]
[2:23:30][@deravadom][Okay, since we're low on questions. I'm working on an AI to play a game, and I'm wondering if you have any general tips for it. More specifically, the game is World of Warcraft. Right now I'm only at basic functions and working on the image processing pipeline]
[2:24:07][Wind it down][:speech]
[/video]