Coding Adventure: Clouds

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 มิ.ย. 2024
  • Clouds are lovely and fluffy and rather difficult to make.
    In this video I attempt to create clouds from code in the Unity game engine.
    Project source (Unity, HLSL, C#) is now out of early access:
    github.com/SebLague/Clouds
    If you'd like to support the creation of more videos like this, please consider becoming a patron:
    / sebastianlague
    Learning Resources:
    killzone.dl.playstation.net/ki...
    www.diva-portal.org/smash/get/...
    patapom.com/topics/Revision201...
    www.gamedev.net/forums/topic/...
    Assets:
    Mouse flight: github.com/brihernandez/Mouse...
    Plane model: www.turbosquid.com/FullPrevie...
    Music:
    "Hypnothis" and "The Show Must Be Go" by Kevin MacLeod (incompetech.com)
    Licensed under Creative Commons: By Attribution 3.0 License
    creativecommons.org/licenses/b...
    Notes:
    I made a mistake at 2:12 in saying that the closest point is guaranteed to be inside the adjacent cells, it’s possible to get arrangements where the nearest point is two cells away orthogonally. This doesn’t seem to occur much as I never noticed any discontinuities in the result, but worth knowing.
    Chapters:
    0:00 Intro
    0:56 Worley Noise
    3:12 Image Effects
    3:50 Raytracing... a Box!
    5:14 Raymarching Cloud-ish Shapes
    7:10 Light Scattering Theory
    8:26 Mishap Montage
    9:22 Final Code
    9:44 Cloud Editor
    11:31 Final Demo: Flying Through the Clouds

ความคิดเห็น • 2.2K

  • @SebastianLague
    @SebastianLague  4 ปีที่แล้ว +1221

    Hello, hope you enjoy the video! It was a lot of work getting this far, but definitely still have a long way to go. Clouds are tough! I'd love to hear your thoughts about how they could be improved.
    Links to all the resources I learnt from are in the description if you'd like to know more.
    Edit: I made a mistake at 2:12 in saying that the closest point is guaranteed to be inside the adjacent cells, it’s possible to get arrangements where the nearest point is two cells away orthogonally. This doesn’t seem to occur much as I never noticed any discontinuities in the result, but worth knowing. Thanks to everyone who pointed it out.

    • @redrolacitebahpla
      @redrolacitebahpla 4 ปีที่แล้ว +5

      Love your videos!

    • @polygorg
      @polygorg 4 ปีที่แล้ว +2

      Cool videos!

    • @owenhey3187
      @owenhey3187 4 ปีที่แล้ว +22

      That extremely well put together and entertaining - and the final result is amazing. Any ideas on how you are going to optimize it? Since you are already doing basically everything on the GPU, what other optimizations exist? Thanks!

    • @wistlov9248
      @wistlov9248 4 ปีที่แล้ว +2

      That looks absolutely stunning! You inspire me so much😄

    • @OsUltraBug
      @OsUltraBug 4 ปีที่แล้ว +2

      It looks awesome, I would like to know if it would be feasible to actually simulate the clouds as they are in real life (as in simulate condensation, evaporation, etc.). It would probably be too much for a GPU to handle so my suggestion would be to hand it off to a server that would then stream the simulation and it's just a matter of rendering.

  • @Why485
    @Why485 4 ปีที่แล้ว +8611

    It was quite a shock seeing my aircraft controller randomly show up in this video! I'm still laughing. Thank you for the shoutout!

    • @terrybeckett2512
      @terrybeckett2512 4 ปีที่แล้ว +84

      subbed to you awesome content on your channel.

    • @level5822
      @level5822 4 ปีที่แล้ว +30

      Hello fellow DCS player

    • @terrybeckett2512
      @terrybeckett2512 4 ปีที่แล้ว +14

      @@level5822 Thanks a lot for mentioning that game name I've finally found the kind of game I've been looking for since months
      ^-^

    • @lukelader
      @lukelader 4 ปีที่แล้ว +1

      @@Beengus I know english. you know not

    • @Beengus
      @Beengus 4 ปีที่แล้ว +24

      @@lukelader It was a joke you fool. Couldn't you tell, you tool?

  • @beastbum
    @beastbum 4 ปีที่แล้ว +2484

    Boids + Clouds + Weathered terrain + simulated fauna + planet generation
    ... equals an unhappy cpu

    • @aikatheshibainu3994
      @aikatheshibainu3994 4 ปีที่แล้ว +41

      Came here to say this! He should definitely try this!

    • @sosig6445
      @sosig6445 4 ปีที่แล้ว +55

      once terrain generation is done the weathered terrain does not affect performance much...

    • @RaimarLunardi
      @RaimarLunardi 4 ปีที่แล้ว +70

      Imagine when he makes the clouds Interact with the mountains...

    • @anandsuralkar2947
      @anandsuralkar2947 4 ปีที่แล้ว +31

      Lol GPU*

    • @knightshousegames
      @knightshousegames 4 ปีที่แล้ว +20

      The interstellar survival game he has the tools to make will be amazing.

  • @supermatt614
    @supermatt614 4 ปีที่แล้ว +1663

    As a pilot, can confirm that the end is pretty damn accurate to what flying in a cloud looks like.

    • @leaderofcommunistchina1427
      @leaderofcommunistchina1427 4 ปีที่แล้ว +184

      Scary as hell when going through zero visibility near terrain. Avoid whenever possible. Had to go through some thick fog up in Indonesia once and basically had to trust the console with my life

    • @user-qp3qj2jv6f
      @user-qp3qj2jv6f 4 ปีที่แล้ว +51

      @@leaderofcommunistchina1427 man, you have some hardened steel balls

    • @ClokworkGremlin
      @ClokworkGremlin 4 ปีที่แล้ว +72

      It better be, the rendering technique he's using is pretty close to physically accurate for how light behaves when passing through a cloud.
      (He could upgrade his raytracing to photon mapping or even path tracing, which would make it as close as possible, but his GPU is already visibly struggling.)

    • @motsgar
      @motsgar 4 ปีที่แล้ว +4

      @@ClokworkGremlinwould it be possible to write a shader like this in blender and make it look really good?

    • @ClokworkGremlin
      @ClokworkGremlin 4 ปีที่แล้ว +5

      @@motsgar probably. I dont know much about Blender, but hes got most of the theory in the video so if you follow along and look up the right equations you should get a similar output.
      The thing I'm not sure about is the shader runs using the compute-shader raytracer he wrote a few videos previously and then upgraded in a subsequent video.

  •  4 ปีที่แล้ว +306

    In 2011-2012 I and my friend watched your tutorial about how to make a platform game for our final graduation exam. After 8 years both of us now are technical leader/head of dev but your video still bring new things for us, always! Thank Sebastian, you always a part of our career path.

  • @bipstudios2573
    @bipstudios2573 4 ปีที่แล้ว +2777

    "Every day the clouds would float past my window, taunting me."
    Hahaha, love your videos!

    • @Seppevh
      @Seppevh 4 ปีที่แล้ว +13

      Programmer yells at cloud

    • @alexandrutonita736
      @alexandrutonita736 4 ปีที่แล้ว +2

      I thought this was an inspirational quote

    • @silvertheelf
      @silvertheelf 4 ปีที่แล้ว +2

      Lol

    • @radthadd
      @radthadd 4 ปีที่แล้ว +2

      We all saw the video. Dingus

    • @kurtisgibson2929
      @kurtisgibson2929 4 ปีที่แล้ว +2

      @@radthadd no need to be mean

  • @darkking571
    @darkking571 4 ปีที่แล้ว +1488

    Sebastian Lague in 2050:
    "Coding Adventure: The entire Universe"

    • @viktorpetukhov727
      @viktorpetukhov727 4 ปีที่แล้ว +22

      Quantum Physics

    • @SimplePhysics00
      @SimplePhysics00 4 ปีที่แล้ว +11

      ~~I'd pay to watch that~~
      I'd pay to install that

    • @OriginalMrE
      @OriginalMrE 4 ปีที่แล้ว +16

      "With a little bit of C# coding using a generation function, I've created New York in the year 2021, a pretty relative look back to what it actually looked like using only coding."

    • @kurtisgibson2929
      @kurtisgibson2929 4 ปีที่แล้ว +7

      Depends on what you are emulating but it's entirely possible

    • @pablodelgado744
      @pablodelgado744 4 ปีที่แล้ว +2

      "Coding Adventure: Life" xD

  • @hans_____
    @hans_____ 4 ปีที่แล้ว +2793

    No wonder I can't find a job. Everyone else is smarter than me.

    • @chaomatic5328
      @chaomatic5328 4 ปีที่แล้ว +80

      - ᔕጠጠ ᓬェᗆ⊣ ⤙o⊂ ᗜ-ᗜ ェጠᓓጠ
      Hint: look sideway.

    • @Soulixs
      @Soulixs 4 ปีที่แล้ว +126

      he's been doing this stuff for over 10 years

    • @user-ec1bd6is1r
      @user-ec1bd6is1r 4 ปีที่แล้ว +16

      Do you have a portfolio? If no then there's no chance

    • @Arcaryon
      @Arcaryon 4 ปีที่แล้ว +45

      Just get zhe Flammenwerfer.

    • @____uncompetative
      @____uncompetative 4 ปีที่แล้ว +179

      hans
      1. These are all a part of a technical showcase of coding techniques
      2. These are complicated because he is using hard mathematics
      3. These are difficult because he is using C#
      4. These are not the work of a hobbyist
      5. These shouldn't discourage you
      6. These aren't fun games
      7. You can do better

  • @gblawrence034
    @gblawrence034 4 ปีที่แล้ว +1337

    Sebastian: makes clouds
    me: woah
    Also Sebastian: casually makes it into a flight simulator
    me: wtf

    • @aquaarmour4924
      @aquaarmour4924 4 ปีที่แล้ว +32

      Is this supposed to be funny, relatable, quirky or whatever you normies think is cool nowadays.

    • @gblawrence034
      @gblawrence034 4 ปีที่แล้ว +152

      Aqua Armour are you okay?

    • @KatzRool
      @KatzRool 4 ปีที่แล้ว +32

      @@aquaarmour4924: when my face when tfw'd
      me: pikachu pogger emoji

    • @aquaarmour4924
      @aquaarmour4924 4 ปีที่แล้ว +22

      @@gblawrence034 The question is are you ok? All I see on the internet nowadays are stupid kids using this "meme" format in places where it really doesn't make sense just to act cool. Ever heard of using normal sentences?

    • @gblawrence034
      @gblawrence034 4 ปีที่แล้ว +106

      @@aquaarmour4924 you seem extremely angry at literally nothing

  • @wanderingheath
    @wanderingheath 4 ปีที่แล้ว +689

    No matter how good I think I’ve become, I watch something like this and feel like I’m coding in crayon.

    • @matube600
      @matube600 4 ปีที่แล้ว +31

      same man this guy make feel waaay too stupid

    • @CodeAsm
      @CodeAsm 4 ปีที่แล้ว +32

      I believe in you guys, we can do this :D lets stop watching youtube and start coding (wich is basicly watching youtube browsing stackoverflow for code help, ow and apparently reading papers)

    • @xjonnyd93x
      @xjonnyd93x 4 ปีที่แล้ว +26

      He is impressive as hell, but most of the stuff he does takes a lot of planning and a shit ton of math. He is definitely confident in his math abilities, but nothing he was programming was too outlandish.

    • @tear728
      @tear728 4 ปีที่แล้ว +26

      @@xjonnyd93x Agreed. The programming itself isn't so bad. Its really the math and knowing how to approach the problem, which is gained by years of experience.

    • @justinflowers9380
      @justinflowers9380 4 ปีที่แล้ว +9

      Well, keep in mind the fact that he dedicates a LOT of time into these. No matter your coding skill, if you put effort amd time into it you can achieve your goal.

  • @TruePauperkoning
    @TruePauperkoning 4 ปีที่แล้ว +671

    That endshot looks absolutely beautiful. I'm a programmer myself and hope to be this good in the future. Keep it up because im watching every single video you post

  • @Arekkussou
    @Arekkussou 4 ปีที่แล้ว +89

    You claim it's far from finished, yet looking at the end of your video, my jaw dropped at how real this feels. Sure, there are artefacts and whatnot, but it looks and FEELS like a natural cloud! You, sir, are living proof that if you arm yourself with the right knowledge, you can create living, breathing worlds out of thin air (and code). I'm instantly liking and subscribing!

    • @BabudroSun
      @BabudroSun 2 ปีที่แล้ว +1

      Samewise Gamgee. Super duper impressed.

    • @maxfun6797
      @maxfun6797 ปีที่แล้ว +3

      Except this is a huge plane that is placed on the scene, and won't generate realistic, indivual clouds. Can't create other weather phenominons. Good for demo, but does it work for actual games?
      It does give me an ides though. Using the same method, but individual 3d planes/cubes, but the plotting at and offset from the edge so the fluff doesn't cut off. Then with these individual clouds, different types of clouds can be places near them, and blend them. ... all very heavy effort. Easy to say, hard to do.

    • @holl7w
      @holl7w ปีที่แล้ว +1

      There was a short clip of the real clouds in the mountain in this video. The clouds were behaving very differently (they had physics) while this is just a 3D texture and not simulated with molecular precision (🤓) (or just acting like real clouds and have physics). There is new techniques (🤓🤓🤓🤓🤓) that have better performance and have better clouds.
      I hate myself.

  • @mom0367
    @mom0367 4 ปีที่แล้ว +44

    I love watching this guy be good at coding instead of using my time to actually learn coding.

  • @Encysted
    @Encysted 4 ปีที่แล้ว +470

    The ending is absolutely gorgeous.
    The little touches like the plane leaving wing trails in the clouds are really cool.

    • @kurtisgibson2929
      @kurtisgibson2929 4 ปีที่แล้ว +13

      I actually didn't notice that

    • @chaomatic5328
      @chaomatic5328 4 ปีที่แล้ว

      @@kurtisgibson2929 me either.

    • @Kokonutzlz
      @Kokonutzlz 4 ปีที่แล้ว +2

      12:18 and 12:22 are where it's visible. I don't know if that came with the plane/controller simulation, or if Sebastian did that himself.

  • @MrMusAddict
    @MrMusAddict 4 ปีที่แล้ว +1989

    Excellent work! I have 2 suggestions:
    1) If it's possible, I recommend adding a 4th dimension into your noise. That way you can do a 4th dimensional offset, which will simulate condensation and evaporation.
    2) See if you can send the terrain data back to the noise function. You can then use the heightmap to prevent the clouds from clipping, and maybe even shape the clouds over the mountain like in your IRL video.

    • @SebastianLague
      @SebastianLague  4 ปีที่แล้ว +261

      MrMusAddict Interesting ideas, thanks!

    • @zoewalker2064
      @zoewalker2064 4 ปีที่แล้ว +32

      i would love to see this implemented. love the video @sebastian

    • @nilslorand
      @nilslorand 4 ปีที่แล้ว +81

      can't wait for Coding Adventure: Clouds 2

    • @Poolie
      @Poolie 4 ปีที่แล้ว +23

      @@SebastianLague Would love to see a follow-up in later videos!

    • @NBsTube
      @NBsTube 4 ปีที่แล้ว +40

      You managed to turn something I thought was pretty hard to implement and even understand the papers related is quite hard, into something really easy to follow and achieve with some good patience and tweaking, I also vote for a part 2!

  • @abdel4455
    @abdel4455 4 ปีที่แล้ว +28

    "..., but every day, the coulds would flow past my window, taunting me."
    There's not many places you can use that woah

  • @NewbNinjas
    @NewbNinjas ปีที่แล้ว +7

    Holy! Man, this is crazy. I was looking for a tutorial on how to make clouds revolve around a planet (view from a spacecraft in space) just to dolly up one of my low poly planet models. This is way beyond what I need but I'm in awe of the depth and knowledge you have on this. Fantastic work.

  • @BakersTuts
    @BakersTuts 4 ปีที่แล้ว +706

    Would be nice if the clouds casted shadows onto the mountain surface.

    • @timh.6872
      @timh.6872 3 ปีที่แล้ว +65

      Would be nice, yes, but very GPU-intensive. Would need to map the procedurally generated clouds onto the terrain, which essentially means the cloud sampling fragment shader is running on every pixel. Perhaps just running it per vertex and filtering it would be enough...

    • @Alex-op2kc
      @Alex-op2kc 3 ปีที่แล้ว +2

      Nice find

    • @Mystixor
      @Mystixor 3 ปีที่แล้ว +60

      Just rendering the noise to a texture (2d slice of the center of the clouds (densest area)) and then instead of rendering a shadow map as usual directly projecting the noise onto the terrain as occlusion values in the terrain shader should work out nicely.

    • @TheFinalVibes
      @TheFinalVibes 3 ปีที่แล้ว +9

      Baker... Odd finding my favorite call of duty editor back in the day (the one who taught me AE nonetheless...) on a unity video hahaha

    • @sr-fk9dz
      @sr-fk9dz 3 ปีที่แล้ว +2

      @@timh.6872 one way to do that is to just continue the ray down the light source in the shadier instead of just stopping at the intersection, then update the ground textures alpha color where the ray landed.

  • @wesleyvant7787
    @wesleyvant7787 4 ปีที่แล้ว +443

    Me: " yeah that works"
    *Looks at hello world program with 473 errors*
    Me: "well guess i'll watch another coding adventure"

    • @z-beeblebrox
      @z-beeblebrox 4 ปีที่แล้ว +56

      lol, yeah me: writes a script where all it does is spawn a cube when you click the mouse, which has literally more errors than there are lines of code
      also me: "let's look up how to code clouds!"

    • @CodeAsm
      @CodeAsm 4 ปีที่แล้ว +6

      I started with BASIC, print loop: "Hello world!"
      Now Im not allowed to use GOTO anymore :( I GOTO clouds and dream. Syntax error

    • @anandsuralkar2947
      @anandsuralkar2947 4 ปีที่แล้ว +1

      Lol

    • @Knightfire66
      @Knightfire66 4 ปีที่แล้ว +1

      hahahaha i deinstalled cisual studio because i got so much errors with hello world xD (and on vs u get a sample of hello world code xD)

    • @davlad32
      @davlad32 4 ปีที่แล้ว

      This is too real!

  • @blainemobius2697
    @blainemobius2697 3 ปีที่แล้ว +9

    Holy crap, those are some of the most legit clouds I've seen in a game engine. I love this. Idk where I would even start with something like this.

  • @bkmakesgames4055
    @bkmakesgames4055 4 ปีที่แล้ว +6

    Hey. I just found your channel today, trying to find a video about perlin noises. I just started learning about the whole “noise” concept. I couldn’t help but notice how brilliant you and your works are. Even after studying, I just keep on watching your video, getting motivated and craving for more knowledge! Thank you sir, for sharing your talent for free on the internet.

  • @bobthedeleter
    @bobthedeleter 4 ปีที่แล้ว +404

    Imagine:
    A fully simulated planet with more detailed, naturally eroded terrain that renders as you fly in, surrounded by birds that act like actual flocks, realistic clouds and functioning ecosystems filled with animals that evolve over time.
    That would be the single best simulator Earth

    • @notlegal99
      @notlegal99 4 ปีที่แล้ว +41

      microsoft flight simulator

    • @jakeaustin901
      @jakeaustin901 4 ปีที่แล้ว +33

      Would destroy any computer we could have 😂😂😂

    • @Danuxsy
      @Danuxsy 4 ปีที่แล้ว +15

      look at microsofts flight simulator, it renders the entire Earth without loading screens.

    • @bobthedeleter
      @bobthedeleter 4 ปีที่แล้ว +14

      @@Danuxsy yh, but it doesn't have animals or ecosystems does it?
      That was the main point I was getting at

    • @Danuxsy
      @Danuxsy 4 ปีที่แล้ว +7

      @@bobthedeleter no but it does have all the other things you mentioned.

  • @Jabrils
    @Jabrils 4 ปีที่แล้ว +501

    for some reason I am both crying & amazed. this was beautiful

    • @sh0unakgg274
      @sh0unakgg274 3 ปีที่แล้ว +6

      Sorry but I can't like ur comment
      bcs..
      it will ruin the number

    • @j_respect5948
      @j_respect5948 2 ปีที่แล้ว

      Ok great

    • @tattikhatti7917
      @tattikhatti7917 2 ปีที่แล้ว

      i know why you are crying

    • @rfisty
      @rfisty 2 ปีที่แล้ว +1

      420 likes lol

    • @JustinS06
      @JustinS06 2 ปีที่แล้ว

      @@rfisty what?

  • @1FelixxileF1
    @1FelixxileF1 4 ปีที่แล้ว +92

    "I am making Flight Simulator 2020 at home all by myself"

    • @Danuxsy
      @Danuxsy 4 ปีที่แล้ว +1

      Microsoft flight simulator: I don't think so.

  • @zubrach5931
    @zubrach5931 3 ปีที่แล้ว +7

    this guy : trying to simulate clouds for weeks.
    cyberpunk 2077 : P R E D E F I N E D

  • @dantescanline
    @dantescanline 4 ปีที่แล้ว +323

    This is great, i especially appreciate the montage of all the semi failed attempts along the way. For me, this is the most fun part of doing creative code work, searching the space of a new problem and debugging all the strange outputs. It helps this feel less like a rigid tutorial and more like exploring an interesting idea with a friend.

    • @drvanon
      @drvanon 4 ปีที่แล้ว

      I totally agree with you!

    • @ETXAlienRobot201
      @ETXAlienRobot201 4 ปีที่แล้ว +2

      and sometimes one of your fails is good enough to maybe be a feature in something else (;

  • @christianloizou4463
    @christianloizou4463 4 ปีที่แล้ว +1

    The amount of effort that goes into creating something that to the untrained eye might seem so simple is incredible. And you’ve wasn’t a sub because you were smart enough to actually do it

  • @francyleomatos7104
    @francyleomatos7104 4 ปีที่แล้ว +2

    I am Brazilian and even without understanding a word of what you say, I feel wonderful and inspired again with my projects, more than an amazing class, there is a great motivator, I confess that I felt a huge desire to give you a hug and thank you that is why. I feel amazed when people have the gift of encircling with such immercivity. Thanks

  • @codewing
    @codewing 4 ปีที่แล้ว +208

    "We've just created the worlds worst edge detection effect"
    I laughed so hard :D

    • @thomasanderson1416
      @thomasanderson1416 4 ปีที่แล้ว +14

      At least I finally got to know how to make an edge detection effect.

  • @centreoftheselights
    @centreoftheselights 4 ปีที่แล้ว +238

    As someone with a Masters in Meteorological Physics, this was really interesting to me. It doesn't do a great job of modelling real cloud behaviour, especially in terms of motion over time, but that's understandable since cloud physics are incredibly complex and difficult to calculate. But it did make me understand why a lot of simulated clouds might look and act in the way they do (e.g. mostly confined to a single vertical layer, single uniform horizontal velocity, but good simulation of light effects).

    • @C4CH3S
      @C4CH3S 4 ปีที่แล้ว +20

      Oh man. You will have a blast with the new flight simulator Microsoft is making. Check out the videos

    • @kurtisgibson2929
      @kurtisgibson2929 4 ปีที่แล้ว +3

      I think he deliberately made it crude due to real clouds taking a lot of computational power

    • @Foxtrot2F
      @Foxtrot2F 4 ปีที่แล้ว +11

      Point in gamedev is to fake cloud movement and not to simulate them.

    • @Dystisis
      @Dystisis 4 ปีที่แล้ว +5

      ​@@Foxtrot2F Which is a shame, though understandable due to limitations in users' computational power. In interactions we can usually detect the difference between something that's physically simulated and something that's visually faked, and it has a huge impact on immersion.

    • @matthewbadger8685
      @matthewbadger8685 4 ปีที่แล้ว +10

      @@Dystisis Not if you're clever about it.

  • @Doogledude123
    @Doogledude123 4 ปีที่แล้ว +194

    Can you do a coding adventure simulating snow on the ground, packable when something moved over it, using something like this?

    • @ClokworkGremlin
      @ClokworkGremlin 4 ปีที่แล้ว +15

      eh... maybe, but you'd probably be better off using something closer to voxel terrain. I believe one of the (PS2-era) Virtua Fighter or DOA games had levels with snow on the ground that would get mashed and deformed by the fighters' footsteps, and it just used a simple heightmap that got knocked down whenever something passed through it.

    • @dutchdykefinger
      @dutchdykefinger 4 ปีที่แล้ว +2

      ​@@ClokworkGremlin yeah, a dynamic heightmap sounds like the cheapest solution for sure
      especially that rudamentary implementation.
      for a bit more razzmatazz stencil type of shit,
      you could just project whatever is colliding striaght from the bottom up in orthographic with a hard Z distance limit about as far as you want the deform to be deep.
      map the things that are further away in Z distance with darker shades of grey to make a heightmap (or lighter, depending on which way you want to go), and map them across the whole rgb range (something like "int color=Math.round(vector.z/zmax)*255"), not overwriting any already set values (essentially projected Z -> B/W color mapping to be short about it).
      you could even use lookup tables (read: more bump/heightmaps) to make it even cheaper,
      or or go the other way, and pimp it even a bit more, and allow it to deform terrain other than striaght down,by calculating the inverse angle at which the object approaches it (IE: "player.velocity*=-1" for every axis, and using the outputs to decide where to project the object from, and the factors to which each axis on the target plane should be deformed. (read: the intensity factor for moving the vertices)
      just mix the 2 maps with regular 2d, as in poking in the pixel data arrays with basic maths (multiplication)
      could even do with addition/subtraction alone, or even hard setting values,
      but add/sub wouldn't respect the form of prior deformations as much, unless you made some conditions you can completely avoid using multiplication, and the other (setting) wouldn't respect any old data at all, obviously.
      but that's merely a matter of preference
      the geometry may get a bit busy at some point if you want it to look good though, but that's why these things almost always had a hard count limit with modulo on the array index for good old last-in-first-out. or a decay time.
      tackling that may be a bit more complicated, but i'd opt for something like introducing a view distance falloff for geometry simplification,
      by keeping multiple mesh/vertex datasets at varying degrees of detail/complexity at hand,
      using precalculated positions, and bounding boxes of the deformations outside of the range as texture position and size, to fake your way out of it
      even dynamic unsubdividing is pretty easy if you stick to planes, not harder than calculating pixel or tile array position from X,Y values using the width and height maximums in 2d, as planes have no complexity in the Z dimension whatsoever, it's all still 2d under the hood
      (akin to "index=(ob.x%w)+Math.floor(ob.y/w)" , or "coord_x=Math.round(ob.x/tilesz)*tilesz" and so on...)
      all i know is, i would avoid dynamic geometry complexity like the plague, changing from anything but a plane will mess up the heightmap mapping unless you use a ton of witchcraft, and just duplicating geometry as a seperate object is entering a minefield of z-fighting and collision detection problems, easily the 2nd hardest approach (and not even all that cpu friendly either if the whole process is to be done in real-time)
      they may be more balls to the wall once said and done, but getting there... ugh, i'd rather die of natural causes

    • @ClokworkGremlin
      @ClokworkGremlin 4 ปีที่แล้ว +4

      @@dutchdykefinger you're getting deep into risk of over simulation there, honestly. Depending on the snow depth you're looking to simulate, what kind of deformations, and the level of dynamics you're looking at, one of the linked particle simulations 2-Minute Papers has featured might work.

    • @pianochannel100
      @pianochannel100 3 ปีที่แล้ว +4

      Snow on the ground is an extremely difficult simulation. Physically accurate simulations of snow on the ground is an unsolved problem.

    • @sousoulefou
      @sousoulefou 3 ปีที่แล้ว +1

      Yes ! snow simulation, and also water simulation. This can be great.

  • @BrodieEaton
    @BrodieEaton 3 ปีที่แล้ว +2

    7:00 this entire clip is just Sebastian flexing on us with his stunning backyard view.

  • @kazemizu6284
    @kazemizu6284 4 ปีที่แล้ว +240

    I love your coding adventures!
    I mean, I understand like, a fifth of what you say, because man am I bad at coding, but it's extremely enjoyable even for someone like me to see the project slowly taking shape :)
    Great work pal!
    Have a nice day :)

    • @committedcoder3352
      @committedcoder3352 4 ปีที่แล้ว +3

      Hey!! There is a website called Kattis that you can use to improve your programming skills, I definitely recommend it. Also will help with lateral thinking.

    • @kyu5882
      @kyu5882 4 ปีที่แล้ว

      @@committedcoder3352 ill try it

    • @SETHthegodofchaos
      @SETHthegodofchaos 4 ปีที่แล้ว +9

      To be fair, I dont think this has anything to do with "being bad at coding". Coding/Programming itself is accually quite easy. However, the context or problem and the required math and libraries probably makes this hard to understand and follow without any prior knowledge. Which is to be expected.

  • @anmaral-sharif1381
    @anmaral-sharif1381 4 ปีที่แล้ว +79

    Very good result, for performance optimization, you can relay on blue noise technique to decrease the number of samples without compromising visual fidelity.
    For your next coding adventure, I would suggest you to implement "Atmospheric Scattering". Since you already did a terrain generation, as well as cloud generation.
    Good luck

  • @InternetRob
    @InternetRob 4 ปีที่แล้ว

    BEAUTIFUL gameplay at 11:45, props to you. The atmosphere is incredible, wow.
    I've never had the chance to experience such tranquillity in a game.

  • @TheRABIDdude
    @TheRABIDdude 4 ปีที่แล้ว +1

    I love that you always include a quick first person tour of what you create at the end! Beautiful!

  • @oumaxclg3385
    @oumaxclg3385 4 ปีที่แล้ว +36

    Each time i see your coding adventures i just find it amazing... that looks awesome to fly in this wonderful clouds ! Congrats ! 😁

  • @_lukasoreo
    @_lukasoreo 4 ปีที่แล้ว +226

    Omg i almost understood 1% of what you've done.

    • @ploypoonyasiri1383
      @ploypoonyasiri1383 4 ปีที่แล้ว +2

      lol same.

    • @Animadvertens
      @Animadvertens 4 ปีที่แล้ว

      I know, right?!

    • @paulvinova
      @paulvinova 4 ปีที่แล้ว +6

      Go to Google and type in 'C# docs tutorial'. Same with TH-cam, and you'll find a series of tutorials showing you how to programme in C#, and when you get a base underatanding (this takes time) you can play with Unity for free, which also has free tutorials on how to C# code with Unity.

    • @anandsuralkar2947
      @anandsuralkar2947 4 ปีที่แล้ว

      Lol

    • @cutliss
      @cutliss 4 ปีที่แล้ว +1

      @@paulvinova thx!

  • @flatthreee
    @flatthreee 3 ปีที่แล้ว +5

    Just seeing the noise diagram he made at the beginning and realizing it was also a voronoi diagram blew my mind

  • @sawyerlouise1767
    @sawyerlouise1767 3 ปีที่แล้ว +4

    Use the noise map for the terrain on a map to control the density and height of clouds so you end up with those clouds formations over mountains

  • @grftaNitro
    @grftaNitro 4 ปีที่แล้ว +56

    Holy... this looks complicated, good work!

  • @garyrandomvids2098
    @garyrandomvids2098 4 ปีที่แล้ว +76

    next video:
    Coding Adventure: Universe
    Hey, last month I was studying how the universe formed together, so I decided to make one on my quantum computer, check it out

    • @YyoavV
      @YyoavV 4 ปีที่แล้ว +1

      lol

  • @cristianator93
    @cristianator93 4 ปีที่แล้ว

    I discovered your channel today and I'm amazed. You are professor material, the way you explain and visualize things for us makes it pretty easy to follow. Your editing also helps a lot. Keep it going!

  • @carlost.9233
    @carlost.9233 4 ปีที่แล้ว

    This is absolutely amazing. I especially appreciate that you post the resources that you have found. Please keep doing that, as they seem very helpful, and I may use them in the future myself.

  • @NathanielJohns1258
    @NathanielJohns1258 4 ปีที่แล้ว +15

    I applaud all of the work you put into these videos and the end result always amazes me. Keep it up, please!

  • @sixshotsniper3095
    @sixshotsniper3095 4 ปีที่แล้ว +7

    That looks AMAZING
    That final shot of you drifting through the clouds literally was so peaceful I think it lowered my heart rate.

  • @feha92
    @feha92 4 ปีที่แล้ว +64

    Seeing how a slider were used to move the clouds, I started wondering about maybe doing the cloud-generating algorithm not in 2d as initially explained, not in 3d as it moved to later, but in 4d.
    So points are randomly distributed as before, but this time instead of vec2 or vec, it would be vec4(x,y,z,w), and then for each possible point (still vec4) in structure the distance to closest point is encoded like before. But when rendering, only a 3d box is rendered as before (lock the w-value), and as time passes the box is replaced by "moving" through the fourth dimension. This should make the clouds morph in a continuous manner, never going discontinuous, although might look a bit odd for clouds as they might "morph" into existence where it looked to be relatively empty, or out of existence where it was dense (as if water condenses and evaporates out of thin air).

    • @SirMonkeybutt10
      @SirMonkeybutt10 4 ปีที่แล้ว +7

      This is actually a really out of the box good idea, did you come up with this or did you see this done somewhere (no offense)

    • @feha92
      @feha92 4 ปีที่แล้ว +13

      @@SirMonkeybutt10 I thought of it myself, and I realized later that its actually a bad idea for clouds (technically, I realized it halfway into writing it, as the last note shows, but by then I had already invested effort in writing it). Granted, the idea is sound if you want a continuous morphing geometry, but that is decidedly _not_ how clouds move irl :p
      I also have no idea how it would actually look, as you would either have 4-dimensional triangles that would somehow need to be rendered, or be treating the fourth component as solely a time-axis (and in that case need to re-generate the geometry each step in time).

    • @TestSubject06
      @TestSubject06 3 ปีที่แล้ว +2

      @@feha92 The clouds aren't using geometry here though.

    • @feha92
      @feha92 3 ปีที่แล้ว +3

      @@TestSubject06 this is a bit of a necro, so my memory is probably wrong. But was this video not about using cubemarching over 3d noise to generate geometry enclosing volumes where the noise passed a certain threshold? And then using this geometry/mesh to render "clouds"?

    • @cozinoda
      @cozinoda 3 ปีที่แล้ว +9

      This is actually how many graphics softwares evolve noise so that it smoothly changes to a different look, though I'm impressed you came up with it on your own.

  • @aqwcom
    @aqwcom 4 ปีที่แล้ว +1

    This channel is better than Unity premium. Period.

  • @xvnexus8814
    @xvnexus8814 4 ปีที่แล้ว +192

    ".. I set about implementing this in code" *shows him typing random stuff with his pinky and thumb*

    • @akaHarvesteR
      @akaHarvesteR 4 ปีที่แล้ว +15

      Well how else are you going to keep the right hand free for pressing backspace until you get the characters you need?

    • @dfnkt
      @dfnkt 4 ปีที่แล้ว +3

      Wait, how do you type?

  • @liampeck24
    @liampeck24 4 ปีที่แล้ว +9

    That is honestly one of the most amazing projects I've seen, especially rendered in real time! Love your videos!

  • @SnutiHQ
    @SnutiHQ 4 ปีที่แล้ว +1

    This entire process was mesmerizing! 😍 Learned a lot by seeing your approach to problem solving, amazing work. 💪

  • @davidmonroy2509
    @davidmonroy2509 4 ปีที่แล้ว +25

    This is so technically impressive its mind blowing.

  • @ADunwoody0403
    @ADunwoody0403 4 ปีที่แล้ว +14

    Absolutely brilliant! I've been wanting to do my own ray marching cloud shader for many months now ever since I was blown away by Red Dead Redemption 2's clouds. This is a great guide to get me started :D. I'm very curious to see how you tackle the performance limitations.
    Love the videos Sebastian, your style is phenomenal, keep it up. Nice to see a fellow South African producing such quality content.

  • @HitchHawk
    @HitchHawk 4 ปีที่แล้ว +7

    You're making me want to start doing coding projects again! I love your stuff its always really inspirational, and interesting!

  • @jumpingjoy7689
    @jumpingjoy7689 3 ปีที่แล้ว +1

    seb lague: made an atmosphere, clouds, ray marcher, boids, terrain generation, ecosystem, procedural planets, path finding...
    me: cant stop a cube from falling through the ground

  • @mysporelo
    @mysporelo 4 ปีที่แล้ว

    Duuuudeeeee so simple and so far so much things you can do with this simulator! Really love the series, the patience, the voice, and the project!!! Looking forward to see how it goes! Keep up this good work! Shared again of course 😊

  • @TheLeontheking
    @TheLeontheking 4 ปีที่แล้ว +4

    Beautiful! With this rich set of parameters, a game could really implement a fluid weather-system. Just imagine, standing at some exposed are, when suddenly the sky starts turning black.

  • @ThaRemo
    @ThaRemo 4 ปีที่แล้ว +3

    Now I want to work on cloud generation myself again, I've also have had that idea in mind for years every time I see them. Nice to see you overcame the hurdle of getting started. Thanks for sharing, it looks great!

  • @walavouchey
    @walavouchey 4 ปีที่แล้ว

    Just discovered this channel from this video. I gotta say - the topics covered, explanations and presentation are bloody amazing. I'll be sticking around

  • @Glyn-Leine
    @Glyn-Leine 4 ปีที่แล้ว

    Sebastian you are a blessing! i'm currently in a game dev education and a lot of my fellow programmers follow your videos for inspirations and guidance for how to tackle and implement such features!

  • @blackdragoncool
    @blackdragoncool 4 ปีที่แล้ว +8

    Really nice results especially considering the equally beautiful explanations, thank you :)

  • @boggeshzahim3713
    @boggeshzahim3713 4 ปีที่แล้ว +12

    I said "YAY!" out loud when I saw that you had uploaded a new video

  • @raulsantandertirado4400
    @raulsantandertirado4400 4 ปีที่แล้ว +1

    Sebastian, I just wanted to say that I love your work. Thank you. Seeing that airplane fly gave me some feels. Your work is inspiring.

  • @niklas2810
    @niklas2810 4 ปีที่แล้ว

    Your coding adventures are always so inspiring, thank you for your research & work!

  • @chad-wyck
    @chad-wyck 4 ปีที่แล้ว +5

    You're fucking awesome, the way you breakdown these videos is so perfect. Great work.

  • @seanfitz1234
    @seanfitz1234 4 ปีที่แล้ว +6

    I'd love to see them react to terrain or other colliders. to get a 'clouds rolling over a mountain' effect.

  • @codestrudel
    @codestrudel ปีที่แล้ว +2

    This is just amazing. I am impressed by your talent to observe nature and reproduce it in code. Your are truly the Bob Ross of Computer Science. Much love from Germany and thank you for your outstanding and calming content.

  • @OriFrish
    @OriFrish 4 ปีที่แล้ว

    You make it look so simple, and yet, to understand what should be the correct mathematical algorithms and how to implement them... Requires a genius mind. Absolutely stunning, well done!

  • @ltd5352
    @ltd5352 4 ปีที่แล้ว +76

    Instructions unclear: class 5 hurricane crashed my pc

    • @josephhacker6508
      @josephhacker6508 4 ปีที่แล้ว +2

      I hate it when that happens

    • @willmungas8964
      @willmungas8964 3 ปีที่แล้ว

      @@josephhacker6508 "I hate it when he does that"

  • @dankings5326
    @dankings5326 3 ปีที่แล้ว +10

    Basically creates MS Flight Sim 2020 in his spare time "Well that's all I have for now" 😐😐😐

  • @goozey2544
    @goozey2544 4 ปีที่แล้ว +2

    Can't believe one man is capable of so much detail, great job!

  • @Askerad
    @Askerad 4 ปีที่แล้ว +25

    oh YES. now thats something i wanted to see :D

  • @robloxsans7915
    @robloxsans7915 4 ปีที่แล้ว +8

    idk programming so idk why this is in my recommended...
    i still watched the entire video..

  • @PolyRocketMatt
    @PolyRocketMatt หลายเดือนก่อน +1

    Coming back to this video after 4 years, I was laughing at the complicated math equations at around 0:35. Four years later and I'm doing my master thesis on the topic, knowing damn well each of those equations... Just funny how time can change your perspective on certain things

  • @xTwisteDx
    @xTwisteDx 4 ปีที่แล้ว +2

    As a programmer myself, I found this to be highly educational. I'm not a game dev, solely work on Mobile Applications and Software, I now understand why TF graphics cards have to work so insanely hard. That's impressive and I've often considered making something of the sort myself, but with rain and collision on the particles. Kudo's to you earned a sub.

  • @World_Theory
    @World_Theory 4 ปีที่แล้ว +4

    I … had my doubts about the realism of this ‘distance from a point’ thing, but the end result look pretty good.

  • @MaximQuantum
    @MaximQuantum 4 ปีที่แล้ว +3

    The result was so good, I thought the thumbnail was clickbate!

  • @BDSmithTrucking
    @BDSmithTrucking 4 ปีที่แล้ว

    Your videos are always intriguing and that plane part at the end was so relaxing. And the cloud break was a nice touch too lol

  • @DrPsychotic
    @DrPsychotic ปีที่แล้ว +2

    wow those clouds are amazing, like youve literally made them perfect

  • @xtc_w
    @xtc_w 4 ปีที่แล้ว +8

    This looks great! However, with clouds they actually also obscure light. Maybe in a future video you could try to make these clouds cast shadows?
    Not important, but would be an interesting challenge for sure.

  • @petertom2904
    @petertom2904 4 ปีที่แล้ว +6

    You are a genius, love the video

  • @jadonut249
    @jadonut249 4 ปีที่แล้ว

    This is one of the most inspirational coding videos I've seen. Great work Sebastian!

  • @user-uc9vv4ey2v
    @user-uc9vv4ey2v 3 ปีที่แล้ว

    These videos are super interesting and extremely comfortable to watch. Keep up the fantastic work!

  • @silvertheelf
    @silvertheelf 4 ปีที่แล้ว +4

    11:50
    Idk why the scene looks like something out of the mountains of madness if it was a movie.
    Know what, I’m gonna take it all and use it to design my own clouds, and I will have terrain generated by a hydraulic system, I will have animals that will live in an advanced ecosystem... but they can also fall off the world because I just want to see things falling... and I will use boids for herds and flocks of animals.

  • @emberdrops3892
    @emberdrops3892 4 ปีที่แล้ว +38

    "Obviously, there's still so much more to do! "
    **By the time, he created a superior version of Microsoft's flight sim, from scratch, in one week or so**

    • @gnupfo
      @gnupfo 4 ปีที่แล้ว +5

      The flight sim he made is not:
      -superior to Microsoft's: it has a very limited area, only one plane which only has one function, very monotonous terrain, etc.
      -from scratch (he said he took a premade plane model and controller from the internet and he used his own premade terrain generation)
      It does have amazing visuals though, on which an asthetics-based (rather than function-based) sim could work on.

    • @Nicolai0Nerland
      @Nicolai0Nerland 4 ปีที่แล้ว +11

      @@gnupfo You must be fun at parties.

    • @emberdrops3892
      @emberdrops3892 4 ปีที่แล้ว +2

      @@gnupfo I meant it as a joke XD Although I think the clouds actually surpass the ones of micr. flight sim (Yes, I do know that the graphic power needed is too much to integrate into a flight sim) have nice day or should I say, cheers

  • @laubblaeser_
    @laubblaeser_ 4 ปีที่แล้ว

    Detail Noise Scale and Weight really made the clouds shine! Awesome work, keep it up :)

  • @subhamkesh6086
    @subhamkesh6086 2 ปีที่แล้ว

    I found this channel yesterday and now I am becoming a dedicated fan. Wow.....

  • @SevenFunFacts
    @SevenFunFacts 4 ปีที่แล้ว +21

    Saw Sebastian's codes
    Me: hey i know some of those words meaning

  • @640kiboughttobeenough
    @640kiboughttobeenough 4 ปีที่แล้ว +16

    I really like these Coding Adventures. It's interesting and fun. Unfortunately I'm not a C# programmer so I don't understand some parts. (I'm a C programmer.)

    • @elektra81516
      @elektra81516 4 ปีที่แล้ว +1

      It doesnt take too long to figure out, unity itself has some great official tutorials on getting started with the language

    • @640kiboughttobeenough
      @640kiboughttobeenough 4 ปีที่แล้ว +1

      @@elektra81516 Yeah. The basic logic is similar, except C# has quite a few more functions already made for you.

    • @elektra81516
      @elektra81516 4 ปีที่แล้ว +1

      @@640kiboughttobeenough C# is designed for performance and rapid speed writing, i moved over too it after using Java for a long time

    • @640kiboughttobeenough
      @640kiboughttobeenough 4 ปีที่แล้ว

      @@elektra81516 If you're a Java programmer, yes, it's easy to switch to it. It has better performance than Java due to using a compiler rather than an interpreter. I don't know where I could C#, so I don't really know much. Though, I haven't seen any C# compilers for Linux either.

    • @laurencef8535
      @laurencef8535 4 ปีที่แล้ว

      Is C object originated? Ive never used it and ive always wondered how it relates. Im a WPF and C# programmer so ive never some across it

  • @drinnerd8532
    @drinnerd8532 4 ปีที่แล้ว

    ...and their PERFECT! FANTASTIC JOB, Sebastian Lague!!!

  • @lionelpro7139
    @lionelpro7139 4 ปีที่แล้ว

    Hi Sebastian,
    I just stumbled on your video and I'm really impressed ! I am myself a Unity developper and I find that you've made an awesome job !

  • @realcolby
    @realcolby 3 ปีที่แล้ว +8

    1:37 did anyone else’s brain decide that was a bunch of maggots

    • @edwardkim5678
      @edwardkim5678 3 ปีที่แล้ว

      Why. I can't unsee it now

    • @DoorknobPlus
      @DoorknobPlus 3 ปีที่แล้ว

      thanks you so much i cant unsee it :)

  • @felixhill5595
    @felixhill5595 2 ปีที่แล้ว +7

    Performance idea: when calculating the brightness for a pixel, you might be able to cast every other ray normally, but when you cast the remaining rays you might interpolate the light data from the surrounding properly calculated rays to approximate the light data for the current ray.

  • @khymaaren
    @khymaaren 4 ปีที่แล้ว

    I don't know a thing about coding, I practically didn't understand anything you said, but the ending segment has a vibe that speaks to me. The clouds look amazing.

  • @BabosCsaba
    @BabosCsaba 4 ปีที่แล้ว

    My mind is blown completely now. Love your videos, and creativity!

  • @JimNichols
    @JimNichols 4 ปีที่แล้ว +4

    "Messed around till I got what I wanted as a result " said every good coder ever..... bravo the clouds at the end were amazing. Coding sure has changed since the PDP-1170 with the Hazeltine 1500 monitor. ... I will leave that there to tell my age.... lol

  • @matheuscirillo36
    @matheuscirillo36 4 ปีที่แล้ว +7

    Are you planning on adding collisions to create effects like 6:55?

  • @cineblazer
    @cineblazer 4 ปีที่แล้ว +2

    I love these videos so so so much. I was never interested in game development at all until I started watching them. Now I'm very strongly considering downloading Unity and trying it out. I know it's a lot of work, and that these videos are just the highlights, but man, this is inspiring!

    • @SebastianLague
      @SebastianLague  4 ปีที่แล้ว +1

      Go for it, it's a lot of fun! Happy to hear you've been enjoying the videos :)

  • @Sky-iv8zm
    @Sky-iv8zm 2 ปีที่แล้ว +1

    One of your coolest videos. Another interesting graphics idea are Shadows. You can get really deep with that stuff. Shadow techniques/algos to create nice realistic soft shadows, others to capture contact shadows (small shadows not picked up by normal shadowmap techniques) and so on. It would be really interesting and unique look especially with your amazing style of videos. Also...
    would be cool if you do this stuff in URP, since the built-in/legacy render pipeline is in fix-mode only, the main render pipelines are URP/HDRP now.
    URP considered the replacement for built-in and main render pipeline now.

  • @AlesonTalis
    @AlesonTalis 4 ปีที่แล้ว +7

    One day I'll be good with coding like this guy. "God bless you..."