🌐 Have you found the videos Helpful and Valuable? ❤️ Get my Course unitycodemonkey.com/coursebuilderdefender.php or Support on Patreon www.patreon.com/unitycodemonkey
@@Wildjustwild69 I've covered several character controllers previously, they all use a simple float to manage the moveSpeed ruclips.net/video/Bf_5qIt9Gr8/видео.html
@PueKio That's a very specific genre, you're better off breaking it down into it's base mechanics and look for tutorials on that. I've covered some Pathfinding you can use, a bunch of UI elements, Tooltips, etc.
💬 Have you ever made a Wind Shader effect? Once you start thinking in terms of textures/gradient/noise everything becomes much easier to do in Shader Graph. Stay tuned for the awesome Construction Shader I made for the course, it really looks awesome and it's quite simple to do!
This was one of the most well-explained video on shaders I've seen yet. I think you went over the details of every single node you added, in a well paced manner. Thanks for the video, I will be checking out your udemy course, I enjoyed your teaching style.
This was one of the most useful tutorials I've seen in ~3 years of indie development with Unity. Seriously thank you for making this, for your instruction style, and for offering such a useful guide on YT!!
You are the chosen one. You are the next brackeys. Joking, you are not a replacement, you have been making those wonderful video and more for long time, and for this thank you. Just don't let us alone like brackeys ;)
If anyone is having trouble with their sprite having a wierd shape, I have a solution. I wanted to apply this effect to my pixel art grass but when I apllied the material, my sprite turned into a wierd blob. To solve this, I went to sprite editor, in the upper left corner, selected "custom outline" and edited the outline of my sprite to my liking (with pixel art, you should turn on the "snap" feature ON as well (upper left corner)) Hope this helps someone, I struggled for quiet some time and it would be a shame not to use such a good shader and a tutorial :DDDD. PS: thanks for the wonderful tutorial, it helped me understand shaders better
I was following so well! Then at 10:30 - Add this, multiply gradient by output of that, then add it up there. *Head explodes* Haha I LOVE your videos though! Keep doing what you are doing it helps in game dev so much to have people like you around!!
The tricky thing with making shaders is thinking in terms of number operations. By multiplying you are essentially using the gradient as a mask that is applied to the noise which means the noise only gets applied according to the mask. Then add that output just the same as before. It would be easier to understand if Shader graph showed the Noise as a flat texture rather than a sphere.
@@CodeMonkeyUnity Ah that definitely makes sense! And by the way I should mention, to be fair I have not properly tackled shadergraph or tried it in my game yet, so to jump into this tutorial was already not the perfect way to go for me :) If I'm going to be serious about using this, I would do as you advised and start off with your other tutorial on the matter first! Great vid!
for some reason this video made my google speaker start listening around the 2:00 mark and it started playing Evanescence - Bring Me To Life lolol. Great vids btw
Thanks for this excellent and concise explanation! That course of yours is very tempting, I may have to pick it up today :) I'm one month into my Unity dev journey so your work is invaluable, thank you!
Ok I've found an issue at 10:40 the technique you use to 'pin' the bottom when sprites are in an atlas, which they almost always will be for a real-world project. Do you have a fix for this please?
Everything is at the highest level! By the way, it would be interesting to look at the mini course on "2D platformer" (slightly similar to the genre of "metroidvania"), if you ever want to do it )
Hey, another wonderful tutorial as always. Might want to fiddle some more with the render settings. There's a lot of distortion that happens around anything that's moving. Around your mouse, and around the character.
Thanks a lot for this well explained tutorial. This works well with standalone sprites but not with sprite atlas because the UVs rate being taken from the sprite atlas instead of the sliced sprite. Is there a way to make the shader to use the sliced sprite UV space instead? Thanks.
Hi. Thanks for this video. I was succesful in getting the shader to work in the Shader graph and the editor; however, when I go inot play mode. The bottom is moving. It is almost like that last change of the shadder with the UV/Split/Preview was not added. Any ideas? I did make sure I saved and reloaded the material onto the sprite.
I just realized what the issue was. I was using a sprite from a Sprite Atlas. So I guess the UVs are different when you use an atlas. I tested with a simple stand alone sprite and the effect was consistent between the Shader Graph Preview/Editor and the Player. Thanks again for the video!
Great job on the video, I've been intimidated by the shader graph for a while now and this helped a lot. I'm going to check out your other shader graph tuts. Also, subbed :)
I know you can use Bools in Shader Graph, but Is it possible to use a Switch or Enum? For instance, if a wanted a dropdown menu to allow movement on "Only X" or "Only Y" but not having multiple properties that I have to toggle on and off, which can get hectic if there are many options in parallel.
Hi, your tutorial is great, but I have a question when I connect the MainTexture (asset selected) to Sample texture 2D and from Sample texture 2D to Fragment, the Main review does not show the materials that I select for MainTexture 2D. Could I ask where my problem is?
Do you see the preview on the Sample Texture node? Where did you assign the texture? On the Inspector or on the Shader Graph itself? The Shader Graph only assigns the defaults, it will be overriden by what is on the inspector
Getting some weird results when adding more than one game object with the same material. Seems to work perfectly fine with one. Googling around seems to indicate this is related to dynamic batching, although I can't find any option to disable it with URP shaders. Any ideas? Unity version 2022.2.18f1.
Hi. Followed the tutorial, but when I add this material with shader to more than 1 game object, all stops working. It works/animates fine when attached to 1 object only. In the shader main preview it looks great, but not when attached to more than 1 object. then it just does not animate at all. Suggestions?
At the start when you link the texture to the colour (MainTex), I am following along in the same way, but in my preview as well as the scene/game, it is still showing pink colour which started to show as soon as I applied the material. Please Help
When I link the texture to colour in Maintex at the start, some sort of highlighted aura has appeared of the green colour around my sprite. I am using the asset sprite provided in the link in the description. Please Help
I seem to be getting some warnings on this shader that say "implicit truncation of vector type" D3D 342, 699, 1052. Did I mess up a step or is it normal to have these warnings in the inspector?
Followed the steps correctly and when I apply it to the game object it does what its intended but the position does not show correctly on the scene? Any ideas?
Hey Code Monkey, great tutorial. Just one question that I think would really add to the life of the plants; how would I create a random variable for the speed/intensity? That way it's not always "on" but the foliage would slow down at times, then pick up again, so the wind in the environment looks like it's actually moving through the space. Thanks in advance!
@@CodeMonkeyUnity Thanks for the quick response. That worked exactly the way I wanted it to. One more question, the UV of some of my sprites (from a sprite sheet) is off, so the mask doesn't affect some of my foliage at the base, but others it does. Any idea how to adjust the UV of specific sprites?
There is a problem that if my sprite is transparent when the parts move left and right, the opacity stacks. Some parts become different color and it looks a bit ugly. Is there a way to not add the transparency no matter how many layers are on top of each other? Thanks
I have a question, do you think it's possible to make the shader react to the player's position? To make a sawing effect for a 2D game. I think I can send this value by script (as a Vector1 value) and maybe increase the amplitude of the oscillation when the distance is shorter but I'm not sure how to make it oscillating more in a direction (opposite to the player's pos). Is it possible to set a kind of offset to the oscillation? Thank you!
Awesome shader. The only problem I have with it is that as the effect is applied, the pixels in the sprite are being warped. I assume there's a way to line up the vertex movement with the pixel resolution? Any ideas? That way as the sprite is bent the pixels size is kept more intact... Edit: I added a pixelation effect to this same shader and it seems to have helped keep the integrity of the pixels a bit better. My parameters ended up being Windintensity 0.25, Windspeed 1, Pixelation 65. Might help...
Thank you very much for the excellent video, I have a question: As a beginner, I have seen people use Animation (Animator component) before. So when to use Shader Effects instead? Which one is better? Again, I am a beginner, so I am sorry if my question is dumb. Thank you very much ❤
Animations are static, they always play the exact same animation. Whereas shader effects can use noise to make them more dynamic. They both have their use cases, really depends on the scenario.
Also I wanted to ask. I have problems with sorting sprites when they overlap having my camera in perspective mode. Unity sorts by the pivot point of the sprite, but when I move my camera sideways they start to overlap each other (example: tree leaves between them in a tree) I can't use sorting layers because layers override the perspective of the camera if a character is behind or in front of another sprite in another layer. In your perspective example with sprites, how do you manage sorting?
If you use a perspective camera then you shouldn't touch the Sorting order, it should automatically be sorted based on distance to the camera. If you modify the Sorting order that's when you get those issues.
Did anyone else encountered this issue: when the sprite (bush, grass etc) is moved around, the animation is sped up significantly? For example, when i apply this shader to an object in the foreground, the speed increases when my character moves, but when it stops, the vegetation's speed returns to the assigned values.
@@CodeMonkeyUnity So, after many tests, this issue appears only on orthographic view and parallax script applied on each layer group. Soon as i switched to perspective and removed the parallax script, the issue disappeared. Still not sure what caused this, since i tried many parallax scripts, and some were even from what unity packages had to offer.
Don't know if i am wrong, could it be, if the sprite is not a single file but from a tilesheet file, that it doesnt work as intended? i have the feeling the bottom is moving but in your shader you made it so the bottom should stay on its position, but you work with a single sprite file. could that be a problem when using a tilesheet? If yes, how would you fix that instead of making every sprite into one single file? thank you
Yes since the shader uses the texture position if you use a tilesheet it does break it One solution would be to have another tilesheet texture just in black and white gradient for each tile, then use that second texture as the position input instead of the uv position
@@CodeMonkeyUnity i just tested out of fun, to make the sprite a single file, but then add to a sprite atlas which is literally the same as the spritesheet and it moves on X again :-/ i read about FLIPBOOK node but that would of course only work with the original spritesheet itself i assume? because on sprite atlas you dont know where the position of your sprite will be etc.... :-/ so only solution would be to make single png files and NOT add them to a sprite atlas, lol :)
How did you achieved that blur at the top like depth of field with sprites? the sprite renderer doesn't write to Z so the depth of field effect doesn't know which sprites are near the camera and which are further away. Thanks, and awesome vids by the way, subscribed!
@@CodeMonkeyUnity This does not seem to work for me. My 3D cubes get more or less blurry depending on their position, but the sprites remain blurry no matter how close or far I place them in the scene. My camera is already set to perspective mode. Any idea what I might be doing wrong?
@@CodeMonkeyUnity I think I found the problem - the depth of field effect actually gets applied whenever a 3D object is at a point in 3D space, and that effect in turn also gets applied to the sprites sharing the same screen space as well. Once the plane is not rendered anymore all sprites are equally blurry.
Hmm if you use the Tilemap renderer then I don't think so since that one merges all the tiles into one mesh which means you can't use the mesh position to move the vertices
@@CodeMonkeyUnity That makes sense. I think I'm having a similar issue with using a texture atlas as well. The effect itself works great, but it looks like it's manipulating the vertices in relation to the entire atlas, not the individual slices. If that is the case, maybe this works best with individual textures? I'm new to Unity, so maybe I just need more experience with it, but it feels like it's better to not use texture atlases at all. There are cases where I can't select a slice as a texture, or (like with this) Unity doesn't treat slices as their own textures, even though I'm pretty sure it saves them as separate png files. Either way, I learned a lot from this. Your Ultimate Unity Overview has been very helpful too.
I am having an issue using this tutorial, when i move the camera around the sprite does glitch. Not sure why, i'm using the object position but somehow when moving around the "trees" start glitching like if it reset it's position or something.
Hi, I'm having a few problems with this. For some reason, it doesn't work with some of the sprites I have (which is very odd). I was able to get it working on some grass and tree sprites I have, but not on others. The second problem I'm facing is that I'm getting texture popping while moving the camera. The sprites appear when they're in the centre of the camera, but if they're on the edges they pop out. Is there a way to fix these problems?
These shader nodes are exploding so quickly in numbers. I think that's the price we have to pay for a kind of visual driven programming approach. Anyways - really good tutorial, thanks Code Monkey! I can see in your recording that you somehow managed to apply the Depth Of Field post processing effect to your 2D scene. I tried so too, but failed. Are you showing in your advertised course, how I have to build my whole scene to apply effects like this one? Or you maybe have another tutorial where this is explained? I would really appriciate having someone being able to explain, how to arrange my objects the right way to use such 3D-ish effects also in 2D.
My course is pure 2D so it doesn't have that effect, this scene is in 3D with flat sprites so I'm using the normal Depth of Field effect. I covered how to make custom post processing effects in another video and you could use that to make Depth of Field for 2D ruclips.net/video/77Lc43yTREo/видео.html
The 2d renderer doesn't appear in the shader menu, and I have everything necessary installed, including all the 2D packages and Universal RP. I'm using Unity 2020.3.4f1. Please help.
@@MasterofFire-sc3yn What do you mean by increase the UV? If you don't apply that gradient mask then the effect is applied to the whole sprite. If you want to apply only to a specific part of a tree sprite you can make a custom texture mask instead of a simple gradient.
I followed this to the dot, but alas for some reason game and scene do not render the Y vertex lock, so it's just a waving flag. Honestly, at a loss what is wrong here. Been trying to check my camera and settings, but it's just puzzling.
Are you using a spritesheet? Make sure you apply it to a simple solo sprite, otherwise the bottom won't match and everything will wave. The shader shouldn't have anything to do with the camera, the Y position is the base of the sprite and not screen space
@@CodeMonkeyUnity You're correct! Hooray, they were in an atlas. But It seems like I've also sneakily added them to another atlas. So when I was removing them in and out of first one, they didn't work correctly XD. Dunno if this should be used sparingly tho, considering they will need to be drawn induvidually now? But, it looks cool! Although in the light of the recent news, it's a small win. Either way, thank you for this awesome shader! It was a great learning experience :D
I'm following the steps but I'm getting the error "material does not have _MainTex texture property" in the sprite renderer. I have _MainTex in the reference field in the shader. Therefore my object is just blacked out. Anyone know why?
The response has been great so yup definitely planning on doing more. It's great to be able to make some full length projects rather than just quick videos.
@@CodeMonkeyUnity I loved it . It is not only amazingly well explained but also the game is ACTUALLY NICE !!!! A great idea and well executed. I would love another course on showing more with shaders and some VFX for example like a mini rpg magic game (since those are very rough to make) But I trust that whatever you make will be excellent content with much to learn and of course , WORTH IT !!!! I highly appreciate you . Keep Crushing CODE monkey!
🌐 Have you found the videos Helpful and Valuable?
❤️ Get my Course unitycodemonkey.com/coursebuilderdefender.php or Support on Patreon www.patreon.com/unitycodemonkey
Can you teach us how to make a horse or a bike that you can climb over and use to increase your speed pls
@@Wildjustwild69
I've covered several character controllers previously, they all use a simple float to manage the moveSpeed ruclips.net/video/Bf_5qIt9Gr8/видео.html
I meant something like riding a horse in 2d games
@@Wildjustwild69 The character controller doesn't care what visual is applied to it. You can move a Horse or a Character or a Brick.
@PueKio That's a very specific genre, you're better off breaking it down into it's base mechanics and look for tutorials on that. I've covered some Pathfinding you can use, a bunch of UI elements, Tooltips, etc.
This video really blew me away.
shut
I see what you did there
💬 Have you ever made a Wind Shader effect?
Once you start thinking in terms of textures/gradient/noise everything becomes much easier to do in Shader Graph.
Stay tuned for the awesome Construction Shader I made for the course, it really looks awesome and it's quite simple to do!
Can you teach us how to make a horse or a bike that you can climb over and use to increase your speed pls
I've covered several character controllers previously, they all use a simple float to manage the moveSpeed ruclips.net/video/Bf_5qIt9Gr8/видео.html
This was one of the most well-explained video on shaders I've seen yet. I think you went over the details of every single node you added, in a well paced manner. Thanks for the video, I will be checking out your udemy course, I enjoyed your teaching style.
Thanks! I'm glad you enjoyed it!
I will carry this shader with me for the rest of my life
This was one of the most useful tutorials I've seen in ~3 years of indie development with Unity. Seriously thank you for making this, for your instruction style, and for offering such a useful guide on YT!!
Thanks! I'm glad you found it useful!
You are the chosen one. You are the next brackeys.
Joking, you are not a replacement, you have been making those wonderful video and more for long time, and for this thank you. Just don't let us alone like brackeys ;)
If anyone is having trouble with their sprite having a wierd shape, I have a solution.
I wanted to apply this effect to my pixel art grass but when I apllied the material, my sprite turned into a wierd blob. To solve this, I went to sprite editor, in the upper left corner, selected "custom outline" and edited the outline of my sprite to my liking (with pixel art, you should turn on the "snap" feature ON as well (upper left corner)) Hope this
helps someone, I struggled for quiet some time and it would be a shame not to use such a good shader and a tutorial :DDDD.
PS: thanks for the wonderful tutorial, it helped me understand shaders better
oh my god thankyou so much
I was following so well! Then at 10:30 - Add this, multiply gradient by output of that, then add it up there. *Head explodes* Haha I LOVE your videos though! Keep doing what you are doing it helps in game dev so much to have people like you around!!
The tricky thing with making shaders is thinking in terms of number operations. By multiplying you are essentially using the gradient as a mask that is applied to the noise which means the noise only gets applied according to the mask. Then add that output just the same as before.
It would be easier to understand if Shader graph showed the Noise as a flat texture rather than a sphere.
@@CodeMonkeyUnity Ah that definitely makes sense! And by the way I should mention, to be fair I have not properly tackled shadergraph or tried it in my game yet, so to jump into this tutorial was already not the perfect way to go for me :) If I'm going to be serious about using this, I would do as you advised and start off with your other tutorial on the matter first! Great vid!
I can always learn something new from this channel. Thanks a lot.
I cannot thank you enough, just made my game look 100x better
Well explained! Short and precise
Wow! Exactly what I needed. Absolutely brilliant how you did this. Thanks!!!
Fantastic tutorial, really well explained, and the perfect simple shader for building this effect and many others. Thanks!
This is so cool!! Thank you for sharing with us
for some reason this video made my google speaker start listening around the 2:00 mark and it started playing Evanescence - Bring Me To Life lolol. Great vids btw
Really? that's odd, great song though!
Thanks for this excellent and concise explanation! That course of yours is very tempting, I may have to pick it up today :) I'm one month into my Unity dev journey so your work is invaluable, thank you!
Welp, just bought it!
I hope you like it!
Ok I've found an issue at 10:40 the technique you use to 'pin' the bottom when sprites are in an atlas, which they almost always will be for a real-world project. Do you have a fix for this please?
This shader looks really solid! I will try to make one with your tutorial. Thanks!
Everything is at the highest level! By the way, it would be interesting to look at the mini course on "2D platformer" (slightly similar to the genre of "metroidvania"), if you ever want to do it )
Concise & informative! You're a credit to gameDevs everywhere mon ami ^-^
Hey, another wonderful tutorial as always.
Might want to fiddle some more with the render settings. There's a lot of distortion that happens around anything that's moving. Around your mouse, and around the character.
Distortion? You mean the Depth of Field effect?
Very helpful Thank you!
That is the same as in the Course !! :) Pretty cool
YOU ARE THE GOAT!
Awesome, thanks a million
Thanks a lot for this well explained tutorial. This works well with standalone sprites but not with sprite atlas because the UVs rate being taken from the sprite atlas instead of the sliced sprite. Is there a way to make the shader to use the sliced sprite UV space instead?
Thanks.
Nice video, as always, very usefull.
Thank you very much!
I have a question why sometime the wild shaders are moving super slower, so it can't even see ?
I have a problem moving the grass around. The shader seems to speed up when moving. any fixes?
I have a question: how do you get the background of your sprite to remain constant? It currently distorts the grass shader underneath. Thanks!
What do you mean by background of the sprite? A Sprite itself doesn't have any foreground or background.
Just 30 min ago brackeys quit youtube are you sad,i cried 😭
But I think I will be fine as I have your tutorials .
Yeah that was definitely a surprise!
He's been doing tutorials for 8 years so it seems like he's ready to try something new.
Hi. Thanks for this video. I was succesful in getting the shader to work in the Shader graph and the editor; however, when I go inot play mode. The bottom is moving. It is almost like that last change of the shadder with the UV/Split/Preview was not added. Any ideas? I did make sure I saved and reloaded the material onto the sprite.
I just realized what the issue was. I was using a sprite from a Sprite Atlas. So I guess the UVs are different when you use an atlas. I tested with a simple stand alone sprite and the effect was consistent between the Shader Graph Preview/Editor and the Player.
Thanks again for the video!
Great job on the video, I've been intimidated by the shader graph for a while now and this helped a lot. I'm going to check out your other shader graph tuts. Also, subbed :)
I'm glad the video helped you! Thanks!
Very good tutorial. Thank you.
I feel like a superman after this
Thank you.... Thank you.... Thank you very very much... I tryed many shaders but Only by you I understand how object position Stop in x,z pos
Shaders terrify me, but this video was incredible. Thanks!
heh they are indeed tricky! Shader Graph is what helped me lose fear of shaders
amazing
You are best!
you are God Of Unity 2D
Do you have an update of this now that Unity has updated the way they do shader graphs? Maybe in your course somewhere?
I believe the only difference is the alpha channel now being separate ruclips.net/video/azGMuP9ks8U/видео.html
Everything else should work the same
i am at 5:00 and my matirial is ony violet no matter what i do.
Can anyone help me?
On the Sprite is wirtten: _MainTex property needed, but i made that reference. Why is is not working?
Are you using URP or HDRP?
Did you name the Reference _MainTex? Reference is different from the name
@@CodeMonkeyUnity I have the Universal RP 10.3.1 Installed.
@@CodeMonkeyUnity If I create a new material on the shader it is automatically violet.
@@derpenz5376 same to me, have no solution
Fantastic. :)
I know you can use Bools in Shader Graph, but Is it possible to use a Switch or Enum? For instance, if a wanted a dropdown menu to allow movement on "Only X" or "Only Y" but not having multiple properties that I have to toggle on and off, which can get hectic if there are many options in parallel.
I dont think theres any built in support for Switch or Enum, you really have to do complex boolean logic yourself.
Hi, your tutorial is great, but I have a question when I connect the MainTexture (asset selected) to Sample texture 2D and from Sample texture 2D to Fragment, the Main review does not show the materials that I select for MainTexture 2D. Could I ask where my problem is?
Do you see the preview on the Sample Texture node? Where did you assign the texture? On the Inspector or on the Shader Graph itself? The Shader Graph only assigns the defaults, it will be overriden by what is on the inspector
@@CodeMonkeyUnity Thanks so much for the support. I did it.
Amazing
Getting some weird results when adding more than one game object with the same material. Seems to work perfectly fine with one. Googling around seems to indicate this is related to dynamic batching, although I can't find any option to disable it with URP shaders. Any ideas? Unity version 2022.2.18f1.
Reminds me of Blender, dear me this is like a node bomb!
Hi. Followed the tutorial, but when I add this material with shader to more than 1 game object, all stops working. It works/animates fine when attached to 1 object only. In the shader main preview it looks great, but not when attached to more than 1 object. then it just does not animate at all. Suggestions?
At the start when you link the texture to the colour (MainTex), I am following along in the same way, but in my preview as well as the scene/game, it is still showing pink colour which started to show as soon as I applied the material. Please Help
Nevermind, fixed it! Didn't add a universal render assest to the project settings in Graph and Quality
@@ayushjain1655 I'm having a similar issue, but I don't even see the Graph and Quality section in project settings. What Unity version were you using?
Hello, can you give me advice on how to make this grass shader interact with player (character)?
Simplest way is add a collider to the grass and identify if the player is near grass, then pass in a parameter to the shader
When I link the texture to colour in Maintex at the start, some sort of highlighted aura has appeared of the green colour around my sprite. I am using the asset sprite provided in the link in the description. Please Help
You are Awesome
how make tiling this shader for sprite sheet?
Local multiplayer tutorial pleeeeeaseee)
I seem to be getting some warnings on this shader that say "implicit truncation of vector type" D3D 342, 699, 1052. Did I mess up a step or is it normal to have these warnings in the inspector?
Followed the steps correctly and when I apply it to the game object it does what its intended but the position does not show correctly on the scene? Any ideas?
Hey Code Monkey, great tutorial. Just one question that I think would really add to the life of the plants; how would I create a random variable for the speed/intensity? That way it's not always "on" but the foliage would slow down at times, then pick up again, so the wind in the environment looks like it's actually moving through the space. Thanks in advance!
For randomness you use some kind of Noise node, also use a Time node to scroll through it. Then remap that noise to some kind of wind speed value.
@@CodeMonkeyUnity Thanks for the quick response. That worked exactly the way I wanted it to.
One more question, the UV of some of my sprites (from a sprite sheet) is off, so the mask doesn't affect some of my foliage at the base, but others it does. Any idea how to adjust the UV of specific sprites?
There is a problem that if my sprite is transparent when the parts move left and right, the opacity stacks. Some parts become different color and it looks a bit ugly. Is there a way to not add the transparency no matter how many layers are on top of each other? Thanks
I have a question, do you think it's possible to make the shader react to the player's position? To make a sawing effect for a 2D game. I think I can send this value by script (as a Vector1 value) and maybe increase the amplitude of the oscillation when the distance is shorter but I'm not sure how to make it oscillating more in a direction (opposite to the player's pos). Is it possible to set a kind of offset to the oscillation? Thank you!
Quick update: I have made it and it works really well!
@@thefrenchdev965 can u tell me how u did it, i am trying the same
@@nuclear-zone I use the space coordinates as a variable for the shader I have made.
Awesome shader. The only problem I have with it is that as the effect is applied, the pixels in the sprite are being warped. I assume there's a way to line up the vertex movement with the pixel resolution? Any ideas? That way as the sprite is bent the pixels size is kept more intact...
Edit: I added a pixelation effect to this same shader and it seems to have helped keep the integrity of the pixels a bit better. My parameters ended up being Windintensity 0.25, Windspeed 1, Pixelation 65. Might help...
Thank you very much for the excellent video,
I have a question: As a beginner, I have seen people use Animation (Animator component) before.
So when to use Shader Effects instead?
Which one is better?
Again, I am a beginner, so I am sorry if my question is dumb.
Thank you very much ❤
Animations are static, they always play the exact same animation. Whereas shader effects can use noise to make them more dynamic.
They both have their use cases, really depends on the scenario.
@@CodeMonkeyUnity Thank you for the clarifications ❤
Could you make a tutorial on bolt please because I don’t know what I’m really doing thank you
I made a Getting Started video for Bolt here ruclips.net/video/8y6akNTUt2Y/видео.html
Also I wanted to ask. I have problems with sorting sprites when they overlap having my camera in perspective mode. Unity sorts by the pivot point of the sprite, but when I move my camera sideways they start to overlap each other (example: tree leaves between them in a tree) I can't use sorting layers because layers override the perspective of the camera if a character is behind or in front of another sprite in another layer. In your perspective example with sprites, how do you manage sorting?
If you use a perspective camera then you shouldn't touch the Sorting order, it should automatically be sorted based on distance to the camera. If you modify the Sorting order that's when you get those issues.
Did anyone else encountered this issue: when the sprite (bush, grass etc) is moved around, the animation is sped up significantly? For example, when i apply this shader to an object in the foreground, the speed increases when my character moves, but when it stops, the vegetation's speed returns to the assigned values.
That's odd, the shader shouldn't care where the player/camera is, nothing in the shader is based on Screen Position
@@CodeMonkeyUnity So, after many tests, this issue appears only on orthographic view and parallax script applied on each layer group. Soon as i switched to perspective and removed the parallax script, the issue disappeared. Still not sure what caused this, since i tried many parallax scripts, and some were even from what unity packages had to offer.
Don't know if i am wrong, could it be, if the sprite is not a single file but from a tilesheet file, that it doesnt work as intended? i have the feeling the bottom is moving but in your shader you made it so the bottom should stay on its position, but you work with a single sprite file. could that be a problem when using a tilesheet? If yes, how would you fix that instead of making every sprite into one single file? thank you
i added my test sprite to a single png file and it worked, so i assume, tilesheet makes the problem :-/ how could that be fixed? :-)
Yes since the shader uses the texture position if you use a tilesheet it does break it
One solution would be to have another tilesheet texture just in black and white gradient for each tile, then use that second texture as the position input instead of the uv position
@@CodeMonkeyUnity i just tested out of fun, to make the sprite a single file, but then add to a sprite atlas which is literally the same as the spritesheet and it moves on X again :-/ i read about FLIPBOOK node but that would of course only work with the original spritesheet itself i assume? because on sprite atlas you dont know where the position of your sprite will be etc.... :-/ so only solution would be to make single png files and NOT add them to a sprite atlas, lol :)
For any reason, the 2d renderer menu doesn't appear in Create>Shader. Any idea why?
Loved your tuto, btw!
Do you have the Universal RP installed and the 2D Packages?
@@CodeMonkeyUnity Universal RP, 2d Animation, 2D Pixel Perfect, 2D PSD Importer, 2D Sprite, 2D SpriteShape and 2D Tilemap Editor. Just installed them and it doesn't appear yet.
@@LePetit2 i didnt have it, then i installed universal RP and now its showing. try to instal it again maybe
did you get the solution?
Its not connecting and showing "argument Null emExepsion: Value cannot be null " help
Use Debug.Log to find out what is null unitycodemonkey.com/video.php?v=5irv30-bTJw
How did you achieved that blur at the top like depth of field with sprites? the sprite renderer doesn't write to Z so the depth of field effect doesn't know which sprites are near the camera and which are further away. Thanks, and awesome vids by the way, subscribed!
It's the standard Post Processing depth of field.
They are 2D sprites but it's a normal 3D scene, they are placed further away from the camera.
@@CodeMonkeyUnity This does not seem to work for me. My 3D cubes get more or less blurry depending on their position, but the sprites remain blurry no matter how close or far I place them in the scene. My camera is already set to perspective mode. Any idea what I might be doing wrong?
@@CodeMonkeyUnity I think I found the problem - the depth of field effect actually gets applied whenever a 3D object is at a point in 3D space, and that effect in turn also gets applied to the sprites sharing the same screen space as well. Once the plane is not rendered anymore all sprites are equally blurry.
Could this work for grass on a tilemap as well?
Hmm if you use the Tilemap renderer then I don't think so since that one merges all the tiles into one mesh which means you can't use the mesh position to move the vertices
@@CodeMonkeyUnity That makes sense. I think I'm having a similar issue with using a texture atlas as well. The effect itself works great, but it looks like it's manipulating the vertices in relation to the entire atlas, not the individual slices.
If that is the case, maybe this works best with individual textures?
I'm new to Unity, so maybe I just need more experience with it, but it feels like it's better to not use texture atlases at all. There are cases where I can't select a slice as a texture, or (like with this) Unity doesn't treat slices as their own textures, even though I'm pretty sure it saves them as separate png files.
Either way, I learned a lot from this. Your Ultimate Unity Overview has been very helpful too.
How does it work in 3d? There is no 2d texture and as 3d texture Unity finds nothing. :(
I am having an issue using this tutorial, when i move the camera around the sprite does glitch. Not sure why, i'm using the object position but somehow when moving around the "trees" start glitching like if it reset it's position or something.
Enabling GPU instancing fixed it for me.
@@thewar4yourmind356 I don't see the option on my material
Hi, I'm having a few problems with this.
For some reason, it doesn't work with some of the sprites I have (which is very odd). I was able to get it working on some grass and tree sprites I have, but not on others.
The second problem I'm facing is that I'm getting texture popping while moving the camera. The sprites appear when they're in the centre of the camera, but if they're on the edges they pop out.
Is there a way to fix these problems?
@@UlarisBadler hi, I've got the same problem. Did you managed to solve it?
These shader nodes are exploding so quickly in numbers. I think that's the price we have to pay for a kind of visual driven programming approach. Anyways - really good tutorial, thanks Code Monkey! I can see in your recording that you somehow managed to apply the Depth Of Field post processing effect to your 2D scene. I tried so too, but failed. Are you showing in your advertised course, how I have to build my whole scene to apply effects like this one? Or you maybe have another tutorial where this is explained? I would really appriciate having someone being able to explain, how to arrange my objects the right way to use such 3D-ish effects also in 2D.
My course is pure 2D so it doesn't have that effect, this scene is in 3D with flat sprites so I'm using the normal Depth of Field effect.
I covered how to make custom post processing effects in another video and you could use that to make Depth of Field for 2D ruclips.net/video/77Lc43yTREo/видео.html
The 2d renderer doesn't appear in the shader menu, and I have everything necessary installed. I'm using Unity 2020.2.0f1
Do you have the Universal RP installed?
@@CodeMonkeyUnity Like I said, I have everything installed
@@Dannyxv8 did you get the soltuion?
can i do the same to the 3D grass?
Yup it should work exactly the same, as long as the grass has vertices it should work
The 2d renderer doesn't appear in the shader menu, and I have everything necessary installed, including all the 2D packages and Universal RP. I'm using Unity 2020.3.4f1. Please help.
If you're using Unity 2020 then it simply shows up as Sprite Lit or Sprite Unlit
How can I increase the UV effect so that I can use the effect for trees?
What do you mean by increase the UV effect? The UV of the texture isn't used for anything here.
@@CodeMonkeyUnity The UV that is set to Channel0 at 10:13 that is used to make the effect only happen on the top.
@@MasterofFire-sc3yn What do you mean by increase the UV? If you don't apply that gradient mask then the effect is applied to the whole sprite. If you want to apply only to a specific part of a tree sprite you can make a custom texture mask instead of a simple gradient.
Shader is working fine on 'Scene' mode but the color is black on the 'Game' mode. Any ideas?
Did you make a Sprite Lit shader? Do you have 2D lights?
@@CodeMonkeyUnity Set up the 2D lights. It is working perfectly now. Thanks.
I followed this to the dot, but alas for some reason game and scene do not render the Y vertex lock, so it's just a waving flag. Honestly, at a loss what is wrong here. Been trying to check my camera and settings, but it's just puzzling.
Are you using a spritesheet? Make sure you apply it to a simple solo sprite, otherwise the bottom won't match and everything will wave. The shader shouldn't have anything to do with the camera, the Y position is the base of the sprite and not screen space
@@CodeMonkeyUnity You're correct! Hooray, they were in an atlas. But It seems like I've also sneakily added them to another atlas. So when I was removing them in and out of first one, they didn't work correctly XD. Dunno if this should be used sparingly tho, considering they will need to be drawn induvidually now? But, it looks cool!
Although in the light of the recent news, it's a small win.
Either way, thank you for this awesome shader! It was a great learning experience :D
can I use that with URP
I am using URP in the video.
I'm following the steps but I'm getting the error "material does not have _MainTex texture property" in the sprite renderer. I have _MainTex in the reference field in the shader. Therefore my object is just blacked out. Anyone know why?
Did you click Save on the Shader Graph? Is the reference name exactly right?
@@CodeMonkeyUnity Ah that was it! I feel like a dummy. Thanks so much.
Can you teach us how to make a horse or a bike that you can climb over and use to increase your speed pls
I've covered several character controllers previously, they all use a simple float to manage the moveSpeed ruclips.net/video/Bf_5qIt9Gr8/видео.html
@@CodeMonkeyUnity I meant something like riding a horse in 2d games
@@Wildjustwild69 you can just increase player movent speed when player rides a horse
Do you think this would work in a 2D environment with a tileset? :thinking:
This just moves the vertices so yes it's applicable to 2D Sprites as well as 3D Meshes
@@CodeMonkeyUnity Lovely~
will you make more udemy courses . I loooove the game that you created it is simply amaziiiing!!!!! U are awesome developer!
The response has been great so yup definitely planning on doing more. It's great to be able to make some full length projects rather than just quick videos.
@@CodeMonkeyUnity I loved it . It is not only amazingly well explained but also the game is ACTUALLY NICE !!!! A great idea and well executed. I would love another course on showing more with shaders and some VFX for example like a mini rpg magic game (since those are very rough to make) But I trust that whatever you make will be excellent content with much to learn and of course , WORTH IT !!!! I highly appreciate you . Keep Crushing CODE monkey!
Yes
Will you join Odysee?
Hey Code Monkey, Brackeys leaved in RUclips
Press like(for users) for Respect
Press Love button(For Code Monkey) for Respect
The algorithm that tessellates the mesh is pretty terrible that’s why it look ugly as sin, moving in z direction
Hi
shaders are your worst side
How so?