Handmade Hero»Episode Guide
Alpha Blending Multiple Render Targets
?
?

Keyboard Navigation

Global Keys

[, < / ], > Jump to previous / next episode
W, K, P / S, J, N Jump to previous / next marker
t / T Toggle theatre / SUPERtheatre mode
V Revert filter to original state Y Select link (requires manual Ctrl-c)

Menu toggling

q Quotes r References f Filter y Link c Credits

In-Menu Movement

a
w
s
d
h j k l


Quotes and References Menus

Enter Jump to timecode

Quotes, References and Credits Menus

o Open URL (in new tab)

Filter Menu

x, Space Toggle category and focus next
X, ShiftSpace Toggle category and focus previous
v Invert topics / media as per focus

Filter and Link Menus

z Toggle filter / linking mode

Credits Menu

Enter Open URL (in new tab)
1:06Run the game and show our current situation with render targets
1:06Run the game and show our current situation with render targets
1:06Run the game and show our current situation with render targets
2:56handmade_entity.cpp: Make UpdateAndRenderEntities() create two different ClipRects for the alpha and normal floors
2:56handmade_entity.cpp: Make UpdateAndRenderEntities() create two different ClipRects for the alpha and normal floors
2:56handmade_entity.cpp: Make UpdateAndRenderEntities() create two different ClipRects for the alpha and normal floors
6:08Run the game and see that the alpha stuff is gone
6:08Run the game and see that the alpha stuff is gone
6:08Run the game and see that the alpha stuff is gone
6:53Consider ways of using multiple render targets
6:53Consider ways of using multiple render targets
6:53Consider ways of using multiple render targets
9:28handmade_render.cpp: Add a RenderGroupEntryType_blend_render_target in RenderCommandsToBitmap() and introduce BlendRenderTarget()
9:28handmade_render.cpp: Add a RenderGroupEntryType_blend_render_target in RenderCommandsToBitmap() and introduce BlendRenderTarget()
9:28handmade_render.cpp: Add a RenderGroupEntryType_blend_render_target in RenderCommandsToBitmap() and introduce BlendRenderTarget()
14:36handmade_render.cpp: Implement BlendRenderTarget() based on DrawRectangle()
14:36handmade_render.cpp: Implement BlendRenderTarget() based on DrawRectangle()
14:36handmade_render.cpp: Implement BlendRenderTarget() based on DrawRectangle()
24:44handmade_render.cpp: Introduce Pack4x8()
24:44handmade_render.cpp: Introduce Pack4x8()
24:44handmade_render.cpp: Introduce Pack4x8()
26:00handmade_render.cpp: Continue implementing BlendRenderTarget(), making it do gamma properly
26:00handmade_render.cpp: Continue implementing BlendRenderTarget(), making it do gamma properly
26:00handmade_render.cpp: Continue implementing BlendRenderTarget(), making it do gamma properly
27:27handmade_render_group.h: Add RenderGroupEntryType_blend_render_target to the render_group_entry_type enum and introduce render_entry_blend_render_target struct
27:27handmade_render_group.h: Add RenderGroupEntryType_blend_render_target to the render_group_entry_type enum and introduce render_entry_blend_render_target struct
27:27handmade_render_group.h: Add RenderGroupEntryType_blend_render_target to the render_group_entry_type enum and introduce render_entry_blend_render_target struct
29:14Run the game and see that it does nothing
29:14Run the game and see that it does nothing
29:14Run the game and see that it does nothing
29:33handmade_render.cpp: Make RenderCommandsToBitmap() clear everyone
29:33handmade_render.cpp: Make RenderCommandsToBitmap() clear everyone
29:33handmade_render.cpp: Make RenderCommandsToBitmap() clear everyone
31:55handmade_render_group.cpp: Introduce PushBlendRenderTarget() based on PushClipRect(), which will do the composite
31:55handmade_render_group.cpp: Introduce PushBlendRenderTarget() based on PushClipRect(), which will do the composite
31:55handmade_render_group.cpp: Introduce PushBlendRenderTarget() based on PushClipRect(), which will do the composite
39:39handmade_entity.cpp: Make UpdateAndRenderEntities() call PushBlendRenderTarget()
39:39handmade_entity.cpp: Make UpdateAndRenderEntities() call PushBlendRenderTarget()
39:39handmade_entity.cpp: Make UpdateAndRenderEntities() call PushBlendRenderTarget()
41:30Debugger: Run the game and crash in Win32CompleteAllWork()
41:30Debugger: Run the game and crash in Win32CompleteAllWork()
41:30Debugger: Run the game and crash in Win32CompleteAllWork()
41:51build.bat: Switch to -Od, run the game and crash in BlendRenderTarget()
41:51build.bat: Switch to -Od, run the game and crash in BlendRenderTarget()
41:51build.bat: Switch to -Od, run the game and crash in BlendRenderTarget()
42:33handmade_entity.cpp: Make UpdateAndRenderEntities() use AlphaFloorRenderTarget and pass it to BlendRenderTarget()
42:33handmade_entity.cpp: Make UpdateAndRenderEntities() use AlphaFloorRenderTarget and pass it to BlendRenderTarget()
42:33handmade_entity.cpp: Make UpdateAndRenderEntities() use AlphaFloorRenderTarget and pass it to BlendRenderTarget()
43:07build.bat: Switch to -O2, run the game and see how slowly the game now runs
43:07build.bat: Switch to -O2, run the game and see how slowly the game now runs
43:07build.bat: Switch to -O2, run the game and see how slowly the game now runs
44:16Debugger: Step through BlendRenderTarget() and investigate what's happening
44:16Debugger: Step through BlendRenderTarget() and investigate what's happening
44:16Debugger: Step through BlendRenderTarget() and investigate what's happening
44:51handmade_render.cpp: Make BlendRenderTarget() correctly set the DestColor and Result
44:51handmade_render.cpp: Make BlendRenderTarget() correctly set the DestColor and Result
44:51handmade_render.cpp: Make BlendRenderTarget() correctly set the DestColor and Result
45:32Run the game, see no alpha blending happening and investigate why
45:32Run the game, see no alpha blending happening and investigate why
45:32Run the game, see no alpha blending happening and investigate why
46:40handmade_render.cpp: Try making BlendRenderTarget() hardcode the Alpha to 0.5f
46:40handmade_render.cpp: Try making BlendRenderTarget() hardcode the Alpha to 0.5f
46:40handmade_render.cpp: Try making BlendRenderTarget() hardcode the Alpha to 0.5f
46:57Run the game and see that the Alpha is not taking effect
46:57Run the game and see that the Alpha is not taking effect
46:57Run the game and see that the Alpha is not taking effect
48:01build.bat: Switch to -Od, step in to BlendRenderTarget() and see what happens when we have a source pixel with something in it
48:01build.bat: Switch to -Od, step in to BlendRenderTarget() and see what happens when we have a source pixel with something in it
48:01build.bat: Switch to -Od, step in to BlendRenderTarget() and see what happens when we have a source pixel with something in it
49:23handmade_entity.cpp: Remove the transient_clip_rect from UpdateAndRenderEntities() and make it manually set the CurrentClipRect
49:23handmade_entity.cpp: Remove the transient_clip_rect from UpdateAndRenderEntities() and make it manually set the CurrentClipRect
49:23handmade_entity.cpp: Remove the transient_clip_rect from UpdateAndRenderEntities() and make it manually set the CurrentClipRect
50:12Run the game and see the prettiness before switching to -O2
50:12Run the game and see the prettiness before switching to -O2
50:12Run the game and see the prettiness before switching to -O2
50:45Run the game and marvel at the indescribable cacophony of epileptic colorα
50:45Run the game and marvel at the indescribable cacophony of epileptic colorα
50:45Run the game and marvel at the indescribable cacophony of epileptic colorα
51:36handmade_render.cpp: Make BlendRenderTarget() use SRGB255ToLinear1() and Linear1ToSRGB255()
51:36handmade_render.cpp: Make BlendRenderTarget() use SRGB255ToLinear1() and Linear1ToSRGB255()
51:36handmade_render.cpp: Make BlendRenderTarget() use SRGB255ToLinear1() and Linear1ToSRGB255()
53:51Run the game and again see the sparkly
53:51Run the game and again see the sparkly
53:51Run the game and again see the sparkly
54:11handmade_render.cpp: Prevent Pack4x8() from doing the multiply
54:11handmade_render.cpp: Prevent Pack4x8() from doing the multiply
54:11handmade_render.cpp: Prevent Pack4x8() from doing the multiply
54:31Run the game and see that we're getting closer to being correct
54:31Run the game and see that we're getting closer to being correct
54:31Run the game and see that we're getting closer to being correct
54:47handmade_render.cpp: Make BlendRenderTarget() use the correct Alpha
54:47handmade_render.cpp: Make BlendRenderTarget() use the correct Alpha
54:47handmade_render.cpp: Make BlendRenderTarget() use the correct Alpha
56:18handmade_entity.cpp: Make UpdateAndRenderEntities() set TestAlpha as a single r32 rather than an array of them
56:18handmade_entity.cpp: Make UpdateAndRenderEntities() set TestAlpha as a single r32 rather than an array of them
56:18handmade_entity.cpp: Make UpdateAndRenderEntities() set TestAlpha as a single r32 rather than an array of them
58:40"I love how it can't ever tell you any values in release mode"β
58:40"I love how it can't ever tell you any values in release mode"β
58:40"I love how it can't ever tell you any values in release mode"β
58:46Debugger: Step into UpdateAndRenderEntities() and investigate how TestAlpha got to be set to 1.0f
58:46Debugger: Step into UpdateAndRenderEntities() and investigate how TestAlpha got to be set to 1.0f
58:46Debugger: Step into UpdateAndRenderEntities() and investigate how TestAlpha got to be set to 1.0f
1:01:42handmade_entity.cpp: Make UpdateAndRenderEntities() pass FadeTopEndZ and FadeTopStartZ to TestAlpha() in the opposite order
1:01:42handmade_entity.cpp: Make UpdateAndRenderEntities() pass FadeTopEndZ and FadeTopStartZ to TestAlpha() in the opposite order
1:01:42handmade_entity.cpp: Make UpdateAndRenderEntities() pass FadeTopEndZ and FadeTopStartZ to TestAlpha() in the opposite order
1:01:58build.bat: Switch to -O2, run the game and see the alpha blending working beautifully
1:01:58build.bat: Switch to -O2, run the game and see the alpha blending working beautifully
1:01:58build.bat: Switch to -O2, run the game and see the alpha blending working beautifully
1:03:12handmade_render.cpp: Make RenderCommandsToBitmap() clear both the MaxRenderTargetIndex and the previous TargetIndex
1:03:12handmade_render.cpp: Make RenderCommandsToBitmap() clear both the MaxRenderTargetIndex and the previous TargetIndex
1:03:12handmade_render.cpp: Make RenderCommandsToBitmap() clear both the MaxRenderTargetIndex and the previous TargetIndex
1:03:41Run the game and see that now it looks like we're good
1:03:41Run the game and see that now it looks like we're good
1:03:41Run the game and see that now it looks like we're good
1:04:00Note that the clear is clearing at 1.0f alpha, and that it has to actually clear, not blend
1:04:00Note that the clear is clearing at 1.0f alpha, and that it has to actually clear, not blend
1:04:00Note that the clear is clearing at 1.0f alpha, and that it has to actually clear, not blend
1:04:46Q&A
🗩
1:04:46Q&A
🗩
1:04:46Q&A
🗩
1:05:57Kknewkles Giger / Lovecraft-themed Handmade Hero DLC confirmed?
🗪
1:05:57Kknewkles Giger / Lovecraft-themed Handmade Hero DLC confirmed?
🗪
1:05:57Kknewkles Giger / Lovecraft-themed Handmade Hero DLC confirmed?
🗪
1:06:08soysaucethekid Are you writing to the second buffer all the time? If so, is it possible to only use when you need it (like during the transitions)?
🗪
1:06:08soysaucethekid Are you writing to the second buffer all the time? If so, is it possible to only use when you need it (like during the transitions)?
🗪
1:06:08soysaucethekid Are you writing to the second buffer all the time? If so, is it possible to only use when you need it (like during the transitions)?
🗪
1:06:37handmade_entity.cpp: Make UpdateAndRenderEntities() only do the multiple buffers stuff if the alpha is enabled
1:06:37handmade_entity.cpp: Make UpdateAndRenderEntities() only do the multiple buffers stuff if the alpha is enabled
1:06:37handmade_entity.cpp: Make UpdateAndRenderEntities() only do the multiple buffers stuff if the alpha is enabled
1:09:25pseudonym73 How does a limbless child "limp along", exactly?
🗪
1:09:25pseudonym73 How does a limbless child "limp along", exactly?
🗪
1:09:25pseudonym73 How does a limbless child "limp along", exactly?
🗪
1:09:34inquarry How many floors can this code support? I envision a tall tower or stairwell, peering down 20 or so floors and seeing NPCs acting as normal. Was that your intent?
🗪
1:09:34inquarry How many floors can this code support? I envision a tall tower or stairwell, peering down 20 or so floors and seeing NPCs acting as normal. Was that your intent?
🗪
1:09:34inquarry How many floors can this code support? I envision a tall tower or stairwell, peering down 20 or so floors and seeing NPCs acting as normal. Was that your intent?
🗪
1:10:56Kknewkles How do you use trace files to debug? Someone trying my game prototype had a crash and sent me a (95MB) dump file, since you once said it's helpful. I don't doubt that, but what do you do with the damn thing?
🗪
1:10:56Kknewkles How do you use trace files to debug? Someone trying my game prototype had a crash and sent me a (95MB) dump file, since you once said it's helpful. I don't doubt that, but what do you do with the damn thing?
🗪
1:10:56Kknewkles How do you use trace files to debug? Someone trying my game prototype had a crash and sent me a (95MB) dump file, since you once said it's helpful. I don't doubt that, but what do you do with the damn thing?
🗪
1:13:39Wrap it up
🗩
1:13:39Wrap it up
🗩
1:13:39Wrap it up
🗩