shifting some bits ...

7th February 2020

Procedural generation: Gas giants

A while ago I saw some posts on reddit popping up with different takes on gas giants, for example this one or Gaseous Giganticus (from some time ago). The second one even has some code on github, go check it out! I wanted to do a quick take on my own, making sure the planet is animated (meaning the gases “move”) and is a real sphere (pre-created flat textures often come with the problem of generating ugly seams on the backside).

Preview #1

There are some really impressive resources online for various ways of creating planets like that and out of interest I decided to stick to fBm (fractal Brownian motion). I won’t cover the mathematical details this time, since that’s not the main purpose of this post, but I’ll recommend to read through these two incredible resources if you are interested:

Preview #2 – earth-like colors

The planets are being colored using three (really it’s five, but three of those are being combined into a single one) colors depending on the result of the fBm going from dark to light areas. As you can see in the above image, adjusting these colors can produce really different results. So it’s not only about gas giants, stuff with huge oceans or even something resembling a desert-only planet can be created:

Preview #3

How does this look in real-time?

If you want to take a look at the code (a simple fragment shader on shadertoy), or want to try out different color combinations take a look at this shader. For a quick preview (without the simple sharpening effect) I’ve embedded an iframe (if you can display that) below:

Reading / additional resources

This is just a small reading list, with useful links or interesting stuff. In no particular order:

Want to be up-to-date with more - absolutely cool and random - stuff I do and post? I'll let you know, as soon as there's new and interesting content.

Posted in mathematics, programming
Write a comment