HOW TO MAKE DISTORTION FOR 2D & 3D - SIMPLE SHADER GRAPHS - Unity 2020 & 2021

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

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

  • @AndyFinkMusic
    @AndyFinkMusic 7 месяцев назад +6

    Finding this in 2024 still helps a lot, thanks!
    I've spent some extra time wondering why everything looked way too blurry in my project until I noticed Opaque Downsampling setting in the Universal Render Pipeline config, setting that to "none" gives that nice crispy final image with all the distorting effect still looking great :)

    • @SethFunk
      @SethFunk  7 месяцев назад +1

      I'm really glad to hear that these videos are still helping people. Thanks for checking it out in the first place!

  • @gaidzin2
    @gaidzin2 Год назад +2

    Why is it that the more to the left on the screen, the stronger the distortion?

    • @SethFunk
      @SethFunk  Год назад

      Guess I don't fully understand your issue, The effect is viewed through an object such as a plane or sprite shape. Those objects will depend on where you see the distortion. As for how the distortion itself looks, that's fully based on the shader, which I walk through it in the video.

    • @skyrod5823
      @skyrod5823 Год назад +1

      Dont multiply the screen position and your noise maybe try to create a UV node and add your noise to and then multiply it with your distortion power (didnt try)

  • @홍윤표-j7v
    @홍윤표-j7v 2 года назад +9

    For those following this video but having problems, make sure you are using the "URP Universal Renderer". If you use "URP 2D Renderer", the distortion effect shown in the video does not appear. (I don't know why)

  • @reddone9469
    @reddone9469 3 года назад +1

    after 3 days of trying to make a distortion wave in my game, you solved all my problems :D
    Thanks mate

    • @SethFunk
      @SethFunk  3 года назад +1

      That's awesome dude! Good luck with your project!

    • @reddone9469
      @reddone9469 3 года назад

      @@SethFunk good luck for your channel!

  • @tomxuan9050
    @tomxuan9050 2 года назад +2

    Hello I am using Unity 2022.1 but I couldn't find forward renderer. The closest one I can find is "renderer 2d data". Some of the options in the video are not there in the inspector and I couldn't make it work. Will you post a video about the same trick Unity 2022? Thanks!

    • @tomxuan9050
      @tomxuan9050 2 года назад +1

      Just found out! It's called URP Universal Renderer instead of URP 2D Renderer.

    • @SethFunk
      @SethFunk  2 года назад

      @@tomxuan9050 I'm glad you found it!

  • @giordanonin
    @giordanonin 2 года назад +2

    Very well done, thanks.
    But I can't get it to not duplicate some sprites (like, a second player appears on the distortion effect). I've made sure the sorting layers are correct. What could I be doing wrong?

    • @SethFunk
      @SethFunk  2 года назад +2

      This shader is effectively take the pixels on the screen beneath the object that you are using the distortion effect on. Those pixels then get moved around based by the shader which is the very simplified version of how the shader works. This means any object you move the distortion effect over can possibly be seen in two places depending on where it is near the "distortion" object. One way to help prevent this is you could use the "distortion" object as a mask as well an when it covers an object, that portion of the object is hidden. But then you'd need to learn how to utilize the different rendering passes such as the stencil/mask buffer. It can get complicated very quickly once you go outside of the scope of this video.

    • @giordanonin
      @giordanonin 2 года назад +1

      ​@@SethFunk hmmm I see...
      I have very limited knowledge of shaders. If I want to have, say, a top down distorted water and a boat on top of it. What would you say is my best bet then? Would it be easier to just apply the distortion in a texture?

    • @giordanonin
      @giordanonin 2 года назад +2

      @@SethFunk I did it!! I used 2 cameras, one with lower priority filming just the water effect and another one filming the rest of the game with no bg color or skybox. now I just need to leave the space empty and the water effect is there!
      Thank you so much for this video!

    • @SethFunk
      @SethFunk  2 года назад +2

      @@giordanonin That's definitely an option. You just have to be careful with the overhead you get from using 2 cameras in a scene. (rendering a scene 2 times is very resource heavy)

  • @Kehan-g9x
    @Kehan-g9x 2 месяца назад +1

    I can't find the forward Renderer, does anyone have same problem?

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

      I linked the video to the lava shader graph tutorial that covers the renderer stuff:
      ruclips.net/video/6Yloso8vTQ0/видео.htmlsi=NFvS7Gmknsf9v5zA

  • @aalperbayram
    @aalperbayram Год назад +1

    Great stuff thanks man! I was struggling with a 2d project where I needed distortion. You rock!

    • @SethFunk
      @SethFunk  Год назад +1

      Thank you, glad it helped out!

    • @alexthompson8977
      @alexthompson8977 8 месяцев назад +1

      @@SethFunk is there any way to get this to work with 2d renderer? Because I would like to be able to use this along with 2d lights

    • @SethFunk
      @SethFunk  8 месяцев назад

      @@alexthompson8977 good question. Depends in which version of unity you are using. For 2020 and 2021, i believe you'd need to write a custom blit script. Which if you do that you minds well figure out how to write shader code. In the newer versions of unity, i know they changed the pipelines again so it might be possible. Haven't looked much into doing it though

    • @alexthompson8977
      @alexthompson8977 8 месяцев назад

      @@SethFunk so if I do that it'll work in 2d renderer?

    • @SethFunk
      @SethFunk  8 месяцев назад +1

      @@alexthompson8977 I'm assuming you are fairly new to programming or game design in general. There are no one size fits all solutions. So you'll need to do the trouble shooting to figure out what and will not work if you are not following this process 100%. But short answer is there is a way to achieve this effect, but you'll have to figure it out.

  • @Erik-ci3nt
    @Erik-ci3nt 3 года назад +2

    Great Video! This helped me understand so much about Shader Graph. One note, I did need to change my Material in 'Sprite Unlit' in the Graph Inspector to get it to work, but otherwise this was a flawless tutorial, very detailed and the explanations are super helpful!

    • @SethFunk
      @SethFunk  3 года назад

      I am glad it was helpful for you. Good luck with your future shader adventures!

    • @alexthompson8977
      @alexthompson8977 Год назад +1

      @@SethFunk I have an issue. The shader works however I distorts my images(not sprites) when I don't want them to be distorted. This is even after I have it set to a layer that's not supposed to be affected

    • @SethFunk
      @SethFunk  Год назад

      @@alexthompson8977 could be a few things. Not sure if i tested this with ui elements (images) so it could be getting effected due to the rendering order. But the layer tag should help prevent this from being an issue either way. You could always try changing the render order in the forward renderer asset. Its always hard to help troubleshoot with out seeing how your current project is setup. Shaders/graphics are a complex subject with a lot of moving parts. These tutorials are more of a guiding hand to get you in the right direction and usually some additional self troubleshooting can be used to get the result you want.

    • @alexthompson8977
      @alexthompson8977 Год назад

      @@SethFunk never mind I solved it by switching to sprites

  • @lukevanzandt1312
    @lukevanzandt1312 2 года назад +4

    Another severely underrated RUclips gem. You saved me a ton of time and frustration. Thanks man

    • @SethFunk
      @SethFunk  2 года назад

      Thanks for watching! I'm glad it helped!

  • @StardustTyphon
    @StardustTyphon 2 года назад +1

    Hey are you open for specific questions somewhere on discord or so? I'm struggling to get the right effect for my game and you might be able to help me figuring it out.

    • @SethFunk
      @SethFunk  2 года назад

      The link to my discord channel is in the description.

    • @StardustTyphon
      @StardustTyphon 2 года назад +1

      @@SethFunk ah sorry, it didn't work for me first but was a discord bug

    • @SethFunk
      @SethFunk  2 года назад

      @@StardustTyphon Gotcha, yeah sometimes those links randomly break. Discord can be frustrating at times lol

  • @tiffanystefanko2540
    @tiffanystefanko2540 3 года назад +1

    Distorted Tuna makes me laugh! Great video (:

  • @PolyGarrett
    @PolyGarrett 3 месяца назад

    Is there a way to do this without messing with the layers and it just be the shader?

    • @SethFunk
      @SethFunk  3 месяца назад

      probably not with this method. This relies on a certain part of the render pipeline which uses the layers to determine which items to process when.
      Newer versions of unity 2022 and later does have an improved shader graph, so you might be able to do it using the newer nodes. Distortion is basically offsetting a UV over time with a unique pattern. Once you understand that, might be able to build your own shader graph, or use that info to write a a normal shader.

  • @JakobTheQuizGuy
    @JakobTheQuizGuy 2 года назад +2

    Liked and subscribed, thank you! You've provided me with a simple solution for something I've wanted to do for a long time. I have one problem though, in my URP renderer list I already have a Renderer 2D Data. I use 2D light in my game but it ceases to function when I set the Universal Renderer Data as default. When I set the Renderer 2D Data as default, the 2D light works again but the texture supposed to give off the distortion effect just becomes a gray block. Is there any way to get support for the distortion effect AND 2D light without having to choose one or the other?

    • @SethFunk
      @SethFunk  2 года назад

      I believe there is a way to do something similar with the 2d forward renderer, but you have to use a custom blip script. GameDevBill had a shader video that mentioned something like this.

    • @JakobTheQuizGuy
      @JakobTheQuizGuy 2 года назад

      @@SethFunk I'll look into that, thank you!

    • @홍윤표-j7v
      @홍윤표-j7v 2 года назад +1

      Use "URP Universal Renderer" instead of "URP 2D Renderer". The formal one has options that this tutorial needs.

    • @isaacsnowcarini4808
      @isaacsnowcarini4808 Год назад

      @@홍윤표-j7v i tried using URP Universal Renderer but i still get a gray block too

  • @DevBoy_exe
    @DevBoy_exe 18 дней назад

    i would like to have an object that is not affected by this effect, but when i change this, the object gets invisible D:

    • @SethFunk
      @SethFunk  17 дней назад +1

      Honestly there could be a lot going on in this case. The object shouldn't be culled during the rendering or overdrawn, but it depends on all the settings of your render pipeline, which unity version you are using (each version has some unique changes to the pipelines), if the object is opaque or has transparency, ect.. Technical art is very difficult. These videos I did was more for sharing a method I found to work for the situation I needed, not a silver bullet solution.
      I know this isn't super useful for your current issue, but I hope you can find a solution for your project.

    • @DevBoy_exe
      @DevBoy_exe 10 дней назад +1

      @@SethFunk Thank you, it really was the way it has been updated. So imanaged to figure out how to do it and now i wanted to do it again, but i forgot how id did it exactly hahahahahaha

  • @burhanahmad500
    @burhanahmad500 2 года назад +1

    Hey Seth, Thankyou for this amazing tutorial! I just wanted to know if you could maybe make a tutorial on how to use this distortion on UI

    • @SethFunk
      @SethFunk  2 года назад

      I just tested UI buttons with the method I show in this video, and it works. All you need to do is drag the object being used to distort over your UI elements

  • @olivierbaron6237
    @olivierbaron6237 6 месяцев назад +1

    great tuto! you save my life XD

    • @SethFunk
      @SethFunk  6 месяцев назад +1

      Unity shader graph tutorials to the rescue! 😂

  • @ramelo07
    @ramelo07 Год назад +1

    i liked it for tuna, but also great vid!

    • @SethFunk
      @SethFunk  Год назад

      Hey I appreciate the positivity!

  • @ridax4955
    @ridax4955 7 месяцев назад +1

    Thanks a lot for your tutorial, after some tries i almost made it work. Im having a problem with what i think its the camera, since my disortion effect looks good in the Scene tab, but it's not shown on the Game tab and when im playing.
    Im using Images components since im doing it on a UI, i have a background with a river and i want to make the water distort following the waves.
    Dunno if the problem comes from the camera or from the images components. Anyways the distort i seems to be on the whole screen, and not only on the waves image isolated, so i don't really know if this would work for me lol
    Anyways, appreciated your tutorial, made me get a first contact on with the URP assets and all of that. Thanks buddy, let's see if i can fix this :)

    • @SethFunk
      @SethFunk  7 месяцев назад +1

      Interesting. I honestly am not sure how to fix it once it is a UI component. I believe UI is handled differently in the rendering stack, which could be one of the reasons why you are seeing issues. But it is great to hear that you were able to learn from this video!

  • @skyrod5823
    @skyrod5823 Год назад

    It dont work on transparent shaders. Is it normal?

    • @skyrod5823
      @skyrod5823 Год назад

      Fix it by setting the "event" on "BeforeRenderingSkyBox"

    • @SethFunk
      @SethFunk  Год назад +1

      @@skyrod5823 glad to hear you got it to work. These types of tutorials aren't meant to give you the "only solution" but rather they are here to help expand yoyr knowledge on the basics of shaders that way you can start learning how to tweak them yourself.
      As for the transparency issue, thats typically due to the version of unity that you are using, due to the order of the rendering stack changing between versions

  • @stara3154
    @stara3154 2 года назад +1

    Very helpful ! Thank you !

    • @SethFunk
      @SethFunk  2 года назад

      I'm glad it helped!

  • @-lunte.
    @-lunte. 2 года назад +1

    thank you man you are awesome !!

    • @SethFunk
      @SethFunk  2 года назад

      I hope the video helped you out! Technical art can be pretty difficult without any support!

  • @creationgamers
    @creationgamers 3 года назад +1

    Are you going to play Brackeys Gamejam games?

    • @SethFunk
      @SethFunk  3 года назад

      I can play the games, but not rate them. Sadly I did not participate in this jam this go around!

    • @creationgamers
      @creationgamers 3 года назад

      @@SethFunk oh ok I wish atleast you play those games and give feedback :)

  • @charlestheninja
    @charlestheninja 3 года назад +1

    The discord link is not valid! :(

    • @SethFunk
      @SethFunk  3 года назад

      discord.gg/6CeqcEFCM3
      Sorry about that. Those links are never suppose to expire but discord is pretty janky at times. But hopefully the 2020 tutorial is more helpful!

  • @angelbaby3342
    @angelbaby3342 2 года назад +1

    Can this be applied in 3D?

    • @SethFunk
      @SethFunk  2 года назад

      Depends on what you mean. It works on 2d and 3d elements.

    • @angelbaby3342
      @angelbaby3342 2 года назад +1

      @@SethFunk Yeah the focus as a 2D interface so I was confused if this was only for 2D

    • @SethFunk
      @SethFunk  2 года назад

      @@angelbaby3342 this technique is basically just a filter over an area. It sounds like you are looking for vertext displacement. Which is different then this

  • @young7497
    @young7497 Год назад +1

    I can't find URP-Forward-Renderer ㅡ

    • @SethFunk
      @SethFunk  Год назад

      Did you install the universal render pipeline package? Did you create the urp asset via right mouse click universal render pipeline in the assets folder?

    • @skyrod5823
      @skyrod5823 Год назад

      Dont search it. You have to use the render you re using in the folder parametre

  • @oleksiistetsenko6028
    @oleksiistetsenko6028 3 года назад

    It didnt work... using unity 2020.3.20f1 ... I watch 3 of your tutorials about distortion but still cant figure out what is the problem...

    • @SethFunk
      @SethFunk  3 года назад +1

      Are you using the correct render pipeline? Did you follow the videos step by step? What do you mean by it doesnt work? What is happening?

    • @kuntycat
      @kuntycat 3 года назад

      @@SethFunk not pbr shaders unity 2020

    • @SethFunk
      @SethFunk  3 года назад

      @@kuntycat I guess I don't understand your comment. I don't use a pbr shader graph for these projects?

    • @kuntycat
      @kuntycat 3 года назад +1

      @@SethFunk yaps, PBR graph doesn't exist in unity 2020 , help me

    • @SethFunk
      @SethFunk  3 года назад

      @@kuntycat oh that makes sense now! I believe all pbr shader functions are considered to be under any type of lit shader graph. It had something to do with unity trying to make it easier for cross platforms and how shaders work

  • @尹梓龙
    @尹梓龙 2 года назад +1

    should probably take '2D' out the title -- this shader doesn't work with URP 2D renderers, so its incompatible with pixel perfect, unity tile sets etc

    • @SethFunk
      @SethFunk  2 года назад

      It works with 2d and 3d objects. There is a disclaimer in the video that states the 2d render pipeline does not work, but a 2d game does not necessarily need to be made using the 2d renderer pipeline.

  • @aser.5603
    @aser.5603 3 года назад +1

    BADGER FROM BREAKING BAD