Rendering the Sky, Sunsets, and Planets
483 points - yesterday at 1:26 PM
Sourceetra0
yesterday at 2:48 PM
I saw this a while ago so it might not be totally related, but Sebastian Lague did a video on atmospheres for his planet generation experiment which was also very entertaining to watch [1].
There's something particularly entertaining on developing visuals and watching them come a reality — I hope at some point be able to experiment in this field.
[1] https://www.youtube.com/watch?v=DxfEbulyFcY
TheRoque
yesterday at 3:48 PM
For me the most amazing thing about Sebastian Lague is how the youtube algorithm can screw you up. He used to do millions of view on his videos, and now he barely makes half a million. Well it might also be because of covid, and everyone at home getting interesting in random stuff.
badestrand
today at 1:27 AM
I think this is just a matter of visuals. His videos that are doing well show many beautiful things. Just looking at the thumbnails and the view counts gives that away already.
matthewfcarlson
yesterday at 7:09 PM
Literally my only complaint about Sebastian Lague is that he doesn't have enough videos. I usually put them on to fall asleep. I've thought about making my own just to include more content like that out there. The fairly deep technical topics explored in a calm but thorough way.
gmiller123456
yesterday at 9:02 PM
I'm not sure if it was a deliberate omission or not, but it's worth pointing out in the Sunset model that the sky should not go black as soon as the Sun goes below the horizon as it does in the demo. The Sun will still be shining on the atmosphere above you, and in areas above your horizon for a considerable time after Sunset. There will still be a noticeable twilight (in Earth's atmosphere) until the Sun is 18 degrees below the horizon. It's probably not practical to implement using ray tracing, but there are common algorithms to model it.
Indeed that’s what twilight is by definition.
rollulus
yesterday at 5:22 PM
Incredible what mobile phones and browsers can do nowadays. I remember implementing this paper from 1993 (the absolutely OG for this topic and very readable): “Display of The Earth Taking into Account Atmospheric Scattering” by Nishita et al: https://www.researchgate.net/publication/2933032_Display_of_...
jrowen
yesterday at 5:51 PM
In another comment I recalled reading a paper while implementing Rayleigh and Mie scattering a while back...this was definitely it!
Getting it working was a "holy shit, we can actually model this complex real-world phenomenon pretty well with a few relatively simple calculations" moment. I went from a static blue skybox to a full day-night cycle just like that.
baliex
yesterday at 3:09 PM
This is absolutely fantastic.
I've thought before about trying to render skies on the web as a series of gradients overlaid on top of one another. I expect I could have had some level of success and gotten some mediocre results, but it would be nothing compared to what you've created.
Thank you so much for sharing this; it's inspirational, must have taken you a very long time to put together, and I'm blown away by your results.
jrowen
yesterday at 3:49 PM
I implemented Rayleigh and Mie scattering for a game engine once (my own, hobbyist thing). It was pretty crazy to see a quite good sunset/sunrise cycle from those alone. IIRC even the sun itself popped out of that somehow.
I was using XNA (Microsoft's C# gamedev platform) and following Riemer's excellent series of tutorials, which have been preserved here[0], but I don't see anything about scattering. I might have gotten that bit from somewhere else. I do recall reading papers with math equations.
[0] https://github.com/SimonDarksideJ/XNAGameStudio/wiki/Riemers...
dinfinity
yesterday at 2:38 PM
SpaceEngine is also known for putting quite some effort into this; highly recommended: https://www.youtube.com/watch?v=_4TjdVAbXks
https://spaceengine.org/
CobrastanJorji
yesterday at 6:17 PM
I love the scale that FAQs for things like this provide, as well as the variety of questions.
Q: How many objects are there in SpaceEngine?
A: The entire Hipparcos catalog of stars, all known extrasolar planets, over ten thousand galaxies, most objects in the solar system, which adds up to 130,000 things. In addition, more galaxies and star systems than exist in reality in all of the observable universe.
Q: How can a water planet be hot?
A: Water in the upper atmosphere is in the form of hot vapor, but farther down it smoothly transitions into a liquid state under high pressure. Even deeper it turns into a solid state called ice VII.
Q: How do I move?
Use WASD keys.
the__alchemist
yesterday at 2:55 PM
It's fantastic software that's been around for many years, and has exquisite attention to detail on this and many other topics; this article also reminded me of it!
lopsotronic
yesterday at 9:03 PM
Wikipedia in one tab, and SpaceEngine in the other, is one of my favorite semi-educational gaming experiences. Great game. I haven't seen anything quite as nice even though it's quite long in the tooth.
sdoering
yesterday at 2:10 PM
Wow. This was quite a ride. I only understood maybe 5% - but I was massively impressed.
MeshHideaki
yesterday at 2:53 PM
Same here. The visuals alone made it worth reading.
sdoering
yesterday at 2:56 PM
Absolutely. Could not agree more!
xerox13ster
yesterday at 5:41 PM
Oh hell yeah this is beautiful and a great read.
Also given this is MIT licensed, the skybox for my game is a solved problem! All I need is that render where the sun traverses the sky since perspective will be fixed. This allows me to extend it for the variation of the Sun’s angle through the year with sinusoidal periodicity.
gabrielcsapo
yesterday at 2:45 PM
Incredible personal website, great post. Super awesome content!
DonaldPShimoda
yesterday at 3:53 PM
Agreed, this is a gorgeous blog. Makes me get the itch to redesign my own at some point (even though I've never been great at design).
jeremyscanvic
yesterday at 2:16 PM
I wonder how this relates to the Perez All-Weather and Preetham sky models. Not an expert about that but I managed to implement those in the past and it was quite a fun project!
https://github.com/jscanvic/SkySim
laander
yesterday at 6:51 PM
Stunning - both the result and interactive walkthrough of how you got there.
Will store this next to my collection of Sebastian Lague favs. Thanks for sharing it with the world
arjie
yesterday at 3:20 PM
Oh these are gorgeous. And I’m partial to the kind of things that are based on physics models as opposed to the techniques based on graphics hacks (stacked gradients etc.).
whicks
yesterday at 4:58 PM
This is hugely relevant to my interests. In my spare time I've been building a planetarium/star map app (iOS / Vision Pro) and atmospheric scattering is something that has been on my todo list for awhile. This is definitely above and beyond what I'm going for atmosphere-wise but still amazing to see. Thanks to Maxime for this write up!
Great! Now add a liquid ocean and add scattering in that liquid. Stretch goals: absorption and reflections...
Beautiful work, thanks for sharing!
swiftcoder
yesterday at 4:14 PM
Love it, this is one of the best explainers of atmosphere rendering I've seen on the web
colechristensen
yesterday at 6:54 PM
That's really great and quite conveniently timed for me I've been working on my own sky rendering over the last week or so of evenings[1], to end up as a Godot plugin and perhaps a writeup. It started as deep dissatisfaction with the results I could achieve with what was available. I'm still on the fence about the distance to go for realism vs whatever I find aesthetically pleasing.
https://www.youtube.com/watch?v=BJDgmVUL7HY
This paper was the point I jumped in with An analytic model for full spectral sky-dome radiance
https://dl.acm.org/doi/10.1145/2185520.2185591
seabass
yesterday at 7:40 PM
The video you linked is currently private
colechristensen
yesterday at 8:05 PM
Fixed
chickensong
yesterday at 9:17 PM
Still says private.
colechristensen
yesterday at 9:25 PM
Can you tell I don't publish many youtube videos? Apparently "unlisted" didn't do what I wanted.
chickensong
today at 2:51 AM
All good. It works now, and it looks great! I'd be interested in the plugin and write up. How can I get notified of updates?
slopinthebag
yesterday at 5:39 PM
I love how just a bit of math can create such beautiful visuals
mirekrusin
yesterday at 2:13 PM
Gem.
Flat earth version for comparison would be fun.
katzito
yesterday at 6:06 PM
Whoa! Oo Inspiring.
botanrice
yesterday at 7:08 PM
so amazing thank you for sharing!!
seabass
yesterday at 5:09 PM
[dead]