How To Create a Wind-Driven Shader Animation in Godot 4

Поділитися
Вставка
  • Опубліковано 25 січ 2025

КОМЕНТАРІ • 59

  • @so_easy23
    @so_easy23 7 місяців тому +8

    this is great...now to sync it with the foliage wind and rope wind

  • @nyitdom
    @nyitdom 7 місяців тому +5

    Here before this gets viral. Gotta save this video for later.

    • @DisplacedFikaDev
      @DisplacedFikaDev  7 місяців тому

      Thank you! I hope you find the video helpful when you come back to it :)

  • @saintadel8902
    @saintadel8902 7 місяців тому +5

    Great tutorial my man! You have earned yourself a subscriber

  • @lorenzvo5284
    @lorenzvo5284 7 місяців тому +10

    I think It would be cool to add a globally positioned scrolling noise texture so it looks as if the wind is moving through the scenes in gusts

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

      Great suggestion! A globally positioned scrolling noise texture to simulate wind gusts would definitely be a great addition. Hopefully, I can incorporate more of those ideas in the future :)

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

    Thanks for sharing! ^^

  • @godofdream9112
    @godofdream9112 4 дні тому

    I used Godot in 2018... What's now possible was unthinkable back then...😊

  • @yvanvan3729
    @yvanvan3729 7 місяців тому +1

    Great tutorial.
    Awesome work. Thanks you for sharing your knowledge with the Godot Community.
    Have a wonderful day.

    • @DisplacedFikaDev
      @DisplacedFikaDev  7 місяців тому +1

      Thank you! I'm glad you enjoyed it. The Godot community is fantastic, and I'm grateful to be part of such a supportive community. Have a great day!

  • @americoperez810
    @americoperez810 7 місяців тому +1

    Subscribed. Looking forward to seeing more of your cool content on shaders

    • @DisplacedFikaDev
      @DisplacedFikaDev  7 місяців тому

      Thanks for subscribing! More shader content is definitely coming :)

  • @yapp2yapp2
    @yapp2yapp2 4 місяці тому

    amazing tutorial, i learned so much. thank you. hope for more videos in the future. lovr you!

    • @DisplacedFikaDev
      @DisplacedFikaDev  4 місяці тому

      Thank you so much! I'm really glad you found it helpful :) I’m working on a new shader video and hope to finish it up soon. I really appreciate the love and support!

  • @beanieteamie7435
    @beanieteamie7435 7 місяців тому

    Thanks a lot for the great tutorial! Your voice is very cute btw :D

    • @DisplacedFikaDev
      @DisplacedFikaDev  7 місяців тому

      Haha, thanks! I'm happy you enjoyed the tutorial :)

  • @ItzVic
    @ItzVic 7 місяців тому +1

    truly a high quality video, subscribed

    • @DisplacedFikaDev
      @DisplacedFikaDev  7 місяців тому +1

      I'm glad you liked it, and thanks for subscribing :)

  • @diogosoares6092
    @diogosoares6092 7 місяців тому +1

    Awesome video! Thanks for the content!

    • @DisplacedFikaDev
      @DisplacedFikaDev  7 місяців тому

      Thanks for the kind words! I'm glad you found it useful! :)

  • @NewSchattenRayquaza
    @NewSchattenRayquaza 7 місяців тому

    Thank you so much for sharing this!

  • @a_shmiggy
    @a_shmiggy 6 місяців тому

    Very nice, high quality tutorial! looking forward to your next videos.

    • @DisplacedFikaDev
      @DisplacedFikaDev  6 місяців тому

      Thank you, I'm glad you enjoyed it! I'm working on a few more videos and hope to finish them soon :)

    • @a_shmiggy
      @a_shmiggy 6 місяців тому

      Awesome! Can't wait 😁

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

    Great ! 😮

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

    Add micro UV displacement on too

  • @njdarda
    @njdarda 7 місяців тому

    fantastic tutorial. looks great and way more performant than for example softbody.

  • @nue_hazel
    @nue_hazel 7 місяців тому +1

    Thanks !

  • @MadManTnT
    @MadManTnT 7 місяців тому +1

    great video.

  • @dbatdev
    @dbatdev 6 місяців тому

    Excellent!

  • @BKD639
    @BKD639 7 місяців тому +1

    Amazing

  • @snatts
    @snatts 7 місяців тому +12

    good quality godot video and no comment? nah, I'll fix it

    • @DisplacedFikaDev
      @DisplacedFikaDev  7 місяців тому +1

      Thank you for the support! I'm glad you like the video :)

  • @theman7050
    @theman7050 7 місяців тому +1

    When you do a world to local on wind direction, so it gets local relative to what point? Why cant it stay in world space like light direction? Thanks. Maybe make a little video about spaces? I find them very confusing.😊

    • @DisplacedFikaDev
      @DisplacedFikaDev  7 місяців тому +1

      I agree, different spaces can be very confusing! And I could definitely have spent some more time explaining it better. The vertex shader works in the object's local space. If we applied our wind direction directly, it would rotate as the object rotates in the world. My reasoning was that I wanted to apply the effect in the local space, so I transformed the direction using the inverse model matrix. This way, the wind direction stays consistent in the world regardless of the object's orientation. Great idea on making a video on different spaces! I will add it to my list of to-do videos. Hopefully, I can do that one in the future :)

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

      @@DisplacedFikaDev Thank you so much for taking out the time to explain. I get part of it now. Got to dig in and experiment further. :D

    • @DisplacedFikaDev
      @DisplacedFikaDev  7 місяців тому +1

      @@theman7050 Awesome, I'm glad I could help a bit! For sure, shaders is all about experimenting and discovering new things. Feel free to share if you create something cool with shaders. I'm always interested in seeing what others come up with! :)

    • @theman7050
      @theman7050 7 місяців тому

      ​@@DisplacedFikaDevyou know I kind of figured it out!
      I work with glsl and exprimented on 2 planes, one being rotated via JS before sending over pos to shader. So it was easier to go world to local by just:
      (vec4(uWindDir, 1.0) * modelMatrix).xyz;
      Because my webgl libraries supply just the model, view and projection matrices and not their inverses. Infact, it's not even needed in glsl shader code, so instead of:
      modelMatrix * pos (local to world)
      You invert the multiplication as:
      pos * modelMatrix 😅
      Thanks a lot man!!

  • @waterfill7925
    @waterfill7925 6 місяців тому +1

    hello! This shader is very good! Thanks so much!! However, I have a problem and I spent all day trying to fix it, I'm not very experienced in programming, but I wanted to add a leaf texture that used alpha to disappear the edges and only the leaf appears and not the entire mesh! I tried everything but I couldn't, do you know how I could change this code to work?

    • @DisplacedFikaDev
      @DisplacedFikaDev  6 місяців тому +1

      Hello there! Yes, we can definitely enable transparency. For this example I will assume you have your alpha in the albedo texture. We only need to make some minor changes in the fragment shader.
      First, we change the albedo sampling to a vec4 to include the alpha channel
      "vec4 albedo = texture(albedo_texture, texture_uv);"
      Then we change "ALBEDO = albedo.rgb;" and add "ALPHA = albedo.a;" This way, we sample the albedo from the RGB channels and use the alpha channel for transparency.
      Also, I recommend looking up the "alpha scissor mode" as it can help with performance and sorting issues, especially when working with a lot of foliage. I hope this helps! :)

    • @waterfill7925
      @waterfill7925 6 місяців тому

      @@DisplacedFikaDev Hi, thanks for the reply! I had done this before! But it's showing the same problem, the leaves look the way I want, but they lose their shade and the trunk also loses its shade and I can see inside it, what is causing this problem? Without using the shader, the shadows work normally. When delet ALPHA= albedo.a; back to normal but without alpha for leaves

    • @DisplacedFikaDev
      @DisplacedFikaDev  6 місяців тому +1

      @@waterfill7925 Hey! It sounds like there are some depth sorting issues. You could try adding depth_prepass_alpha to your render mode:
      "render_mode depth_prepass_alpha;"
      That should fix the shadows and depth sorting issues. Alternatively, alpha_scissor should also be able to handle shadows and sorting :)

    • @waterfill7925
      @waterfill7925 6 місяців тому

      @@DisplacedFikaDev hey thanks so much! I fixed with others renders mode!! I need now ajust the leaves xD they are coming out of the trunk

  • @sliceofanime8614
    @sliceofanime8614 7 місяців тому

    Oh, it's Gaddo tutorial.

  • @bixbite2
    @bixbite2 7 місяців тому

    do you think this shader could work well on a tree? or do you suggest a different way of making a tree waver a little on the wind?

    • @DisplacedFikaDev
      @DisplacedFikaDev  7 місяців тому +1

      It depends on what you're aiming to achieve. If you're looking for a subtle amount of sway or a more stylized look, adapting techniques similar to this shader could work well for a tree. Though, if you want more realistic movement, then you'd probably need to build a more complex shader.

    • @bixbite2
      @bixbite2 7 місяців тому

      @@DisplacedFikaDev thanks, i made some progress in my project using your tips, i just didnt really understand the part where u made it so that the rope didnt move, did you use the shadow mesh?

    • @DisplacedFikaDev
      @DisplacedFikaDev  6 місяців тому

      @@bixbite2 I used vertex color, which I painted in Blender, to drive the effect. Anything that has the value 0.0 (black) is not affected by the shader, while anything that has the value 1.0 (white) is fully affected. This allows me to control how much each part of the object should move. For the rope, I painted some parts black so they remain stationary.

  • @flynsarmy
    @flynsarmy 2 місяці тому

    What's your export workflow for this? When I have a material on my mesh in Blender and export, Godot doesn't detect the vertex colours. When I remove all materials from my mesh and export from Blender, Godot picks up the colours fine, but I then have no material and need to manually add one on the Godot-side (also Blender side now has no material which makes working on my mesh harder)!

    • @DisplacedFikaDev
      @DisplacedFikaDev  2 місяці тому +1

      Hello there! What works for me when exporting from Blender 4.2, in GLB/GLTF export settings, under Data > Mesh > Vertex Color, set "Use Vertex Color" to Active. The default is usually set to Material, which, as I understand it, only exports the vertex color if it's actively used in the material. So setting it to Active will ensure both color and materials are exported. Hope this helps! :)

    • @flynsarmy
      @flynsarmy 2 місяці тому

      @DisplacedFikaDev Worked like a charm. Thanks!