Simple sky shader with clouds Godot 4 tutorial

Поділитися
Вставка
  • Опубліковано 13 вер 2023
  • -------------------------------------------------------------------------------
    Equipment:
    Keyboard: amzn.to/3vpsLOU
    Microphone: amzn.to/3tsq2nz
    Monitor: amzn.to/3ttsIBl
    [Advertising] All links in this section are affiliate links. If you purchase through one of these links, I will receive a commission. Nothing changes for you when shopping.
    ------------------------------------------------------------------------------- Subscribe us here: / @perfectionh_
    Instagram: / perfectionh_yt
    Music:
    Lo-Fi Fashion Chill Hip Hop by Alex-Productions | / @alexproductionsnocopy...
    Music promoted by www.chosic.com/free-music/all/
    Creative Commons CC BY 3.0
    creativecommons.org/licenses/...
    Sweet Dreams by BatchBug | / batchbug
    Music promoted by www.chosic.com/free-music/all/
    Creative Commons Attribution 3.0 Unported License
    creativecommons.org/licenses/...
    Morning Routine by Ghostrifter Official | / ghostrifter-official
    Music promoted by www.chosic.com/free-music/all/
    Creative Commons CC BY-SA 3.0
    creativecommons.org/licenses/...
    Song: Outlandr - Overcome [Arcade Release]
    Music provided by NoCopyrightSounds
    Free Download/Stream: ncs.io/ Watch: ncs.lnk.to/AT/youtube
  • Фільми й анімація

КОМЕНТАРІ • 25

  • @tannerevans1511
    @tannerevans1511 9 місяців тому +15

    Absolutely stunning results, thanks for sharing. For anyone else that had a hard time reading the code (especially differentiating + and *), here is the snippet I have that is working:
    vec2 sky_uv = EYEDIR.xz / EYEDIR.y;
    vec3 clouds = texture(cloud_texture, (sky_uv*cloud_scale) + (TIME*cloud_direction*cloud_speed*.01)).rgb - texture(cloud_texture2, (sky_uv * cloud_scale) + (TIME * cloud_direction2 * cloud_speed2*.01)).rgb;
    clouds = clouds - smoothstep(0.0, EYEDIR.y, cloud_distance);
    clouds = clamp(clouds,0,1);
    sky += clouds;
    I made one change compared to the video, and that was multiplying the cloud_speed by .01. Without this addition, I could not get a small enough float in the inspector. It kept resetting to 0 instead.

    • @PerfectioNH_
      @PerfectioNH_  9 місяців тому +3

      Thanks for this comment. It’s good to have people like you in the community :D I’m the guy who’s responsible for the blender content here on this channel, don’t know why my mate doesn’t answer comments xD

    • @victoriaboschetti9143
      @victoriaboschetti9143 7 місяців тому +2

      Hello everything is fine? Thank you very much for making this excerpt available!
      I'm on Godot 4.2.1 and line 86 (clouds = clouds - smoothstep(0.0, EYEDIR.y, cloud_distance);) gives the following error "Invalid arguments to operator '-': 'vec3, vec2' "
      Could you tell me how I can solve it?
      Thanks in advance!

    • @victoriaboschetti9143
      @victoriaboschetti9143 7 місяців тому +4

      Hello, it's me again, I managed to understand what happened, I hadn't been able to see very well at first, but "+ TIME" was used in the line and not "* TIME", so mine was exactly like in the video, everything works, Here's the code in case anyone needs it:
      vec2 sky_uv = EYEDIR.xz / EYEDIR.y;
      vec3 clouds = texture(cloud_texture, sky_uv * cloud_scale + TIME * cloud_direction * cloud_speed).rgb - texture(cloud_texture2, sky_uv * cloud_scale + TIME * cloud_direction2 * cloud_speed2).rgb;
      clouds = clouds - smoothstep(0.0, EYEDIR.y, cloud_distance);
      clouds = clamp(clouds, 0.0, 1.0);
      sky += clouds;
      And thank you for the video, it helped me a lot!

  • @xthejetx
    @xthejetx 2 дні тому

    This is a beautiful foundation for building many interesting skyboxes, you can use a mix of textures and noise even, lots of ways to go from here. Shader code intimidates me immensely so without this I would have likely not bothered. This is pretty basic math at least, that I can understand lol

  • @alondaar
    @alondaar 10 місяців тому

    Fabulous, I was just looking into how to get an animated sky shader like this!

    • @alondaar
      @alondaar 10 місяців тому

      As a follow-up, I achieved my first sky shader using this tutorial. I wanted a sea of dark, rolling clouds and the result is nice, but I have a lot to learn.
      A tip for the video, even when you are zoomed in on the shader code, it is very difficult to see the difference between +/* (even at 1080p video). But I was still able to figure it out. Thanks!

  • @mdesign_official
    @mdesign_official 7 місяців тому +3

    Cool idea, but how I can make them voluminous?

  • @Gangster53_YT
    @Gangster53_YT 16 днів тому

    Is it possible to make this with a physical sky? I really liked this but i need to use physical sky.

  • @DeltaNemesis
    @DeltaNemesis 10 місяців тому +1

    can I please get the code line for clouds? Can't really see it thanks to youtube compression.

    • @PerfectioNH_
      @PerfectioNH_  10 місяців тому

      Yes, I can do that. In 3 days I am back home.

    • @merlinsquest3524
      @merlinsquest3524 10 місяців тому +1

      code please. I'm also having a hard time reading it

    • @merlinsquest3524
      @merlinsquest3524 10 місяців тому

      nvm thanks i figured it out.. THANKS FOR THE AWESOME VIDEO

  • @spielville5087
    @spielville5087 10 місяців тому

    Have you tried this out with a day/night cycle?

  • @JeysonArdila
    @JeysonArdila 6 місяців тому +2

    This does not work for me using Godot 4.2
    If anyone else gets this: UNKOWN IDENTIFIER IN EXPRESION 'sky' error
    you can use COLOR.rgb instead
    Here is the code
    // NOTE: Shader automatically converted from Godot Engine 4.2.1.stable's PanoramaSkyMaterial.
    shader_type sky;
    uniform sampler2D source_panorama : filter_nearest, source_color, hint_default_black;
    uniform sampler2D cloud_texture;
    uniform sampler2D cloud_texture2;
    uniform vec2 cloud_direction;
    uniform vec2 cloud_direction2;
    uniform vec2 cloud_scale;
    uniform float cloud_distance;
    uniform float cloud_speed;
    uniform float cloud_speed2;
    void sky() {
    // Fragment shader code
    vec2 sky_uv = EYEDIR.xz / EYEDIR.y;
    vec3 clouds = texture(cloud_texture, (sky_uv * cloud_scale) + (TIME * cloud_direction * cloud_speed * 0.01)).rgb - texture(cloud_texture2, (sky_uv * cloud_scale) + (TIME * cloud_direction2 * cloud_speed2 * 0.01)).rgb;
    clouds = clouds - smoothstep(0.0, EYEDIR.y, cloud_distance);
    clouds = clamp(clouds, 0.0, 1.0);
    COLOR.rgb += clouds;
    COLOR.rgb *= texture(source_panorama, SKY_COORDS).rgb;
    }

  • @stephanrobertgames
    @stephanrobertgames 10 місяців тому

    Mega Hilfreich danke :-) aber ich empfehle dir im Speziellen für Tutorials die Software immer auf englisch zu stellen ;-)

    • @PerfectioNH_
      @PerfectioNH_  10 місяців тому

      Stimmt, gar nicht daran gedacht, vielen Dank für den Tipp :)

  • @maxouloik8906
    @maxouloik8906 9 місяців тому

    3:56 you type cloud_speed instead of cloud_speed2

  • @jeffreystephens2658
    @jeffreystephens2658 3 місяці тому

    WE CAN NOT HEAR YOU OVER THE MUSIC

    • @GuyMakeGame
      @GuyMakeGame 20 днів тому

      bro hes not even speaking 💀💀💀

  • @lyreads3228
    @lyreads3228 9 місяців тому

    😅 i cant see

    • @lyreads3228
      @lyreads3228 9 місяців тому

      Can you provide a description for the script

    • @tannerevans1511
      @tannerevans1511 9 місяців тому

      @@lyreads3228 I just commented the snippet that I got working above. Had the same issue