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

87 lines
7.5 KiB
Plaintext
Raw Permalink Normal View History

[video output=day411 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Switching to Rectangular Lighting Elements" vod_platform=youtube id=opL_VChuNOw annotator=Miblo]
[0:09][Recap and set the stage for the day[ref
site="Wikipedia"
page="Cornell box"
url="https://en.wikipedia.org/wiki/Cornell_box"]]
[6:40][Run the game to see our current lighting solution]
[9:03][handmade_world_mode.cpp: Let UpdateAndRenderWorld() call OutputLighting()]
[9:27][Run the game to see our lighting voxel grid visualisation]
[10:27][handmade_render_group.cpp: Make OutputLighting() draw the reflectors]
[10:34][Run the game to see our reflectors debug visualisation]
[12:32][handmade_render_group.cpp: Prevent OutputLighting() from drawing any debug visualisations]
[12:54][Run the game and consider that the final gather may be producing the bleed-through lighting]
[17:51][Run the game, noting that we had decided not to have 2-sided geometry any more]
[18:33][handmade_world_mode.cpp: Make OutputLighting() draw the reflectors]
[18:45][Run the game to see the giant hole in the relectors, and consider how to deal with this]
[21:12][Run the game, toggle between the debug and regular views, and determine to switch to rectangular lighting elements]
[24:48][Blackboard: Intersection of a Ray with a Rectangle]
[29:32][Blackboard: Storing the rectangular lighting elements' X and Y axes to operate on them in their parametric space]
[31:39][Blackboard: Defining the axes in unit-length and using the inner product to determine if we are inside the rectangle]
[35:19][Blackboard: Simplifying our rectangle bounds equation]
[40:28][Remove ExtractReflectorsFromVerts(), and make LightingTest() call ExtractReflectorsFromQuads()]
[42:13][Run the game and determine to extract lighting from exact quads]
[42:47][handmade_world_mode.h: Change R to Width and Height, and add XAxis and YAxis to the lighting_element]
[46:20][Blackboard: Coordinate system winding]
[46:50][handmade_render_group.cpp: Make ExtractReflectorsFromQuads() set the rectangle dimensions and axes]
[50:50][handmade_render_group.cpp: Enable RayCast() to use our newly encoded rectangle data]
[59:01][handmade_render_group.cpp: Remove OutputLightingVerts() and enable OutputLightingQuads() to reconstruct the quads from our encoded data]
[1:01:11][Run the game to see our diamond lighting reflectors]
[1:01:26][handmade_render_group.cpp: Fix OutputLightingQuads() to produce a right-angle rectangle]
[1:02:03][Run the game to see our rectangular lighting reflectors, and consider how to shrink them]
[1:05:45][handmade_render_group.cpp: Make OutputLightingQuads() shrink the reflectors slightly]
[1:06:51][Run the game to see the gaps between reflectors]
[1:07:22][handmade_render_group.cpp: Start to make ExtractReflectorsFromQuads() dice up the reflectors]
[1:09:14][handmade_world_mode.h: Remove OrigBitmap and OrigV from lighting_element]
[1:10:42][Run the game to see that we're good to go]
[1:11:36][handmade_render_group.cpp: Continue to make ExtractReflectorsFromQuads() subdivide the reflectors]
[1:16:01][Run the game to see our smaller reflectors]
[1:16:15][handmade_render_group.cpp: Allow smaller subdivisions of the reflectors]
[1:17:30][Run the game to see our lighting solution, and consider that either the ray cast is incorrect or our indirect bounce may be too powerful]
[1:19:58][Q&A][:speech]
[1:20:51][@Kknewkles][Hi! No shave November? That stache's gun be epic]
[1:22:15][@toastystoemp][Forward rendering or deferred rendering]
[1:23:05][@nnreality][Would the subdivision of the rectangles be something that you would do in a tesselation shader if you were using OpenGL?]
[1:24:22][@butwhynot1][Are you going to be implementing shadowmaps?]
[1:25:06][@Kknewkles][1) Any more Handmade Ray episodes? 2) Remember when someone took your raytracer a few steps further on twitter: what do you do to move to this picture from the one you stopped at?[ref
site="Twitter"
page="@cmuratori Thanks Casey, this is so much fun to play with. The cosine attenuation doesn't seem too harsh if you adjust the lighting!"
url="https://twitter.com/thefoxz_/status/922834912943669248"]]
[1:25:39][@abdcw][Is your keyboard any good?]
[1:27:06][@vaualbus][So, as far as know, if I would want to implement a real time rendering system there should have been some differences? Or for now the light bounces can also be used in that situation?]
[1:27:50][@sneakybob_wot][Is there a specific reason to recalculate 1.0/255 rather than store it as a value or does the compiler optimise that anyway?]
[1:28:16][@bouke285][I'm a new CS student with limited free time. Do you recommend watching your series from the beginning, or would time be better spent working on a new project and using your videos to learn something as needed?]
[1:29:53][@jalapenosbud][I was wondering what sort of data strucures / algorithms you would recommend to learn to get a wider grasp on programming?]
[1:33:00][@vaualbus][In my previous question I was wrong: I wanted to ask if we want to have physically based rendering techniques]
[1:34:17][@toastystoemp][Which physics engine, if any, will you implement]
[1:34:29][@sired22][Are you planning to have any procedural generation in your levels later?]
[1:34:48][@alexkelbo][You once said that you wanted to use Vulkan on HMH. Is that still on the table or are you sticking with OpenGL?]
[1:34:59][@kknewkles][What are the things you've solved yourself?[ref
site="YouTube"
page="\"Papers I Have Loved\" by Casey Muratori"
url="https://www.youtube.com/watch?v=SDS5gLSiLg0"]]
[1:36:21][@kknewkles][I watched that live, how could you?]
[1:36:36][@jalapenosbud][Haha yeah, I didn't have anything specific in mind, just where to go after having learned the basics of coding, like the stuff you mentioned. But also where to start to slowly start understanding the more "complex" algorithms. Like there's probably a hundred ways to sort something, trees etc, but to get the basic understanding, where should I start?[ref
site="MIT Press"
page="Introduction to Algorithms, Third Edition"
url="https://mitpress.mit.edu/books/introduction-algorithms"]]
[1:38:49][@jalapenosbud][That's the one I'm reading right now!]
[1:39:29][@jalapenosbud][Yeah fine fine haha, I just wanted to know if there was a "shortcut"]
[1:40:06][@the_8th_mage][You once mentioned a numerical book[ref
site="Amazon"
page="Numerical Methods that Work"
url="https://www.amazon.com/dp/0883854503"]]
[1:41:45][@stanpancakes][Meh. Just read Knuth. Easy read]
[1:42:41][@stanpancakes][I was kidding]
[1:44:13][Recommend disabling internet access]
[1:46:21][@kknewkles][There's more people in my flat depending on that connection, but I could program a tiny thingie to cut my own connection]
[1:49:27][@serialqwiller][If you have enough space and budget, having a separate room / desk and machine for development that you never use for anything else works for me]
[1:50:38][@kknewkles][But how do you code without source control]
[1:51:13][@kknewkles][Not cmirror though?]
[1:52:04][@kknewkles][Yeah, I'm kidding. Just another bile round at them gits and cmakes]
[1:52:38][@thisdrunkdane][Gonna share cmirror 2 at some point?]
[1:53:21][@kknewkles][Handmade Source Control episodes?]
[1:53:52][@k1ng_k3v1n][So you never access MSDN, the OpenGL docs, or other documentation on your work machine?]
[1:54:57][@usdaproved][I would like to program without being connected to the internet, but how do you do it without stack overflow or other references? Does breaking that reliance just come from practice and experience?]
[1:58:05][Shut things down][:speech]
[/video]