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

53 lines
5.6 KiB
Plaintext
Raw Permalink Normal View History

[video output=day423 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Modifying Lighting to Use a Spatial Hierarchy" vod_platform=youtube id=XFR9WRnPgx4 annotator=Miblo]
[0:07][Recap and set the stage for the day, optimising the :lighting][:optimisation :rendering :speech]
[2:37][Consider the intractability of O(n²) algorithms][:speech]
[7:10][Consider the kinds of numbers at play in our :lighting system, and possible ways to optimise it as it is][:blackboard :optimisation :rendering]
[10:50][Standard raycasting acceleration structure, bucketing up :lighting elements][:blackboard :geometry :optimisation :rendering]
[14:38][Ordered traversal of this acceleration structure][:blackboard :geometry :lighting :optimisation :rendering]
[17:29][k-d tree][:blackboard :geometry :lighting :optimisation :rendering]
[20:42][Multiresolution tree, aggregating :lighting elements to produce a plausible, approximate solution][:blackboard :geometry :optimisation :rendering]
[25:30][Consider unifying the spatial partitioning for use by all systems][:geometry :speech]
[30:01][Create handmade_lighting.h and handmade_lighting.cpp][:lighting :rendering]
[33:39][A few words on separating code into files][:speech]
[35:24][Continue to populate handmade_lighting.h and #include our new files][:lighting :rendering]
[38:11][:Run the game to see our :lighting solution running not multiresolution, and consider how to split it into pieces][:optimisation :rendering]
[44:31][Augment lighting_box and lighting_solution to support child nodes, and propagate this to LightingTest() and RayCast()][:geometry :lighting :optimisation :rendering]
[56:27][:Run the game and consult the :lighting solution data in the profiler][:performance :rendering]
[58:57][Begin to enable RayCast() to operate on a spatial partition][:geometry :lighting :optimisation :rendering]
[1:04:00][Simplify raycast_result and reorganise RayCast() to handle this][:lighting :rendering]
[1:08:38][:Run the game to see that that didn't much affect our speed][:lighting :rendering]
[1:08:57][Introduce a new RayCast(), rename the existing one to RayCastRecurse() and continue to enable it to operate on a spatial partition, calling itself recursively][:geometry :lighting :optimisation :rendering]
[1:14:10][A few words on ray intersection of a convex vs concave solid][:geometry :speech]
[1:14:50][Finish implementing RayCastRecurse()][:geometry :lighting :optimisation :rendering]
[1:16:22][Introduce BuildSpatialPartitionForLighting()][:geometry :lighting :optimisation :rendering]
[1:22:30][:Run the game to see that we're doing okay][:geometry :lighting :optimisation :rendering]
[1:23:05][Checking against the backface, to handle the case when a ray originates inside a cube][:blackboard :geometry]
[1:25:48][:Run the game to confirm that it seems to be working okay][:geometry :lighting :optimisation :rendering]
[1:26:52][@insobot][86 minutes into the main stream. 34 until Q&A. (based on NOTE)]
[1:27:08][Consider how to build a basic spatial partition][:geometry :lighting :optimisation :rendering :speech]
[1:29:33][:Run the game to see that ComputeLightPropagation takes 148,634,510 cycles][:performance]
[1:30:04][Add BoxTable indirection to lighting_solution, and introduce GetBox()][:geometry :lighting :optimisation :rendering]
[1:32:43][Enable BuildSpatialPartitionForLighting() to loop over our BoxTable][:geometry :lighting :optimisation :rendering]
[1:33:43][:Run the game to see black][:geometry :lighting :optimisation :rendering]
[1:33:54][Fix BuildSpatialPartitionForLighting() to loop over the BoxTable after BoxCount has been incremented][:geometry :lighting :optimisation :rendering]
[1:34:21][:Run the game to see that that's fine and did not appreciably affect our :performance][:geometry :lighting :optimisation :rendering]
[1:34:44][Note that our indirection table allows a single child node to be placed in multiple places][:geometry :speech]
[1:35:39][Introduce AddOverlappingBoxes() and SplitBox()][:geometry :lighting :optimisation :rendering]
[1:43:14][:Run the game and note that we are testing against a spatial hierarchy][:geometry :lighting :optimisation :rendering]
[1:43:43][Make PlayWorld() generate 32 screens][:"procedural generation"]
[1:44:13][:Run the game to see our slowdown][:geometry :lighting :optimisation :rendering]
[1:50:06][Q&A][:speech]
[1:50:43][@praet_a51][Q: Can you try :lighting as it is in a release build?][:rendering]
[1:50:56][Try to build in release mode]
[1:51:17][:Run the game to see that the O(n²) is too slow]
[1:51:39][Make PlayWorld() produce fewer rooms][:"procedural generation"]
[1:51:51][:Run the game to see the fine framerate]
[1:52:44][@Miblo][Q: You mentioned something about the need to handle concave and convex solids differently when raycasting, due to (I believe) the possibility of entering and leaving a single face of a concave solid multiple times. Any chance you could explain a little more how this could affect us if we had concave solids?][:geometry]
[1:53:01][Optimally raycasting a split convex solid, based on its front face][:blackboard :geometry :optimisation]
[1:57:58][Raycasting a split concave solid][:blackboard :geometry :optimisation]
[2:02:35][Raycasting against back faces of concave solids may work the same][:blackboard :geometry :optimisation]
2018-02-23 00:48:00 +00:00
[2:06:16][@enyo_enev][Q: Why did we skip the part with placing cubes over entities such as trees and the hero? And also they should receive light in some way, right?][:lighting :rendering]
[2:06:43][@zennmystic][Q: We just noticed your ~4coder and ~Milton are colour coordinated. What are the values?][:trivia]
[2:07:45][That's it for today][:speech]
[/video]