
Click here to go see the bonus panel!
Hovertext:
And when Babbage arrived the whole thing was actually running on a series of Pascalines.
Today's News:

Hovertext:
And when Babbage arrived the whole thing was actually running on a series of Pascalines.
Around The World will be played from a third-person chase camera, so most of the time, about half the screen will be filled with sky. How do we make that sky look good?
You may already seen some pretty skies in previous screenshots, but I wasn’t completely satisfied and decided to start over. I’ll do this in three phases:
This post is about the first step, clear skies. That may sound dull, but in fact even a clear sky has a surprising amount of colour variation, especially when the sun is low. I want those pretty sunsets!
Now if you’re into computer graphics at all, you may be aware that rendering realistic skies efficiently is a solved problem. So I won’t be creating anything ground-breaking today. I am however going to implement this from scratch, because it helps me understand the implementation and tweak it to my needs.
Also, it’s fun, dammit. I can barely go outside anymore without gazing at the sky, and wondering how I’m going to implement it. Especially clouds. Clouds! But I’m getting ahead of myself.
First off, the game will have dynamic weather and a day-night cycle, so anything like a static sky box is out of the question. It needs to update in real time.
Godot offers two built-in options for this: a fast one named ProceduralSkyMaterial and a slightly slower one named PhysicalSkyMaterial.
This is what ProceduralSkyMaterial looks like:
That’s quite bland when the sun is high (here, 45°), and it doesn’t get better at sunset:
This implementation is just too simple; it’s basically a gradient towards the horizon, and a radial gradient around the sun. That’s not going to cut it.
How about its big brother, PhysicalSkyMaterial? It’s based on an analytical model of Earth’s atmosphere by Preetham et al. (1999), which means it’s somewhat realistic but above all still very efficient. Here’s what it looks like:
And at dusk:
It’s better, but still not great. Tweaking the parameters (especially boosting the brightness) got me some slight improvements, but it still felt underwhelming.
My game’s art style uses low-poly models and coarse, pixelated textures; is not based on maximum realism. So we don’t necessarily need a very realistic sky. Artistic control is arguably more important. It needs to be pretty.
So I set out to do something like Godot’s ProceduralSkyMaterial: just slap some gradients and equations together until it looks good. I called this approach “QuickSky” and here’s how far I got with it:
I don’t think this is bad at all for how simple it is:
It’s yet another step forward, but I felt it had reached its limits. To make it look better (in all directions, under all conditions) I would need to add more tweaks, more parameters, all under artistic control. But in this case, I found that nature itself is the best artist: it does make pretty sunsets! So I would prefer to just do what it does. More realism after all!
The sky gets most of its colour from an effect called Rayleigh scattering. When sunlight travels through the atmosphere, it sometimes hits an air molecule and gets bounced (“scattered”) in a different direction. Shorter wavelengths get scattered more often than longer wavelengths, so blue light bounces around a lot more, whereas red more often travels straight on. This is why the sky is blue.
This is often implemented in shaders on the GPU by marching along the view ray and computing what happens at each point along the ray:
So that’s what I implemented: break up the view ray into a number of same-sized intervals, and compute how much direct sunlight would be scattered into the view ray along that segment. This is only “single scattering”: we assume that each photon is scattered no more than once until it hits something.
Even with such a simple approach, we already get a blue sky:
It’s very bright because I have set the sunlight strength to 20.0, where 1.0 is full white. This is needed to get a good balance in brightness between the sun and the rest of the sky, otherwise the sky will be way too dark later.
Obviously, the real sky doesn’t look like this; there are some effects that I haven’t taken into account yet. First, before the sunlight reaches the view ray, it has already travelled through a part of the atmosphere, and so some of it will have scattered out in other directions. We can simulate that by marching another ray from each point along the view ray in the direction of the sun, tallying up how much atmosphere is encountered along the way, and applying attenuation accordingly.
This has a darkening effect, but mostly on the ground which is no longer lit from below:
A similar thing happens to light after it has been scattered into the view ray, while it travels along the view ray to the camera. Technically, this light has already been scattered once, and so we shouldn’t scatter it again, so I guess my implementation may not be energy-preserving, or something? But you can’t argue with results:
This approach is already enough to get reasonable sunsets:
All these ray marches take into account that the world and the atmosphere are round, so you automatically get the effect of a “planet shadow” where the sky is still dark opposite the sunrise.
But wait, there’s more!
Besides molecules, the atmosphere also contains larger particles called aerosols, and these also cause scattering. This is called Mie scattering and it differs from Rayleigh scattering in some key ways:
It’s strongly directional, meaning that a scattered ray is much more likely to be scattered in a forwards direction than backwards. The physical processes are complex, but thankfully they can be approximated well by simple formulas like the Cornette-Shanks phase function.
It happens mostly in the lower part of the atmosphere, and barely above 5 km or so.
It doesn’t depend on wavelength, scattering all colours in the same way.
It also performs some absorption, meaning light just disappears.
The strong directionality of Mie scattering is what causes a bright halo around the sun; this is sunlight being scattered almost straight ahead. Its presence in the lower atmosphere is responsible for the colour of the horizon, which was still quite blown out when using just Rayleigh scattering.
Here’s the result of adding Mie scattering and absorption in all places where Rayleigh scattering is also being applied:
And the obligatory sunset:
Very nice! You can clearly see how Mie scattering causes the area around the sun to be bright, while Rayleigh outscattering colours it orange. Some of the colours are a bit oversaturated, but I think this can be fixed later with tone mapping (which is not enabled on these screenshots right now).
In this classic paper by Nishita, Dobashi et al (1996), I found this interesting tidbit:
For visible wavelengths, absorption in the ozone layer is negligible compared to absorption by air molecules and aerosols.
However, ozone does strongly affect the sky colour during twilight, as pointed out by Peter Kutz and cited by a more modern classic, Hillaire (2020). So let’s follow Hillaire’s following of Bruneton and add absorption in the ozone layer:
Compared to the version without ozone, this gives the twilight sky a much more natural purple hue, rather than greenish. This makes sense given Hillaire’s coefficients: green is absorbed most strongly.
I suggested previously that Rayleigh scattering (unlike Mie scattering) happens equally in all directions, but it turns out that’s only mostly true. Rather, it has a slight preference for the forwards and backwards directions. Let’s implement that. The effect is too subtle to show in screenshots, but it does help break up the uniform horizon a bit.
Also, I darkened the sun disk a bit around the edges, an effect called limb darkening. Without tone mapping, the effect is only visible just before the sun disappears, and even then it’s pretty subtle — the reddening at the bottom is due to atmospheric scattering:
So far, I’ve been showing static pictures, but how does this rendering technique fare in a real-time game? Actually, not bad at all! Remember that we’re doing a march along the view ray, and for each step in this march, we spawn a secondary ray march towards the sun. Even when setting the former to 64 steps and the latter to 8, causing 64 × 8 = 512 evaluations, my RX 7600 did not take more than a few milliseconds per frame (out of a budget of 16 ms to reach a smooth 60 frames per second).
However, there was some low hanging fruit to bring this number down further, and not needlessly heat up PCs or the planet:
Most of the action happens in the lower regions of the atmosphere. So it makes sense to focus our efforts there. By using smaller steps early on in the ray march, and exponentially larger ones higher up, the step counts could go down to 8 × 3 = 24 without notable loss in quality.
The atmosphere is generally considered to end at an altitude of 100 km, but Rayleigh scattering has a scale height of only 8 km, meaning at 8 km there’s only 1/e = 37% as much of it as at sea level, and at 24 km it’s less than 5%. So it makes sense to end our atmosphere earlier so we can focus even more samples where it matters. I chose a cutoff of 40 km, where the Rayleigh density is down to a mere 0.7%. This let me bring down the number of samples to 6 × 3 = 18.
The sky is pretty smooth, without sharp edges. Godot has built-in machinery to render it at ¼th resolution, then scale it up. Let’s use that. (This is not applied to the sun disk, which we want to remain sharp.)
For the Mie phase function, Cornette-Shanks turns out to be overkill. The slightly simpler and thus slightly faster Henyey-Greenstein function does the job just as well; the difference is barely visible.
It’s hard to even measure frame time after these changes, but I think it’s around 0.1 ms.
It would be possible to get rid of the secondary raymarches, by either:
Precomputing them in a lookup table (2D texture), as in Nishita, Dobashi et al (1996). The drawback is that the LUT needs to be updated whenever the parameters change (e.g. as a result of changing weather).
Finding an analytical approximation, as Sean O’Neill did in GPU Gems 2. However, his approximation is only valid for one particular set of parameters as well, and I don’t think they match mine.
Since the secondary raycast is only doing 3 iterations and we’re already running so quickly, I didn’t bother trying either of these.
Let’s apply a tone mapper to get rid of the oversaturated colours, and see a sunrise in motion. I’m using the ACES tone mapper here, because the more modern AgX barely leaves any contrast intact:
I think that’s pretty good for a day’s work! Next up: a starry night, probably?
Night Ripper was unleashed into the world 20 years ago, and when it hit, it did the same thing to us as it did to many: rewired our brains to forever change our associations of all the songs sampled within.
We’d already loved 2ManyDJs' "As Heard on Radio Soulwax Pt. 2," Danger Mouse's "The Grey Album," the many Z-Trip mixes that bridged genres— and the advent of this Girl Talk album helped unearth even more OGs: "The Lesson(s)" by Double Dee & Steinski, or Italian releases like Club House and Pink Project. It also absolutely opened the doors to people's reception of our bootleg mp3 blog The Hood Internet, which later evolved into live DJ sets, plus all sorts of remix, editing, and composition projects.
The Hood Internet's initial approach was largely an already-been-done A vs B re-imagining of two songs together as a full "single" or DJ edit, sourced from our own vast collections of music at that moment in time. I'm trying not to use the word mashup, but that's what we made. (Picture that Winnie the Pooh meme where his usual appearance is next to the word "mashup," and then wearing the tuxedo he's next to the word "blend.") Whereas Girl Talk's approach was FRENETIC: 15 to 20 samples happening within a single track, all anchored together. It made sense that he'd state he was "not a DJ," and that the tracks weren't mashups. Night Ripper was a pop sound collage built for the dance floor.
Can you even remix something like that? Eh, why not. As a nod to its 20th bday, we grabbed the samples Girl Talk used on select tracks from the album, and created remixed versions of each track that keep the original tempo and rearrange the samples into a brand new configuration. And then made music videos for each of them!
Before the discovery of insulin, the lives of many people with diabetes were saved or prolonged by Carl von Noorden’s oatmeal diet. As I discuss in my video Is Oatmeal Good for People with Diabetes?, he published his findings in 1903, which were received with a great deal of skepticism. But the critics were overcome in the following years by the weight of the evidence.
Acclaimed doctor James B. Herrick began to try the oatmeal diet on his patients. Initially very doubtful, he became astonished by the results, which led to the 1909 proclamation that no case of juvenile or adolescent diabetes should be deprived of the benefits of the oatmeal cure.
The great Elliott Joslin, founder of the oldest and largest diabetes clinic in the world, described the effects of oatmeal as “sometimes magical,” calling the oatmeal cure an unsolved mystery, referred to back then as “one of the greatest puzzles in diabetes.” They did have some clues, though. They found that animal protein had to be strictly excluded, as it annihilates the favorable action of oatmeal-type diets.
And now we know, more than a century later, that, indeed, animal protein intake intensifies insulin resistance, which is the cause of prediabetes and type 2 diabetes, whereas plant-based foods enhance insulin sensitivity, which is the opposite.
We’ve long known that higher consumption of whole grains, including oats, is associated with a lower risk of diabetes. As I discuss in my video How Does Oatmeal Help with Blood Sugars?, more than a dozen randomized controlled trials found that oats significantly improved both short-term and long-term blood sugar control, in addition to lowering cholesterol levels.
We think the benefits arise from a fermentable fiber in oats called beta-glucan. We know one of the underlying cholesterol-lowering mechanisms of oatmeal consumption might be its microbiome-manipulating ability––in other words, having a beneficial effect on our intestinal bacteria.
A little fiber goes a long way. Our good gut flora uses fiber to make short-chain fatty acids that have anti-inflammatory effects. There are dozens of randomized controlled trials showing the types of fiber found in oats and beans can improve long-term blood sugar control in people with diabetes. Why? Because the gut bacteria selectively promoted by dietary fiber intake can help alleviate type 2 diabetes.
The oat fiber itself has been shown to act as a prebiotic, boosting the growth of beneficial bacteria like Lactobacillus and Bifidobacteria. So, between the lack of animal protein, lack of animal fat, and bursting at the seams with prebiotic fiber, it’s no wonder that oatmeal diets grew to become part of the clinical routine in the treatment of diabetes.
As I discuss in my video Oatmeal Diet Put to the Test for Diabetes Treatment, several studies have suggested that a few days of eating oatmeal could have beneficial effects for about a month afterward. In a randomized, controlled, crossover trial, not only did insulin needs drop by about 40% in just two days, compared to just restricting calories alone with a hypocaloric diabetic diet, but a measure of long-term blood sugar control taken four weeks later reflected the benefit.
Other new studies have shown the same thing. Two days of oatmeal significantly reduced the required amount of insulin and improved blood sugar levels, with beneficial effects noted for up to four weeks. Consider this: Patients with uncontrolled type 2 diabetes on the two-day oatmeal diet experienced a 40% reduction of insulin dose, accompanied by almost normalization of average blood sugars. Although the intervention only lasted for two days, researchers observed a lasting significant reduction of insulin dosage and ameliorated mean blood sugars for weeks after the participants were dismissed from the study—and that was after they resumed their regular diets.

Put people on a diet packed with oats, beans, fruits, vegetables, and nuts, and the number of their gut fiber-feeders churning out beneficial short-chain fatty acids shoots up, and fasting diabetic blood sugars drop by about 25% within one month. The more fiber-feeders they fostered, the better their blood sugar control. When the fiber-promoted short-chain fatty acid producers were present in greater diversity and abundance, participants had better improvement in their hemoglobin A1c levels (which is a measure of longer-term blood sugar control).

If you try an oatmeal diet, your physician should be ready to rapidly deprescribe your blood sugar drugs or else you could become dangerously overmedicated. Oatmeal interventions should not be performed in patients who might have difficulties in reporting symptoms of low blood sugar. The downside of trying oatmeal days is that it may work a little too well, so it must be done under close medical supervision.
Whole grains are good, but intact whole grains are better. The wholiest of grains: groats.
Oat groats have their inedible outer husks removed during processing. They can then be sliced into two to four pieces to make steel-cut (also known as pinhead or Irish) oats, which are considered a low-glycemic-index food, averaging under 55.
Oat groats can also be coarsely ground into Scottish oatmeal or steamed and flattened into “old-fashioned” rolled oats, which have a glycemic index of 55.
Instant oats are steamed longer and rolled even more thinly. Scoring 79, it’s considered a high-glycemic-index food, but not as bad as some breakfast cereals, which can get into the 80s or 90s.
Oatmeal is a classic whole-grain breakfast, and there are plenty of ways to enjoy it.
Once you have your BROL base, pick your toppings. When I feel like something sweet, my go-to is a chocolate-covered-cherry sensation. I make it with frozen dark red cherries, cocoa powder, dates, and walnuts or pumpkin seeds.
You can easily turn that BROL bowl savory; here’s a version made with sautéed greens. Google “savory oatmeal” for all sorts of interesting dishes involving mushrooms, herbs, curry, roasted vegetables—you name it!