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

75 lines
8.8 KiB
Plaintext

[video output=day437 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Switching to Precomputed Hemisphere Distributions" vod_platform=youtube id=ZS54TWa-ILA annotator=Miblo]
[0:06][@combicombi][Q: Casey, was just watching the previous stream about getting better noise sampling, and I was wondering why you need any randomness if you obtain a pretty evenly and well-covered sampling hemisphere?][:prng :statistics]
[0:49][Undersampling, and moving noise to the least objectionable place][:blackboard :prng :statistics]
[10:59][:Run the game to see how our :lighting is working at the moment][:rendering]
[14:20][Add SamplePoints to the lighting_solution and loft our hemisphere generation code out to GenerateSpiralSamples() and GeneratePoissonSamples()][:lighting :rendering :statistics]
[21:19][:Run the game to see our spiral sample][:lighting :rendering :statistics]
[21:33][Add keybindings for GeneratePoissonSamples() and GenerateSpiralSamples() in UpdateAndRenderWorld(), and reduce the MaxCos value in GeneratePoissonSamples()][:"input handling"]
[24:24][:Run the game and check out our two sampling patterns][:statistics]
[25:23][Make LightingTest() draw connections between clusters of sampling points][:"debug visualisation" :lighting :statistics :rendering]
[27:52][:Run the game to see our cluster of sampling points, and consider other sampling patterns[ref
author="À. Méndez-feliu and M. Sbert"
title="Comparing hemisphere sampling techniques for obscurance computation"
url=http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.468.4690][ref
author="Holger Dammertz"
title="Hammersley Points on the Hemisphere"
url=http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html][ref
author="Tien-Tsin Wong and Wai-Shing Luk and Pheng-Ann Heng"
title="Sampling with Hammersley and Halton Points"
url=http://www.cse.cuhk.edu.hk/~ttwong/papers/udpoint/udpoint.pdf][ref
site=Wikipedia
page="Halton sequence"
url=https://en.wikipedia.org/wiki/Halton_sequence]][:"debug visualisation" :lighting :statistics :rendering]
[36:41][:Run the game and consider gleaning more structure from the spiral sampling over time][:lighting :statistics :rendering]
[37:37][Make LightingTest() colour the sampling points over time][:"debug visualisation" :lighting :statistics :rendering]
[39:49][:Run the game to see our coloured sampling points][:"debug visualisation" :lighting :statistics :rendering]
[43:51][Vary the N2 value in GenerateSpiralSamples() to sample variable coverage of the sphere][:"debug visualisation" :lighting :statistics :rendering]
[45:42][:Run the game to see this variable coverage][:"debug visualisation" :lighting :statistics :rendering]
[46:15][Make GenerateSpiralSamples() offset the coverage rotationally (i.e. spin the spirals)][:"debug visualisation" :lighting :statistics :rendering]
[47:40][:Run the game to see this spin][:"debug visualisation" :lighting :statistics :rendering]
[47:49][Combine these coverage schemes in GenerateSpiralSamples()][:"debug visualisation" :lighting :statistics :rendering]
[48:00][:Run the game to see the variable coverage, and consider how to generate points in clusters][:"debug visualisation" :lighting :statistics :rendering]
[50:33][Introduce the notion of a ClusterTable in LightingTest() to generate clusters of points][:"debug visualisation" :lighting :statistics :rendering]
[55:37][Check out our first cluster][:"debug visualisation" :lighting :statistics :rendering :run]
[56:47][Start to build up our ClusterTable in LightingTest(), also visualising the clusters as lines relative to the entire set][:"debug visualisation" :lighting :statistics :rendering]
[59:39][:Run the game to see our clusters][:"debug visualisation" :lighting :statistics :rendering :run]
[1:00:18][Continue to build up our ClusterTable][:"debug visualisation" :lighting :statistics :rendering]
[1:01:10][Check out this new cluster and consider how best to tessellate our clusters][:"debug visualisation" :lighting :statistics :rendering :run]
[1:04:04][Introduce GeneratePolarSamples()][:lighting :rendering :statistics]
[1:07:47][Polar sampling, derived from the height up the sphere][:blackboard :statistics]
[1:09:29][Continue to implement GeneratePolarSamples(), adding a key to trigger this pattern][:"input handling" :lighting :rendering :statistics]
[1:11:50][Check out this polar pattern, and consider making the spoke count proportional to the slice][:"debug visualisation" :lighting :rendering :statistics :run]
[1:13:18][Introduce a SpokeTable in GeneratePolarSamples() to distribute the samples around the sphere][:lighting :rendering :statistics]
[1:18:29][Check out this polar pattern][:"debug visualisation" :lighting :rendering :statistics :run]
[1:18:41][Bias the z away from directly up and reduce the SliceCount in GeneratePolarSamples()][:lighting :rendering :statistics]
[1:21:03][Check out our awesome polar pattern, and consider how to line the samples up for casting purposes][:"debug visualisation" :lighting :rendering :statistics :run]
[1:23:09][Reduce the SliceCount to 5 and introduce vertical jitter in GeneratePolarSamples()][:lighting :rendering :statistics]
[1:26:13][Check out the polar jitter, and consider how to cluster our sampling points in terms of the jitter][:"debug visualisation" :lighting :rendering :statistics :run]
[1:31:59][Store SamplePoints as a matrix of v3_4x in lighting_solution, and enable InitLighting() to cluster up the samples][:lighting :rendering :statistics]
[1:41:06][Check out our slightly broken :lighting][:rendering :run]
[1:41:22][Enable ComputeLightPropagation() to reorient the SampleD4x along the sample point normal][:lighting :rendering :statistics]
[1:43:50][Check out this potentially more correct :lighting][:rendering :run]
[1:46:06][Q&A][:speech]
[1:47:04][@ssylvan][@handmade_hero By the way, I mentioned this on twitter but the easiest way to compute a cosine distribution is to start with a 2D disk distribution for x / y then compute z by projecting to sphere (z = sqrt(1 - x^2 - y^2))][:statistics]
[1:48:12][@thejimjames40][Q: Do you have some resources for researching different game / system architectures in C? I'd like to focus on the data layout[ref
author="Jason Gregory"
title="Game Engine Architecture"
url=http://gameenginebook.com/]]
[1:51:33][@blackburn1911][Q: What should I / we do everyday to become a good programmer like you, [@jon Jon Blow], etc?]
[1:53:42][@elfeck][Q: Do you use templates in the code right now?]
[1:53:58][@bas170400][Q: Hi, I am programming my first game (2D) as an intake assignment from my next education. The game uses an EntityComponentSystem. But now I'm stuck because I want different entities to have different animations for different situations but I don't know how to implement that. So my question is how do I go about that without writing different sprite components for every different entity type? All sorts of information is welcome][:"entity system"]
[2:00:16][@vkar2][Q: I played with the spiral, and had problems with the angular falloff][:statistics]
[2:00:43][@30ygamer][Q: First timer here. From what I saw it looks like organizational-wise a lot of things are bundled together in your code. How do you handle organizing a lot of code in general? Is it a C / C++ thing to have so many things together? I'm just kinda used to having small pieces of code]
[2:02:38][@gorevojd][Q: [@cmuratori Casey], I just want to say you thank you for everything. I started to watch you in 2014, when I graduated from university. You taught me more than all of my teachers there. I love game development and I love programming all because of you. Just thank you]
[2:03:09][@esert][Q: Did you find an answer to your questions in 'Are Register Names Still Useful?'?[ref
site="Casey Muratori's home page"
page="Are Register Names Still Useful?"
url=https://caseymuratori.com/blog_0028]]
[2:05:39][@phort99][Q: You mentioned not using templates. Do you use any code generation / :metaprogramming at all?]
[2:06:09][@thejimjames40][Q: Every time I am designing the data layout of a game / system I get very happy inside. Is this normal? Or should I see a psychiatrist? Also I absolutely love the sections about the :"entity system" and :"game design" decisions]
[2:06:30][@sneakybob_wot][Q: How much more optimized do you think you'll be able to get this :lighting code once you've sorted out this bundling?][:optimisation :rendering]
[2:06:47][@bozemoto][Q: I'm a programmer with three years' experience, what would you recommend for someone with my experience level to do to improve as a developer. I've been trying to learn new things outside of work, while avoiding breaking the non-compete part of my contract]
[2:07:42][@pythno][Q: Do you still use your Amiga?]
[2:08:23][Close things down][:speech]
[/video]