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

Поделиться
HTML-код
  • Опубликовано: 4 сен 2024

Комментарии • 53

  • @lorenzvo5284
    @lorenzvo5284 2 месяца назад +7

    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  2 месяца назад +2

      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 :)

  • @so_easy23
    @so_easy23 2 месяца назад +5

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

  • @nyitdom
    @nyitdom 2 месяца назад +4

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

    • @DisplacedFikaDev
      @DisplacedFikaDev  2 месяца назад

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

  • @saintadel8902
    @saintadel8902 2 месяца назад +5

    Great tutorial my man! You have earned yourself a subscriber

  • @timmygilbert4102
    @timmygilbert4102 2 месяца назад +3

    Add micro UV displacement on too

  • @snatts
    @snatts 2 месяца назад +12

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

    • @DisplacedFikaDev
      @DisplacedFikaDev  2 месяца назад +1

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

  • @akirastudios1406
    @akirastudios1406 2 месяца назад +2

    Thanks for sharing! ^^

  • @yvanvan3729
    @yvanvan3729 2 месяца назад +1

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

    • @DisplacedFikaDev
      @DisplacedFikaDev  2 месяца назад +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!

  • @warunanirmal9537
    @warunanirmal9537 2 месяца назад +2

    Great ! 😮

  • @a_shmiggy
    @a_shmiggy 2 месяца назад

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

    • @DisplacedFikaDev
      @DisplacedFikaDev  Месяц назад

      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 Месяц назад

      Awesome! Can't wait 😁

  • @njdarda
    @njdarda 2 месяца назад

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

  • @diogosoares6092
    @diogosoares6092 2 месяца назад +1

    Awesome video! Thanks for the content!

    • @DisplacedFikaDev
      @DisplacedFikaDev  2 месяца назад

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

  • @americoperez810
    @americoperez810 2 месяца назад +1

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

    • @DisplacedFikaDev
      @DisplacedFikaDev  2 месяца назад

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

  • @ItzVic
    @ItzVic 2 месяца назад +1

    truly a high quality video, subscribed

    • @DisplacedFikaDev
      @DisplacedFikaDev  2 месяца назад +1

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

  • @NewSchattenRayquaza
    @NewSchattenRayquaza 2 месяца назад

    Thank you so much for sharing this!

  • @beanieteamie7435
    @beanieteamie7435 2 месяца назад

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

    • @DisplacedFikaDev
      @DisplacedFikaDev  2 месяца назад

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

  • @nue_hazel
    @nue_hazel 2 месяца назад +1

    Thanks !

  • @dbatdev
    @dbatdev 2 месяца назад

    Excellent!

  • @MadManTnT
    @MadManTnT 2 месяца назад +1

    great video.

  • @BKD639
    @BKD639 2 месяца назад +1

    Amazing

  • @sliceofanime8614
    @sliceofanime8614 2 месяца назад

    Oh, it's Gaddo tutorial.

  • @theman7050
    @theman7050 2 месяца назад +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  2 месяца назад +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 2 месяца назад +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  2 месяца назад +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 2 месяца назад

      ​@@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 2 месяца назад +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  2 месяца назад +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 2 месяца назад

      @@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  2 месяца назад +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 2 месяца назад

      @@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

  • @bixbite2
    @bixbite2 2 месяца назад

    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  2 месяца назад +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 2 месяца назад

      @@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  2 месяца назад

      @@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.