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

98 lines
9.6 KiB
Plaintext
Raw Normal View History

[video output=day567 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Large to Small Voxel Transfer" vod_platform=youtube id=70JGOG1IT0Q annotator=Miblo]
2019-11-09 22:11:25 +00:00
[0:00][Recap and set the stage for the day][:speech]
[1:19][Some thoughts on experimental vs clean code][:speech]
[3:37][Describe our new light_voxel_cell :lighting scheme][:speech]
[6:14][Align our :lighting voxel grid to the world, augmenting game_mode_world with a FundamentalUnit, and making InitLighting() derive our VoxCellDim from that FundamentalUnit][:"data structure" :lighting]
[12:29][See a black screen][:lighting :run]
[12:38][Toggle off the :lighting in CompileZBiasProgram()]
[12:59][Our world generation remains good, but our AlphaMin needs adjusting][:camera :"procedural generation" :run]
[15:47][Reduce AlphaMin from 2.75 to 2.25 in PlayWorld()][:camera :programming :run]
[17:58][Reacquaint ourselves with the entity hopping code][:camera :"entity system" :movement]
[21:31][Augment the entity struct with a GroundP for UpdateAndRenderEntities() to record, to help stabilise the :camera in Z as the player hops around][:"data structure" :"entity system" :movement]
[24:33][See no change to our alpha fading][:camera :run]
[24:52][Make UpdateCameraForEntityMovement() use our new GroundP][:camera]
[25:25][Find that our alpha fading remains stable during hopping][:camera :run]
[26:57][Plan to stabilise our alpha / fog across traversables][:camera]
[29:29][Admire our floor heights][:run]
[30:09][Make BeginLightingComputation() compute and draw our LargeVoxelRect and HotVoxelRect][:lighting]
[43:18][Check out our :lighting voxels][:run]
[43:58][Halve the VoxCellDim in InitLighting()][:lighting]
[44:18][Check out our smaller :lighting voxels][:run]
[44:57][Make BeginLightingComputation() centre our :lighting voxels]
[45:41][See that our HotVoxelRect does not quite cover our whole view][:lighting :run]
[46:14][Double the VoxCellDim in InitLighting()][:lighting]
[46:33][See that our HotVoxelRect covers our whole view][:lighting :run]
[47:40][Enable the checkerboard :lighting]
[47:51][Consider our :lighting voxel to be too sparse][:run]
[48:09][Increase the resolution of our :lighting voxel]
[49:00][Consider our :lighting voxel resolution to suffice][:run]
[49:39][Make EndLightingComputation() draw our checkerboard more clearly][:lighting]
[50:20][Admire our clearer checkerboard, and still consider our :lighting voxel resolution to suffice][:run]
[51:47][Make EndLightingComputation() alternate our checkerboard colours in Z][:lighting]
[52:11][Find it tough to gauge the :lighting voxel resolution in Z][:run]
[52:55][Make EndLightingComputation() produce a full 3D checkerboard, disabling trilinear :filtering in OpenGLInit()][:lighting]
[57:35][See that our checkerboard encompasses our whole view and the :lighting voxel is locked to the world, and consider handling offset simulation centre][:run]
[59:45][Toggle on :lighting transfer in EndLightingComputation()]
[1:00:16][See black][:lighting :run]
[1:00:33][Establish "Hot" / "Large" voxel nomenclature in EndLightingComputation()][:lighting]
[1:03:03][Still see black][:lighting :run]
[1:03:11][Begin to make EndLightingComputation() handle LargetoHot voxel :lighting transfer]
[1:08:24][Find that the copying of our large voxel to the graphics card is working, but our falloff is too steep and the checkerboard alternates with black][:lighting :run]
[1:08:49][Investigate the checkerboard blackness in IrradiancePack() and CompileZBiasProgram()][:lighting :research]
[1:10:39][Make EndLightingComputation() alternate our checkerboard between (7, 7, 7) and (6, 6, 6)][:lighting]
[1:11:18][See the checkerboard exhibit misalignment of our voxels][:lighting :run]
[1:11:59][Fix our :lighting falloff in EndLightingComputation()]
[1:14:23][See our spotlight][:lighting :run]
[1:14:33][Enable trilinear :filtering in OpenGLInit()][:lighting]
[1:15:16][Admire our smooth :lighting falloff][:run]
[1:15:46][Make EndLightingComputation() cast a ray from the voxel centre to the light][:lighting]
[1:24:31][Consider our ray caster to be doing something around the edges][:lighting :run]
[1:25:13][Reacquaint ourselves with RayCast()][:lighting :research]
[1:29:43][Leave the ray cast LightDF along and fix the falloff in EndLightingComputation()][:lighting]
[1:30:30][Our smooth spotlight is back][:lighting :run]
[1:30:43][Set the ray cast LightDF to 0][:lighting]
[1:30:49][Consider our ray casting code to never hit anything][:lighting :run]
[1:31:40][Make EndLightingComputation() call BuildSpatialPartitionForLighting()][:lighting]
[1:32:38][Admire the freaky answers from our ray casting][:lighting :run]
[1:33:39][Augment raycast_result with tRay for callers of RayCast(), such as EndLightingComputation(), to use][:"data structure" :lighting]
[1:39:38][Consider our RayCast() to be buggy][:lighting :run]
[1:40:32][Debug our RayCast(), making EndLightingComputation() draw our rays][:"debug visualisation" :lighting]
[1:41:51][See no rays][:"debug visualisation" :lighting :run]
[1:42:04][Move the :"debug visualisation" drawing code to the end of EndLightingComputation()][:lighting]
[1:42:20][Still see no rays, noting that it almost works][:"debug visualisation" :lighting :run]
[1:43:12][Enable UpdateDebugLines in InitLighting()][:"debug system" :lighting]
[1:44:48][Hit our assertion in PushDebugLine()][:"debug system" :lighting :run]
[1:45:27][Restrict our ray cast drawing in EndLightingComputation()][:"debug visualisation" :lighting]
[1:48:19][See our rays][:"debug visualisation" :lighting :run]
[1:48:54][Make EndLightingComputation() only draw rays that hit something][:"debug visualisation" :lighting]
[1:49:30][See our rays which hit something][:"debug visualisation" :lighting :run]
[1:50:31][Make EndLightingComputation() draw the rays from the light source][:"debug visualisation" :lighting]
[1:50:51][See our rays emanating from the light source][:"debug visualisation" :lighting :run]
[1:51:20][Disable the ray drawing in EndLightingComputation()][:"debug visualisation" :lighting]
[1:52:36][Q&A][:speech]
[1:53:10][@sagian2005][Q: Shouldn't WorldChunkDimInMeters use FundamentalUnit?]
[1:53:26][Make PlayWorld() derive the WorldChunkDimInMeters from the FundamentalUnit]
[1:53:41][@steamymcfly][Q: How about increasing the voxel density and see if that reduces the acne?][:lighting]
[1:54:20][@internationalizationist][Q: I am your big fan, and have always been delighted with your… grouchy, in a good (very good) sense. I believe that this is a very useful quality that allows you to look at things and the world with a sober look. Just… I still cant understand how to develop this quality in myself. Can you advise something? A book? Production OOP programming? Work as Web developer? If you do not mind the time, please give a detailed answer. Thank you!][:psychology]
[2:13:24][@caseyismyhero1337][Q: Yo [@cmuratori Casey], my man, since you're doing everything in C, did you make your website[ref
site="Handmade Hero"
url=https://handmadehero.org/] also in C? And if so, is it possible to build an entire website from scratch in plain C using no libraries too?][:language :"web development"]
[2:15:58][@khrob][Q: Do you ever try and measure how much of your current outlook is affected by rose tinted memories? There were great things about using computers in 1992, but I remember having to constantly do things like mess with himem.sys to try and get the most basic of things working… (Not arguing that the current state of things isn't woeful)]
[2:20:29][@goban][@handmade_hero, I feel like this was a pretty recent shift in the zeitgeist too, I remember just 5, 10 years ago everyone was much more excited about tech]
[2:21:00][@steamymcfly][Q: Which Windows is the best version?][:"operating system"]
[2:21:14][@internationalizationist][Q: (About grouch) But when you do something, you do it qualitatively, because you know what quality is. It's cool from a programmer's point of view, that's all I want to say][:psychology]
[2:23:10][@Brian][Q: The state of programming is pretty sad. I was doing some investigating the other day and needed to use Process Monitor to spy on devenv. Randomly looking around, I noticed a big number of events sequentially all calling ReadFile and noticed devenv, it loading a 180k byte config file in 42 calls, each reading about 4k chunks from this file, setting the offset each time]
[2:28:03][@k2t0f12d][Q: What is one thing in programming or tech that can excite you and you think is an improvement (if any)?[ref
site="RAD Game Tools"
page="Oodle Network and Data Compression"
url=http://www.radgametools.com/oodle.htm]]
[2:33:55][@internationalizationist][Q: (Again off-topic) I think I upset you with that question, sorry]
[2:34:12][@oliverthebestcat][Q: (Off-topic) Do you have any advice for applying for AAA engineering jobs? I've worked on a few indie titles, porting them to consoles (mostly Unity games). I think a lack of C++ work experience is hurting me, but it's hard to get that work experience without previous C++ experience. Any advice?]
[2:35:55][@bulmanator][Q: Do you do anything specific to motivate yourself in the world of awful software?][:psychology]
[2:43:51][@charsd_][@handmade_hero Are you describing technocracy?]
[2:46:10][@charsd_][@handmade_hero One way to force that idea of excellence is through some form of authoritarianism, but many wouldn't like that]
[2:47:47][@longboolean][Q: What are you talking about [@cmuratori Casey], everything we do at our organization is excellent by our definition. No problems here. None at all. And if there are it's not my fault]
[2:53:52][@stewiez1][Arguing about capitalism vs socialism is going backwards]
[2:55:07][It has been a pleasure][:speech]
[/video]