[video output=day402 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Adding Raycasting to the Lighting" vod_platform=youtube id=EHLuL65XEnE annotator=Miblo]
[0:17][Recap and set the stage for the day]
[1:35][Run the game and consider how we can improve the lighting quality]
[3:36][Determine to work on directional shadowing or light bleeding]
[7:55][Light transference between reflectors]
[13:04][Blackboard: Cube mapped reflectors]
[17:16][Gesture wildly][quote 590]
[17:50][Blackboard: The magic of the Z-buffer]
[20:14][Blackboard: Emulating the effects of a Z-buffer in the lighting system]
[23:42][Blackboard: Casting cones]
[26:23][Blackboard: Ray / Plane Intersection]
[34:54][Blackboard: Modelling reflectors as disks for the purposes of shadowing]
[42:16][Determine to pick one reflector on which to do the computations]
[44:17][Welcome votes to be freely cast in the chat][quote 591]
[44:29][On democracy...][quote 593]
[44:52][...and oppression][quote 592]
[44:58][handmade_render_group.cpp: Enable LightingTest() to pick and highlight a reflector for us to use]
[49:43][Run the game and find our picked reflector]
[52:10][handmade_render_group.cpp: Enable LightingTest() to isolate our test reflector in the compute lighting path]
[54:35][Run the game and see that our test reflector didn't bleed out any light]
[56:10][handmade_render_group.cpp: Enable LightingTest() to strengthen the yellow of our test reflector and run the game]
[57:17][handmade_render_group.cpp: Enable LightingTest() to cast rays from our test reflector out into the scene]
[1:02:18][Blackboard: Casting rays from the reflector]
[1:03:08][handmade_render_group.cpp: Continue to enable LightingTest() to cast rays from our reflector]
[1:06:02][Blackboard: Computing the intersection point of a ray with the plane of a reflector]
[1:07:24][handmade_render_group.cpp: Start to enable LightingTest() to determine whether reflectors intersect]
[1:09:54][Blackboard: Determining whether reflectors intersect]
[1:10:27][handmade_render_group.cpp: Finish enabling LightingTest() to determine whether reflectors intersect and then compute shadowing for them]
[1:15:57][Run the game to see that our test reflector is black]
[1:16:55][handmade_world_mode.cp: Toggle off the hero's body and run the game again to see that our light does not affect the reflector]
[1:18:04][handmade_world_mode.cpp: Increase the radius passed to PushLight() by UpdateAndRenderWorld()]
[1:19:18][Step in to LightingTest() to inspect what it does]
[1:20:20][handmade_render_group.cpp: Make LightingTest() only cast rays out of the front of our reflector]
[1:21:15][Run the game to see that our light does light up our test reflector]
[1:21:54][handmade_render_group.cpp: Try running the ray casting on everybody]
[1:22:38][Run the game to see everyone apparently unlit]
[1:23:13][handmade_render_group.cpp: Make LightingTest() cast out eight rays in many directions]
[1:25:24][Run the game to see reflectors getting lit up]
[1:26:49][handmade_render_group.cpp: Enable LightingTest() to perform cone-based ray tracing]
[1:27:56][Run the game to see more pick-up of the light]
[1:28:55][Blackboard: Needing to determine how much of a cone is being intersected]
[1:31:53][handmade_render_group.cpp: Make LightingTest() generate 32 rays pointing in random directions]
[1:35:33][Run the game to see the ray traced lighting, and increase the number of rays]
[1:38:20][handmade_render_group.cpp: Reduce the number of rays to 16]
[1:40:17][Step in to LightingTest() and inspect the rays]
[1:42:29][handmade_render_group.cpp: Enable LightingTest() to cast narrow cones, and run the game]
[1:43:49][handmade_render_group.cpp: Enable LightingTest() to direct rays more cleverly]
[1:46:56][Run the game and note that we are getting a real shadowing solution now]
[1:48:22][handmade_brain.cpp: Make ExecuteBrain() clamp the spring down]
[1:50:49][Run the game and look at our lighting solution]
[1:52:09][handmade_world_mode.cpp: Make AddStandardRoom() build a second wall]
[1:53:05][Run the game to see how the walls occlude and reflect the light, with different numbers of lighting passes]
[1:56:06][handmade_world_mode.cpp: Make AddStandardRoom() build different coloured walls]
[1:56:47][Run the game to see how the two walls behave in the light]
[1:57:44][handmade_render_group.cpp: Make LightingTest() increase the max emission]
[1:58:17][Run the game to see the brighter light]
[2:00:18][Q&A][:speech]
[2:01:08][@qwindoo][Are there engine features or ideas that emerged during the Handmade Hero streams and that you've since "backported" to the 1935 engine?]
[2:02:45][@Miblo][For the random series you picked (at random) 1234. Could it have made any sense to pick 360 there, for 360 degrees, or would absolutely any number do?]
[2:05:39][@paulygon104][Probably the ingest server hiccuped or something]
[2:07:12][@mtsmox][I think you can keep files open in visual studio by clicking the icon next to the close icon]
[2:09:49][@bigfellahull][Tools > Options > Environment > Tabs and Windows > deselect allow new files to be opened in preview tab]
[2:10:36][@bigfellahull][Not related to lighting but I've been catching up with the multithreaded sim regions tonight and noticed that we never unset the entity active flag if an entity is not contained in the updatable bounds]
[2:11:58][handmade_sim_region.cpp: Enable BeginWorldChange() to clear the EntityFlag->Active]
[2:13:27][handmade_world_mode.cpp: Let PlayWorld() call AddMonstar() and run the game]
[2:13:58][handmade_world_mode.cpp: Let PlayWorld() put the snake in the world, and run the game to say hello to it]
[2:15:51][handmade_entity.h and *.cpp: Add a Light entity_visible_piece_flag and make UpdateAndRenderEntities() call PushLight()]
[2:18:32][handmade_world_mode.cpp: Introduce AddPieceLight()]
[2:20:47][handmade_world_mode.cpp: Make AddSnakeSegment() call AddPieceLight()]
[2:22:09][Run the game to see the lit up snake]
[2:24:16][Run the game and note that our lighting scheme does not incur a cost per light source]
[2:25:54][handmade_render_group.cpp: Enable LightingTest() to distribute light with no occlusion after some iterations, and run the game]
[2:28:43][@Brian][ctray license question. May I continuously update my GitHub branch of your timer (ctray) code from Handmade Hero, until you say otherwise, meaning you are preemptively giving unlicense / public domain to any further code in that folder? Would you prefer I ask every time for permission so you don't need to worry? I can do whichever is more convenient to you]
[2:29:14][Close it down][:speech]
[/video]
