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

68 lines
7.6 KiB
Plaintext
Raw Normal View History

2018-05-27 16:05:07 +00:00
[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Updating Unproject" vod_platform=youtube id=WtGg7r9ufek annotator=Miblo]
[0:00][Recap and set the stage for the day][:speech]
[1:03][A few words on :art, originally produced remotely by Yangtian Li, and then produced in-house by Anna Rettberg][:speech]
[4:35][:Run the game to see what on-demand, in-house :art production would entail]
[7:07][Determine to focus on the :camera for starters, then the :lighting bounds][:rendering :run]
[9:34][Consider the current LightBounds code][:lighting :rendering :research]
[10:29][Increase the LightBounds, running the game to illustrate the need to move to a camera-centric :lighting bounds][:camera :programming :rendering :run]
[12:04][Make UpdateAndRenderWorld() draw the LightBounds][:"debug visualisation" :lighting :rendering]
[15:00][:Run the game to see the light bounds][:"debug visualisation" :lighting :rendering]
[15:18][Make UpdateAndRenderWorld() draw the WorldCameraRect][:camera :"debug visualisation"]
[16:44][:Run the game to see that WorldCameraRect, and determine to fix its computation to encompass the screen][:camera :"debug visualisation"]
[17:44][Determine to validate Unproject() for GetCameraRectangleAtDistance() to produce a correct WorldCameraRect][:camera :research]
[20:13][Make GetCameraRectangleAtTarget() take a Z, and try dynamically changing the TargetOffsetZ in UpdateCameraForEntityMovement()][:camera]
[25:39][:Run the game to see that :camera move]
[25:49][Make UpdateAndRenderWorld() pass Camera.OffsetZ to GetCameraRectangleAtTarget()][:camera]
[26:49][:Run the game and determine to fix WorldCameraRect to encompass the screen][:camera :"debug visualisation"]
[27:04][Work towards making the WorldCameraRect encompass the screen, considering how Unproject() works][:camera :"debug visualisation" :research]
[34:06][Step in to GetCameraRectangleAtTarget() to see our :camera projection][:run]
[39:37][Closely consider Unproject()][:camera :research]
[46:50][Step in to Unproject() to see that the Proj combines the world :camera transform and the projection matrix][:run]
[48:53][Continue to nail down our understanding of Unproject()][:camera :research]
[50:05][Step in to Unproject() and consider that its ClipZ computation may be erroneous, thus throwing off the Clip][:camera :run]
[55:27][Fix the computation of ClipZ and ClipSpaceXY in Unproject()][:camera]
[56:39][:Run the game and fail to see our WorldCameraRect :"debug visualisation", but that the ScreenBounds is now correct][:camera]
[1:00:06][Step in to GetCameraRectangleAtDistance() to investigate the camera's dramatic Z offset][:camera :run]
[1:02:40][Let Unproject() divide the ProbeZ.w in to ClipZ again][:camera]
[1:03:38][:Run the game to see that the WorldCameraRect now matches the ScreenBounds][:camera :"debug visualisation"]
[1:04:04][Read PerspectiveProjection() to confirm that the Z was multiplied in to the W][:camera :research]
[1:06:41][:Run the game to see the WorldCameraRect move with the hero, and determine to make it slide with the :camera][:"debug visualisation"]
[1:07:23][Consider how UpdateAndRenderWorld() is using the :camera transform, with a view to making the WorldCameraRect slide rather than jump][:research]
[1:13:38][Step in to UpdateAndRenderWorld() to see exactly how the :"debug visualisation" is being drawn][:run]
[1:16:01][Hit a crash in DEBUGEnd()][:"debug system" :run]
[1:16:22][Make DEBUGEnd() use SafeRatio0() in the AvgKilocycles computation][:"debug system"]
[1:17:12][Note that the WorldCameraRect is sliding subtly, but not actually with the :camera][:"debug visualisation" :run]
[1:18:47][Continue to investigate why the WorldCameraRect seems to be tied to the sim center, and not sliding with the :camera][:"debug visualisation" :research]
[1:27:01][Consider that our :camera's identity matrix may not have its offset set correctly][:research]
[1:28:29][Step in to SetCameraTransform() to see that the :camera's identity matrix actually does look good][:camera :run]
[1:30:54][Break on SetCameraTransform() when moving between rooms to see that the :camera's identity matrix remains looking good][:camera :run]
[1:32:01][Break on SetCameraTransform() during a big :camera move to see that the DeltaFromSim displacement is initially lower that expected][:run]
[1:36:25][Display the DeltaFromSim][:profiling]
[1:36:57][:Run the game and watch that DeltaFromSim value to see that it looks fine]
[1:38:02][Consider if Unproject() is not correctly applying the :camera displacement][:research]
[1:40:06][Realise that Transform() is multiplying the w in to the displacement, and make Unproject() use the ProbeZ.w in the Clip computation][:camera]
[1:42:04][:Run the game to see that we're not quite out of the woods yet][:camera]
[1:42:21][Make Unproject() use ProbeZ.z directly (not divided by ProbeZ.w) in the Clip computation][:camera]
[1:43:27][:Run the game to see the WorldCameraRect properly slides with the :camera]
[1:44:04][Make UpdateAndRenderWorld() set the LightBounds from our WorldCameraRect, adjusted by the SimBounds Z][:camera :lighting :rendering]
[1:44:21][:Run the game to see that our :lighting is never wrong][:rendering]
[1:45:01][Q&A][:speech]
[1:46:00][@jim0_o][Q: How would you obfuscate what's outside of the view of the character?][:rendering]
[1:48:26][@vateferfout][Q: Do you plan to close the orphanage's rooms or do you want them to have the skylight as some sort of ambient light?]
[1:48:47][@sgtrumbi][Q: Does the UpdateAndRender() function do any rendering right now? Or was it offloaded to some other place?][:rendering]
[1:49:22][@jim0_o][Q: Would you for example cast rays to see if something is visible to the character (e.g. if something is on the screen but the character should be blind to it)?][:rendering]
[1:50:59][@jessef][Q: Would [~hero Handmade Hero]'s chunk->offset world work in 3D? Would there be any problems there that I'm not seeing?][:simulation]
[1:51:20][@sgtrumbi][Q: Is there already new artwork to be put in the game in the next couple of episodes?][:art]
[1:51:57][Consider the problem of dealing with perspective in the :art][:run]
[1:53:39][@uhee][Q: Is it currently possible to easily customize rooms, e.g. with non-random tile-z, etc?]
[1:54:05][@jessef][Q: Sorry, I mean, say we wanted to make a universe-scale game, i.e. space sim. Would that scale well?][:simulation]
[2:01:06][@Miblo][Q: Would these massive distances even be needed if you don't need to be accurate to, say, the nearest centimetre? Or do you always need to be that accurate?][:simulation]
[2:05:25][@danzaidan][Q: Would separating chunks into chunks in this case be overkill?][:simulation]
[2:07:11][@LongBoolean][Q: In this hypothetical situation, I suppose you could also change the physics / realism of the universe so that planets and galaxies are closer than they would normally be so flying to them is more feasible][:simulation]
[2:08:41][@danzaidan][Q: Do you have to always take float precision into account or is it more like an "it will come up" type of thing (like the rock that didn't move on The Witness editor)?]
[2:09:11][@stefdevs][Q: Does the rather nice state of the anti-aliasing in [~hero Handmade Hero] have to do with the use of depth peeling or is it just standard MSAA?][:rendering]
[2:09:44][@mr_jake_from_statefarm][Q: How do you tackle this issue in a large open world then? Do you use some sort of grid system?][:simulation]
[2:12:12][@stefdevs][Q: Follow-up: What benefit does depth peeling bring to the anti-aliasing table? (Not that you're doing depth peeling for that purpose, obviously)][:rendering]
[2:13:46][Close it up, with a glimpse into the future of working on the :camera motion and introducing the new :art][:speech]
[/video]