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 :)
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!
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.😊
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 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! :)
@@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!!
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?
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! :)
@@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
@@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 :)
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.
@@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?
@@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.
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)!
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! :)
this is great...now to sync it with the foliage wind and rope wind
Here before this gets viral. Gotta save this video for later.
Thank you! I hope you find the video helpful when you come back to it :)
Great tutorial my man! You have earned yourself a subscriber
Thank you, I appreciate the support! :)
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
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 :)
Thanks for sharing! ^^
Thanks for watching :)
I used Godot in 2018... What's now possible was unthinkable back then...😊
Great tutorial.
Awesome work. Thanks you for sharing your knowledge with the Godot Community.
Have a wonderful day.
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!
Subscribed. Looking forward to seeing more of your cool content on shaders
Thanks for subscribing! More shader content is definitely coming :)
amazing tutorial, i learned so much. thank you. hope for more videos in the future. lovr you!
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!
Thanks a lot for the great tutorial! Your voice is very cute btw :D
Haha, thanks! I'm happy you enjoyed the tutorial :)
truly a high quality video, subscribed
I'm glad you liked it, and thanks for subscribing :)
Awesome video! Thanks for the content!
Thanks for the kind words! I'm glad you found it useful! :)
Thank you so much for sharing this!
Glad you found it useful :)
Very nice, high quality tutorial! looking forward to your next videos.
Thank you, I'm glad you enjoyed it! I'm working on a few more videos and hope to finish them soon :)
Awesome! Can't wait 😁
Great ! 😮
Thank you!
Add micro UV displacement on too
fantastic tutorial. looks great and way more performant than for example softbody.
Awesome! Glad you found it useful :)
Thanks !
Thanks for watching :)
great video.
Thank you, I'm glad you liked it :)
Excellent!
Amazing
Thanks! Glad you liked it!
good quality godot video and no comment? nah, I'll fix it
Thank you for the support! I'm glad you like the video :)
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.😊
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 :)
@@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
@@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! :)
@@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!!
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?
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! :)
@@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
@@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 :)
@@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
Oh, it's Gaddo tutorial.
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?
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.
@@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?
@@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.
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)!
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! :)
@DisplacedFikaDev Worked like a charm. Thanks!