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

43 lines
3.7 KiB
Plaintext
Raw Permalink Normal View History

[video output=day296 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Fog and Alpha for Layers" vod_platform=youtube id=kAHKTNjaD-Y annotator=Miblo]
[2:07][Recap and set the stage for the day]
[3:36][handmade_world_mode.cpp: Set Volumes to not be Upright in UpdateAndRenderWorld]
[4:38][Run the game and see the difference that makes]
[9:31][handmade_render_group.h: Make GlobalAlpha in render_group a v4 and rename it to GlobalModulate]
[10:41][Consider clearly distinguishing between colours that have premultiplied alpha and those that don't]
[12:39][handmade_render_group.cpp: Introduce StoreColor and make PushBitmap, PushRect and Clear call it]
[14:25][Blackboard: Hadamard Product]
[17:05][handmade_render_group.h: Add tGlobalColor and GlobalColor to render_group to allow us to do a linear blend as well as a modulate]
[20:08][handmade_render_group.cpp: Pass the Group to the StoreColor calls]
[21:11][Blackboard: Fade vs Haze]
[22:22][handmade_world_mode.cpp: Conditionally compute the tGlobalColor and GlobalColor for fade and haze in UpdateAndRenderWorld]
[25:11][Run the game and note that we're not handling alpha multiplication correctly]
[26:04][handmade_render.cpp: Stop DrawRectangle, DrawRectangleSlowly and DrawRectangleQuickly from premultiplying the alpha]
[27:20][handmade_render_group.h: Rename Color to PremulColor where appropriate]
[29:41][Run the game, see that our two renderers draw solid filled rectangles in different colours and investigate why this is the case]
[37:52][handmade_render.cpp: Try not squaring the Color when modulating incoming Color in DrawRectangle]
[39:21][handmade_render.cpp: Try Squaring the Color up front in DrawRectangle]
[42:37][handmade_render.cpp: Try multiplying all the Colors by 255 again]
[43:25][Run the game and see that that's almost exact]
[43:38][Blackboard: Ensuring that we remain in the same colour space]
[47:23][Debugger: Step into UpdateAndRenderWorld when CameraRelativeP.z > FadeTopStartZ and inspect the Color values]
[52:39][handmade_opengl.cpp: Try rendering everything at 50% opacity]
[55:27][Debugger: Step into OpenGLRectangle and inspect the Entry->PremulColor values]
[57:08][handmade_render_group.h: Conditionally add DebugTag to render_group_entry_header and render_group if we are in HANDMADE_SLOW mode]
[1:00:10][handmade_world_mode.cpp: Make UpdateAndRenderWorld set DebugTag to 1 if CameraRelativeP.z > FadeTopStartZ]
[1:01:06][Debugger: Break into our BreakHere line in OpenGLRenderCommands]
[1:02:18][handmade_world_mode.cpp: Negate the alpha of tGlobalColor for the fade]
[1:02:56][Run the game and see that the fade is now correct]
[1:04:02][Investigate why we are seeing nothing below our level]
[1:07:32][handmade_world_mode.cpp: Enable the correct blending in UpdateAndRenderWorld]
[1:07:55][handmade_world_mode.cpp: Initialise a BackgroundColor in UpdateAndRenderWorld and pass this to Clear and the GlobalColor for the lowest floors]
[1:08:55][Run the game and see the haze happening]
[1:09:27][Q&A][:speech]
[1:10:03][@thesizik][One thing you could try is having the center of the perspective projection be the player's position, so things on other levels line up straight]
[1:10:29][@soysaucethekid][The Hadamard transform seems like it can be used for a lot of things. What is it doing in handmade_world.cpp in the subtract function?]
[1:10:56][Blackboard: Hadamard Product \~= Diagonal Matrix]
[1:16:32][@cubercaleb][For the record, a circle with an x would be the tensor product]
[1:17:25][@jayp2][Would it be difficult to implement textured or just different fog colors, so you could make, for instance, vignetted fog?]
[1:19:46][@shabiel][How did you finally discover the gamma correction bug? What was the clue that made you say ah ha?]
[1:21:05][Wind it down][:speech]
[/video]