Excellent tutorial. Well-explained and the effect is perfect. Also love how customizable you made this shader, many other tutorials end up with a similar looking effect, but with no customization in the shader or script. Thank you for sharing and teaching us!
Could you do a shader video where you make the leafs move in the direction that the player does when he moves past them? A great example for what I mean is Ori (I've seen other games do this too). Great video btw. I had been looking for something like this for a while!
As there is no Vector1 anymore i had to use Vector2 in many situations. The main difference is that you have to use another Split after using Power. But you have to do it to make it work.
I've encountered a problem with this shader. You can´t move the sprites on the Z axis at all, and I want to be able to do so as I have camera in perspective and not in ortographic. I tried removing the position, split and vector 2 nodes connecting to the tiling and offset, removing the transform, and changing the position from absolute world to object. that worked for a single object, but when you add two with the same material and shader they snap back to 0 on the z axis for some reason. any idea on how to fix this?
@@jorgeponce5147 this shader was based off the vertex displacement shader from Unity's Lost Crypt project. I realized this channel gets a lot of things from other people. The shader Unity created worked fine for me.
Good tutorial, but i experienced a problem with which my sprite with this shader is far away from its pivot, in top right corner, also sprite disappears at all when my camera does not see the pivot of the object with shader, someone knows how to fix this? P.S. all the values are like in the end of the video
It does function. But you have a big limit that I encounter. The Shader will only transform the four vertex on an sprite. One vertex four each corner. So it can look wierd or "low-poly", cause there are no more vertex to smooth the motion out.
I fixed the problem with the shader where it wouldn't allow you to move the objects on the Z axis. To fix it, first, I connected the position node (setting it to object) directly to the tiling and offset node, without spliting it. Then, I connected the multiply node directly to the add node near the master, and connected the add node directly to the vertex position, removing the transfom node. Finally, I set the position node connected to the add node to object. Now, you can have sprites on a 3D environment and have parallax. Hope this helps someone out :) Edit: there are still issues with it. Although sprites can me moved on the z axis, some snap the 0 coordinate for some reason. Hmmm
@@BinaryLunar the solution is not perfect, there are still issues with it. I also noticed that you tried to simply the shader from the Lost Crypt example unity proyect, I was also looking at it to see if how they did it, but surprisingly they have the positions set to absolute world too, so I don't really know what the problem is exactly.
I'm late to the party, I hope I get an answer: I used this in a 2d top down game, some grasses disappear permanently or disappears when my character is moving around, any idea why? Update and new problem: Grass disappearing solved: Changed giving output from Add to Sprite Unlit Master Node and remove the Transform Node between it. New Problem: Some grasses flicker on x-axis when character moves up and down
It happened to me too, my only way to fix it was just deleting the shader from my objects, but i makes me angry cause my game is more beauty with the wind effect :(
Totally perfect tutorial, thanks a lot! Will use this a lot for all planets that have organic plants and things in Space Chef. I’m thinking if there is a way to get a random pixel of the sprite or something to set the amount, so two sprites with the same material still look different. And how does this work with gpu instancing? Is it one draw call for all with the same material?
I never used shaders before and this looks really cool. I followed everything along and double checked, however, it doesn't seem to work properly. It sways how it should, but: 1) on my sprites that have transparent background, suddenly it gets autofilled with some stretched pixel. 1) some objects just fly to the side somewhere, as in their position becomes extremely disordered. Anyone knows how to help? Edit: I figured one part out, I didnt' connect the alpha correctly. However, still having the issue where objects appear in weird places.
@@BinaryLunar Thanks dude! i did it with your tutorial! Now im trying to do When player hit grass, then this happens and ends... Can you do a tutorial for it if your free tho
is there a way to apply this to a tilemap? Im trying to use the shader for a tilemap (my tile texture is pitch black), and all im seeing is black squares waving, as my initial texture tiles had been either replaced with squares or distorted/stretched out to just be squares.
it is working as i can see it in the preview section where you attach all the nodes and i can see it moving in the preview area but as soon as I create the material apply the shader then apply the material to the sprite it turns grey. Any Ideas to fix this ?
Solved: For anyone in the future, my issue was the last node (Transform) going into the Vertex Position Master was set to "Object -> Object", when it should be "World -> Object"
Thanks for this tutorial! However, when I apply this to my grass sprite that has transparency, I get some hard edges in the distortion: imgur.com/a/RarewWB If I apply the shader to a fully opaque gradient sprite, these hard edges do not occur. Seems to have something to do with the vertices when rendering the sprite. Does anyone have any ideas on that?
@@Wolf-dz4fn Hey! Yes, you simply need to set the sprite's Mesh Type to Full Rect. I wrote an interactive version of this shader , where I also describe this: github.com/Dirty-Paws-Studio/Unity-Snippets/tree/master/2D/Dynamic%20Foliage
@@McKruemelkatze hm that didnt work sadly, imgur.com/a/XXcDDzJ the first picture is one of the leaf layers without the shader. second one is with the shader and the third is when i change the mesh type to full rect
@@Wolf-dz4fn Hmm, that looks like the UVs are messed up somehow. If you want, you can DM me on Discord: Kruemelkatze #2952. I'll gladly help you if I can and it's easier to solve it that way. :)
Thanks to Fabian for figuring out the problem. For people that encounter the same problem as me, you have to connect the A(1) dot from Sample Texture 2D (2:18 in video) to Fragment Alpha( 1) in the sprite unit master. In the video they used an older unity version so it didnt have that
@@BinaryLunar And if you want to be able to change from negative to positive in the inspector? how would you do it? Adding "One Minus" to this merely flips it, and I don´t want to create a completely separate shader with that minor change. I mean, you could always make the sprites/textures with the "Rigid" part on the bottom and then rotate it in the scene, but having a way to change the mask area would be better, possibly in all 360 directions. how would that be done?
📝 The Ultimate 2D & 3D Shader Graph VFX Unity Course on Udemy: www.udemy.com/course/the-ultimate-2d-3d-shader-graph-vfx-unity-course/ 🌎 Let us know what you think about this video, also feel free to chat with us on our Discord server :discord.com/invite/b6bXKSV ❤ Support us on Patreon www.patreon.com/BinaryLunar and gain access to all our tutorials projects. 📦 Check our Assets on Unity Assets Store: assetstore.unity.com/publishers/47136
Do you know if this shader would work with the Universal Rendering Pipeline lighting? I'm using 2D lighting in my game which requires a certain material, so I have to choose either Wind or Sprite-Lit-Default. I've tried applying multiple materials to the SpriteRenderer, but Unity won't allow it. I've looked everywhere to see if I could either combine materials or shaders to no avail. I know I could potentially combine two shaders to get the desired effect but I know nothing about them. Any help would be appreciated! Edit: Got it working! I changed the Material in the Graph Inspector to Sprite Lit! Thanks for the video!
Excellent tutorial. Well-explained and the effect is perfect. Also love how customizable you made this shader, many other tutorials end up with a similar looking effect, but with no customization in the shader or script. Thank you for sharing and teaching us!
You welcome!
Very helpful guys! With people like you the world is a bit better
It is surprising to see there are only 18k people who have watched this impeccable tutorial.. Great work! Love your tutorials. Subscribed now
Kind of you, thanks!
@@BinaryLunar Would you like to take a look at my question? Is this shader even usable for my case (2d top down game) ?
thanks for using a sprite whose borders are close to the object, it helped me a lot
Could you do a shader video where you make the leafs move in the direction that the player does when he moves past them? A great example for what I mean is Ori (I've seen other games do this too).
Great video btw. I had been looking for something like this for a while!
Really good tutorial, at first I thought it didn't work, but i adjusted some values and now it looks really cool! Well done!
You welcome!
First time I stopped a video so much to be able to follow it. Was my first time modifying shaders. It worked great. Thanks!!
You are ameazing. When i start searchig for something "How make ...... in Unity" - You already uploaded tutorial about that.
Wowee, this is exactly what I was looking for, thank you so much for making this!
Welcome aboard!
This was a really good tutorial. Thanks!
As there is no Vector1 anymore i had to use Vector2 in many situations. The main difference is that you have to use another Split after using Power. But you have to do it to make it work.
Thanks a lot! I tried to find this shader for a long time, and you helped me to create it
Awesome tutorial! Thanks, man!
Thanks for this - really good!
Amazing! Well done
There is absolutely nothing to see in the tutorial. Please make it even smaller. Great job!
I've encountered a problem with this shader. You can´t move the sprites on the Z axis at all, and I want to be able to do so as I have camera in perspective and not in ortographic. I tried removing the position, split and vector 2 nodes connecting to the tiling and offset, removing the transform, and changing the position from absolute world to object. that worked for a single object, but when you add two with the same material and shader they snap back to 0 on the z axis for some reason. any idea on how to fix this?
I have exactly the same problem. Could you solve it?
@@jorgeponce5147 this shader was based off the vertex displacement shader from Unity's Lost Crypt project. I realized this channel gets a lot of things from other people. The shader Unity created worked fine for me.
Learning a lot from your videos. Thanks so much!
thank you so much :)
Good tutorial, but i experienced a problem with which my sprite with this shader is far away from its pivot, in top right corner, also sprite disappears at all when my camera does not see the pivot of the object with shader, someone knows how to fix this? P.S. all the values are like in the end of the video
Helpful , much appreciated :D
does not work. Even with split, the z value still change and the sprite disappears from time to time...
It does function. But you have a big limit that I encounter. The Shader will only transform the four vertex on an sprite. One vertex four each corner. So it can look wierd or "low-poly", cause there are no more vertex to smooth the motion out.
I fixed the problem with the shader where it wouldn't allow you to move the objects on the Z axis.
To fix it, first, I connected the position node (setting it to object) directly to the tiling and offset node, without spliting it. Then, I connected the multiply node directly to the add node near the master, and connected the add node directly to the vertex position, removing the transfom node.
Finally, I set the position node connected to the add node to object.
Now, you can have sprites on a 3D environment and have parallax. Hope this helps someone out :)
Edit: there are still issues with it. Although sprites can me moved on the z axis, some snap the 0 coordinate for some reason. Hmmm
Thanks for sharing this solution.
@@BinaryLunar the solution is not perfect, there are still issues with it. I also noticed that you tried to simply the shader from the Lost Crypt example unity proyect, I was also looking at it to see if how they did it, but surprisingly they have the positions set to absolute world too, so I don't really know what the problem is exactly.
Thank you very very very much.
You are so so so welcome.
Thanks ! Great video
Fantastic!! i love your videos
We appreciate your kindness.
nice vid! thanks for the good explanations... (complexity level 2000)
I'm late to the party, I hope I get an answer:
I used this in a 2d top down game, some grasses disappear permanently or disappears when my character is moving around, any idea why?
Update and new problem:
Grass disappearing solved: Changed giving output from Add to Sprite Unlit Master Node and remove the Transform Node between it.
New Problem:
Some grasses flicker on x-axis when character moves up and down
It happened to me too, my only way to fix it was just deleting the shader from my objects, but i makes me angry cause my game is more beauty with the wind effect :(
I keep getting "Material does not have a _MainTex texture property. It is required for SpriteRenderer." I have followed everything exactly.
Same problem here. Did you happon to figure out the issue maybe?
@@TheCyrus1988 Yeah. You just need to hit save changes, or 'apply changes', something like that, for the shader you are working on.
@@westonhall9605 Tnx. I figured out at some point also, after xx time. :D
Anyways thank you for getting back at me. (y)
Thanks!!!
Thank you a million. !!!!!!!!!!!!!!!!!!!!!!
You welcome!
it was very helpful thanks a lot : )
can you pleeeeaseee make a video about grass move when the player steps on it?
How to make such a visual wind effect?
It is particle effect , you can download the project files and use that too
what a angel, tk u
10/10
👍🏻
Very nice
Totally perfect tutorial, thanks a lot! Will use this a lot for all planets that have organic plants and things in Space Chef. I’m thinking if there is a way to get a random pixel of the sprite or something to set the amount, so two sprites with the same material still look different. And how does this work with gpu instancing? Is it one draw call for all with the same material?
You welcome, we found solution here:
ua-cam.com/video/AbHTpZmaVpk/v-deo.html
I never used shaders before and this looks really cool. I followed everything along and double checked, however, it doesn't seem to work properly. It sways how it should, but:
1) on my sprites that have transparent background, suddenly it gets autofilled with some stretched pixel.
1) some objects just fly to the side somewhere, as in their position becomes extremely disordered.
Anyone knows how to help?
Edit: I figured one part out, I didnt' connect the alpha correctly. However, still having the issue where objects appear in weird places.
Amazing Thank You for making this video!!
One Question tho is there any way to make them bend if the player collides them?
Maybe try to create a code that set the wind parameters OnTiggerEnter2D then set them to 0 OnTriggerExit2D.
hello, can you help me inverse the influence mask so that the sprite stops moving at top and starts at bottom?
just use "One Minus" node to flip the mask
@@BinaryLunar Thank you very much, I'm trying to create interactable plants in 2d game and it was really helpful as first step.
@@lashaghotvadze5966 aweome, looking forward to see your 2D game
I have a question. Why unlit shader graph and not lit?
You can use lit of course, but then you need to use 2D lights to light the scene.
@@BinaryLunar Is there an easy way to toggle between lit/unlit after you've created the shader?
@@beri4138 yes just change the master node( for example if you on unlit, create master lit node, then set it as active then remove the unlit one)
@@BinaryLunar Thanks a lot! I had no idea about that.
@@BinaryLunar Thanks dude! i did it with your tutorial! Now im trying to do When player hit grass, then this happens and ends... Can you do a tutorial for it if your free tho
Amazing video! :D Could you have made an emission map for a specific leaf/object instead of using a gradient for the wind influence?
Is all of this made in a 2D project or 3D?
is there a way to apply this to a tilemap? Im trying to use the shader for a tilemap (my tile texture is pitch black), and all im seeing is black squares waving, as my initial texture tiles had been either replaced with squares or distorted/stretched out to just be squares.
thank you so much
You welcome.
Bro, how can I make white lines wind effect left from right as your video?
That is particle system.
@@BinaryLunar I tried but I couldn't do as left from right. Also, Did you use too many sprites or just have one?
Thank you :)
but can we make random seed node in shader graph such as not to create Wind1,2,3.... and do random seed in the global/exposed property?
Someone help pls, when i apply the final material to other objects , it takes the same image in all the objets applied, where am i doing wrong?T_T
I dont know why but my wind mask does no effect. I am sure it is connected it makes difference in the shader but not in sprite
Do you also have a video on how you made those air streams?
I copied everything from your video but when I apply the material to the relevant sprite it doesn't make my leaf move it just makes it grey.
it is working as i can see it in the preview section where you attach all the nodes and i can see it moving in the preview area but as soon as I create the material apply the shader then apply the material to the sprite it turns grey. Any Ideas to fix this ?
Hi, in the shader graph window, you have to press save asset on the top left. Hope it helps or maybe you found the solution already.
Does not work. My sprite just turns invisible, while preview looks fine.
Solved: For anyone in the future, my issue was the last node (Transform) going into the Vertex Position Master was set to "Object -> Object", when it should be "World -> Object"
How do you do the wind effect?
It is just particle system.
But z-pos, does't work.
Thanks for this tutorial! However, when I apply this to my grass sprite that has transparency, I get some hard edges in the distortion:
imgur.com/a/RarewWB
If I apply the shader to a fully opaque gradient sprite, these hard edges do not occur. Seems to have something to do with the vertices when rendering the sprite. Does anyone have any ideas on that?
Hi, did you find a fix for it? happens to me when i apply this to the leaves on my tree, it just blends them together
@@Wolf-dz4fn Hey! Yes, you simply need to set the sprite's Mesh Type to Full Rect. I wrote an interactive version of this shader , where I also describe this: github.com/Dirty-Paws-Studio/Unity-Snippets/tree/master/2D/Dynamic%20Foliage
@@McKruemelkatze hm that didnt work sadly, imgur.com/a/XXcDDzJ the first picture is one of the leaf layers without the shader. second one is with the shader and the third is when i change the mesh type to full rect
@@Wolf-dz4fn Hmm, that looks like the UVs are messed up somehow. If you want, you can DM me on Discord: Kruemelkatze
#2952.
I'll gladly help you if I can and it's easier to solve it that way. :)
Thanks to Fabian for figuring out the problem. For people that encounter the same problem as me, you have to connect the A(1) dot from Sample Texture 2D (2:18 in video) to Fragment Alpha( 1) in the sprite unit master. In the video they used an older unity version so it didnt have that
how do I make the top of the leaf steady?
You can use "One Minus" node to flip the mask that will make top steady and bottom move.
@@BinaryLunar thanks 😀
@@BinaryLunar Would Invert Colors work the same way?
@@BinaryLunar And if you want to be able to change from negative to positive in the inspector? how would you do it? Adding "One Minus" to this merely flips it, and I don´t want to create a completely separate shader with that minor change.
I mean, you could always make the sprites/textures with the "Rigid" part on the bottom and then rotate it in the scene, but having a way to change the mask area would be better, possibly in all 360 directions.
how would that be done?
@@BinaryLunar Where exactly should the "One Minus" node go? I've tried a few different places and keep breaking it lol
This one's hard to follow, you went way too fast on this tutorial unfortunately.
way to fast.
📝 The Ultimate 2D & 3D Shader Graph VFX Unity Course on Udemy: www.udemy.com/course/the-ultimate-2d-3d-shader-graph-vfx-unity-course/
🌎 Let us know what you think about this video, also feel free to chat with us on our Discord server :discord.com/invite/b6bXKSV
❤ Support us on Patreon www.patreon.com/BinaryLunar and gain access to all our tutorials projects.
📦 Check our Assets on Unity Assets Store: assetstore.unity.com/publishers/47136
Do you know if this shader would work with the Universal Rendering Pipeline lighting? I'm using 2D lighting in my game which requires a certain material, so I have to choose either Wind or Sprite-Lit-Default. I've tried applying multiple materials to the SpriteRenderer, but Unity won't allow it. I've looked everywhere to see if I could either combine materials or shaders to no avail. I know I could potentially combine two shaders to get the desired effect but I know nothing about them. Any help would be appreciated!
Edit: Got it working! I changed the Material in the Graph Inspector to Sprite Lit! Thanks for the video!
Thanks!