Coding Adventure: Procedural Moons and Planets
Video Statistics and Information
Channel: Sebastian Lague
Views: 1,214,375
Rating: undefined out of 5
Keywords: programming, coding, game development
Id: lctXaT9pxA0
Channel Id: undefined
Length: 22min 47sec (1367 seconds)
Published: Sat Jul 11 2020
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.
Man I get so excited every time Sebastian Lague uploads a video. His coding adventures series is truly one of the most interesting things I've ever seen on the internet. If there were enough videos, I think I could watch it for 20 hours straight!
He briefly mentions the cube sphere but then does the rest of the video with icospheres / octahedron spheres.
The cube sphere is my pet favorite and supposedly Google uses it in all their mapping stuff: http://s2geometry.io/devguide/s2cell_hierarchy along with a subdivision system that unrolls the whole Earth as one space-filling 2D curve with a 64-bit index.
The icosphere is fine for what he's doing, and the cube sphere has downsides, too. It has 8 poles, and as you get near the poles, the squares become distorted. Instead of 90 degree corners, they turn into diamonds with 120 degree corners so that 3 can join together at each pole.
The same problem happens with icospheres at their poles - Normally a vertex should be shared by 6 triangles, but at a pole it's shared by 5. Math hates us.
The same trick of "Don't do binary subdivisions, just divide however much you need in one step" could also be done for the cube faces, and it would be simpler there, but in practice I think S2 geometry uses binary subdivisions.
I had wanted for a while to make a game with cube spheres to prove how cool they are, but I couldn't think of anything worth doing. Maybe icospheres are better, since they have mostly the same weaknesses?
This guys channel is amazing in general
Wow, I didn't think I'd learn much, I knew about most of the stuff he talked about, until he talked about tri planar mapping. I swear to god nearly every other tutorial about tri planar mapping tries to make it out to be some mystic galaxy brain bullshit. This made it so simple and so easy to understand what is going on, and the purpose of it! People who make tutorials, take notes from Sebastian here: Quit tooting your horn when you write tutorials, and just explain what you mean, and absolutely don't try to fill in the gaps of your own knowledge when you write it either, like this cool dude who claimed:
If you've watched Sebastian's video, you know this is bunk. You have to read from the same texture 3 different times, but you don't need to triple render the fragment. This guy didn't know what a "fragment" actually was, what he implied you had to somehow draw the same triangle multiple times. Or he made a strange misstatement I've never seen before, though he's had 6 years to fix his mistake if that was the case. These kinds of issues can stop people from implementing something even when you explain it well. People will second guess the knowledge they just learned "The author says I need to watch out for X, but I don't understand why, it doesn't make sense. But the author clearly cant be wrong because the tutorial was so good otherwise, and certainly I know less than him!" When Sebastian doesn't know something, he lets you know he doesn't know something. In his earlier terrain generation video where he moved things to the compute shader, he talked about how he didn't understand how to move his marching cubes generation over the the GPU. He thus had to use atomics in order to directly translate is CPU code over, essentially serializing the algorithm with out knowing it. The real solution to his problem is stream compaction, but that is a lot more difficult concept to tackle for someone who was just introduced to compute shaders. But he never made it seem like "Hey guys, I know everything, and this is exactly how you are supposed to do things". He lets you know when he's not an authority on something, so when he says something that doesn't make sense, he's already let you know "Hey, I might be wrong about this, take what I'm about to say with a huge grain of salt!".
Another thing is Sebastian only shows you what you need to see. He doesn't clutter your vision, or obscure the actual important code. Visualize, this is what you'll see. Background, this is how you'll be modelling it intuitively. Implementation. This snippet of code is self contained, and implements only what we just talked about, nothing else. Normally I find articles more efficient to learn from, but the articles that cover the same topics as his videos often fare much much worse. Get to the point, don't make me skip around your article to actually figure out what I need. As an example despite being a tutorial also in Unity and being only about triplanar mapping, this article manages to take more than 3 times as long to follow along and implement. They also made the code look... alien? It's the same language, yet they stuff it with so many unnecessary defines, macros and mixing shader FFI concepts and strange menu quirks it obscures the point.
I don't even use unity to do graphics development. I code everything in Vulkan and GLSL nowadays. I was able to translate what Sebastian showed us for triplanar mapping in only a couple minutes.
Haha the animation he uses at ~9 minutes is credited to Inigo Quilez. The name sounded familiar so I went back to look at some old school work and it turns out I emailed and got permission from him to use some fractal imagery in a paper I was writing.
all his videos are amazing.
This looks strangely similar to game Outer Wilds
What's the platform he's using to allow him to change parameters and show the resulting images in real time?
I spent a weekend trying to create some interesting randomly generated stars for a game I was working on it. After adding a few different noise patterns with different rotations to create a seething surface, adding a corona and then spending hours looking into modeling diffraction patterns to create a cool lens flair effect like they get on the Hubble and making it all look good at different levels of zoom, well, I gave up and mostly had some slightly off-white spheres floating around in face.
It's a surprising deep/fun problem.