August 2020 Newsletter
Built the first version of Excal, my Vulkan rendering engine. Also ported my Perlin noise terrain generator from OpenGL to Excal.
Received a Vulkan t-shirt from Khronos, the parent company of Vulkan.
Wrote notes on the how the graphics pipeline, GPU, and CPU Cache work while reading through Real-time Rendering.
Wrote summaries of my favorite Slate Star Codex posts.
Slate Star Codex
Controversial stories will spread more.
Publicizing how strongly you believe an accusation that is obviously true signals nothing. Only controversial things get spread. A rape allegation will only be spread if it’s dubious enough to split people in half along lines corresponding to identity politics. This is why so much coverage [on rape allegations] focuses on the proposal that all accused rapists should be treated as guilty until proven innocent.
A lack of competition allows investments with long-term payoffs to succeed.
The Old World contains Rome and China. The New World contains Aztecs. Rome and China are very close to each other. Now what happens [if this was a game of Civilization V]?
Rome and China spend the Stone, Bronze, and Iron Ages hacking each other to bits. Aztecs spend those Ages building cities, researching technologies, and building unique Wonders of the World that provide powerful bonuses. In 1492, they discover Galleons and start crossing the ocean. The powerful and advanced Aztec empire crushes the exhausted axe-wielding Romans and Chinese.
This is another story about slack. The Aztecs had it – they were under no competitive pressure to do things that paid off next turn. The Romans and Chinese didn’t – they had to be at the top of their game every single turn, or their neighbor would conquer them. If there was an option that made you 10% weaker next turn in exchange for making you 100% stronger ten turns down the line, the Aztecs could take it without a second thought; the Romans and Chinese would probably have to pass.
People care too much if something is a “real disease” (e.g. obesity)
Our attitudes toward people with marginal conditions mainly reflect a deontologist libertarian (libertarian as in “free will”, not as in “against government”) model of blame. In this concept, people make decisions using their free will, a spiritual entity operating free from biology or circumstance. People who make good decisions are intrinsically good people and deserve good treatment; people who make bad decisions are intrinsically bad people and deserve bad treatment.
But people who make bad decisions for reasons that are outside of their free will may not be intrinsically bad people, and may therefore be absolved from deserving bad treatment. For example, if a normally peaceful person has a brain tumor that affects areas involved in fear and aggression, they go on a crazy killing spree, and then they have their brain tumor removed and become a peaceful person again, many people would be willing to accept that the killing spree does not reflect negatively on them or open them up to deserving bad treatment, since it had biological and not spiritual causes.
Under this model, deciding whether a condition is biological or spiritual becomes very important, and the rationale for worrying over whether something “is a real disease” or not is plain to see. Without figuring out this extremely difficult question, we are at risk of either blaming people for things they don’t deserve, or else letting them off the hook when they commit a sin, both of which, to libertarian deontologists, would be terrible things. But determining whether marginal conditions like depression have a spiritual or biological cause is difficult, and no one knows how to do it reliably.
Unreal Engine 5 Revealed
10m video. A gorgeous real-time demo of Unreal Engine 5 (first revealed in May 2020), its new rendering engine (Nanite), global illumination (Lumen), and particle system (Niagra).
Inside Unreal Engine 5
High level overview of how UE5’s Nanite (rendering engine) and Lumen (global illumination) work.
How I think Nanite Renders a Demo with 10^11 Triangles
Speculation on how virtual geometry images could be how UE5’s new rendering engine “Nanite” achieves micropolygon rendering. TL;DR The positions of vertices can be stored in a texture image. This allows for techniques like image compression, mipmapping, and easier operations on local patches of geometry (e.g. view-dependent downsampling). NOTE: This is not the technique used, but it’s still a good read.
A Brief Primer on Efficient Rendering Algorithms and Clustered Shading
Great explanations of how forward and deferred shading works, their limitations, and the advantages of clustered shading (and how to implement it).
When building my Vulkan rendering engine, the most important architectural choice I made was to get rid of classes in the core of my engine and instead have “context-free” functions that only modify non-const arguments. This isn’t quite functional programming, but it was inspired by John Carmack’s post on the topic.
A large fraction of the flaws in software development are due to programmers not fully understanding all the possible states their code may execute in… Programming in a functional style makes the state presented to your code explicit, which makes it much easier to reason about.
What’s Functional Programming All About
Clear explanation of what functional programming is, why it’s useful, and memorable mental models.
CPU Cache (Wikipedia)
Explanations of CPU cache concepts including associativity, cache misses, address translation, and multi-level caches.
Structured Computer Organization - Section 4.5 “Improving Performance”
Explanations of CPU cache memory, branch prediction, out-of-order execution, and speculative execution.
Understanding the PS5’s SSD
The PS5’s SSD and RAM is so fast, it’s like you have 825GB of RAM and 16GB of CPU cache. Its SSD has memory bandwidth of 5.5 GB/s, and its 16GB of RAM is 448 GB/s. This results in the PS5’s RAM only holding assets and data for the next 1 second of gameplay, while the PS4’s 8GB RAM held assets for the next 30 seconds of gameplay.
How to Write a Git Commit Message
Advice on how to write useful commit messages, such as 50 character subject line, hard wrapping paragraphs on 72 characters, and using the imperative in subject lines (i.e. "This commit will…).