Fade Objects Using C# & Standard Shader (Built-in RP) | Unity Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 10 พ.ย. 2024

ความคิดเห็น • 52

  • @ojassharma56
    @ojassharma56 ปีที่แล้ว +1

    amazing tutorial. I really didnt want to go into shader graph, thanks

  • @ronigleydsonvilasnovas8067
    @ronigleydsonvilasnovas8067 3 ปีที่แล้ว +4

    Another great tutorial, as always. you are the best!

  • @muriilouwu
    @muriilouwu 4 หลายเดือนก่อน

    Kinda hard to code but you explained very well, thanks!

  • @maxg5196
    @maxg5196 2 ปีที่แล้ว

    Geez dude. You're insane!

    • @LlamAcademy
      @LlamAcademy  2 ปีที่แล้ว

      But like… in a good way? 😊I hope

    • @maxg5196
      @maxg5196 2 ปีที่แล้ว

      @@LlamAcademy Yeah

  • @CharlieFleed
    @CharlieFleed ปีที่แล้ว +1

    I am trying different solutions for my game and this is very close to what I need, but there is a problem: the shadows fade too. It seems that in the URP version you addressed that, but how to do that here?

    • @LlamAcademy
      @LlamAcademy  ปีที่แล้ว

      That's a good question. I don't know this off the top of my head, but the way to work it out would be checking out the debug inspector like around 18:25. From there you can play with the properties and find the proper configuration that will allow it to cast shadows. Comparing Opaque vs Transparent or Fade should have the right pointers.

    • @CharlieFleed
      @CharlieFleed ปีที่แล้ว

      @@LlamAcademy Thanks for the advice! I have been trying that, the main blocker is that just by playing with the available parameters I am not able to configure the standard shader to be transparent and also cast full shadows. That's why I got a custom shader for that effect, but after seeing your solution I was hoping to achieve the same with the native shaders.

  • @xNecka
    @xNecka 2 ปีที่แล้ว +1

    Thanks for the tutorial, it's really a good one.
    I do wonder one thing though, what with this "IEquatable" and the 2 methods you created. I keep reading the code and don't understand how or if this is ever called

    • @LlamAcademy
      @LlamAcademy  2 ปีที่แล้ว +1

      The IEquatable interface tells C# that we have a custom way of determining equality between two objects. It is called automatically when we are checking the Dictionary.Contains() to check if the provided FadingObject is equal to the ones in the Dictionary.
      You can read more about it here: docs.microsoft.com/en-us/dotnet/api/system.iequatable-1?view=net-6.0

    • @xNecka
      @xNecka 2 ปีที่แล้ว

      @@LlamAcademy Thanks a lot for this short and very clear explanation! That's very good to know even outside of the scope of this tutorial :)

  • @BarcelonaMove
    @BarcelonaMove 3 ปีที่แล้ว +1

    Awesome job!

  • @bigblue489
    @bigblue489 3 ปีที่แล้ว +1

    I had been wondering how to do this for a while, probuilder has this built in correct? Now i should be able to use for nonprobuilder prefabs and such :)

    • @LlamAcademy
      @LlamAcademy  3 ปีที่แล้ว

      The fading of objects isn't built into probuilder as far as I know. For this video I changed the cubes to use the Standard Shader instead of the default Probuilder "Standard Vertex Color" shader because that one didn't fade out the same way as the Standard Shader does.

  • @ДаниилГалинский-й5ч
    @ДаниилГалинский-й5ч 2 ปีที่แล้ว +1

    thank you very much

    • @LlamAcademy
      @LlamAcademy  2 ปีที่แล้ว

      You're welcome 🙌!

  • @poobagification
    @poobagification 3 ปีที่แล้ว +1

    Very good stuff. You should play with shaders some. Vertex shaders are a lot of fun.

    • @LlamAcademy
      @LlamAcademy  3 ปีที่แล้ว

      I'll get there eventually 😄

  • @tobigrantlbart
    @tobigrantlbart 2 หลายเดือนก่อน

    Hii there, whenever I build, no matter what the instancing of materials seems not to work

    • @LlamAcademy
      @LlamAcademy  2 หลายเดือนก่อน

      Someone else also commented on this - there’s a player setting about shader variant stripping you can add the transparent one as an always included variant, or have an object in your game that uses that variant

  • @PointToBlank89
    @PointToBlank89 2 ปีที่แล้ว +4

    Now the question is... how to do this with URP...

    • @LlamAcademy
      @LlamAcademy  2 ปีที่แล้ว +1

      Great question. I haven't used URP yet but once I start looking into migrating my game to URP I'll have to implement it and let you know!

    • @erikponti1753
      @erikponti1753 2 ปีที่แล้ว +1

      @@LlamAcademy I really want to know this as well!

    • @hyouuu
      @hyouuu 2 ปีที่แล้ว

      In my URP project the shaders default to Lit, which is supposed to be the equivalent of Standard Shader and I see all the same properties e.g. _DstBlend - it should be an easy change and would really appreciate it if you could take a look soon!

    • @LlamAcademy
      @LlamAcademy  2 ปีที่แล้ว

      Hey all, I'm getting some time to upgrade my Unity 2019 built-in render pipeline project to Unity 2021 LTS with URP. Since I use this fade mechanic in my game I'll definitely share what I learn as I use the standard URP shaders!

    • @1ightc
      @1ightc ปีที่แล้ว

      @@LlamAcademy may i ask if there are any updates on this?

  • @Sissel1982
    @Sissel1982 2 ปีที่แล้ว +1

    Thank for that tutorial, i found a littel Problem with it , When the material (standard shader) have a normal map, height map... that will not work in the build mode. In play mode works it with no problems, at the moment is that usefull for materials with only albedo texture.Give it a solution to fix it? A solution will be change the rendertype from oquae to Fade i think but i have no idea how i can put that into your scripts.

    • @LlamAcademy
      @LlamAcademy  2 ปีที่แล้ว +1

      I will take a look at it soon and see what the issues are with normal / height maps!

    • @LlamAcademy
      @LlamAcademy  2 ปีที่แล้ว +1

      I have added a normal and height map to an object in my game that is using this exact same code and it is fading it out properly. Can you double check you are using the same code?

    • @Sissel1982
      @Sissel1982 2 ปีที่แล้ว

      @@LlamAcademy i have create a littel video check it out here to the fade problem : th-cam.com/video/b16rVmG2EME/w-d-xo.html

    • @Psyonx77
      @Psyonx77 2 ปีที่แล้ว

      I have the same problem.

    • @LlamAcademy
      @LlamAcademy  2 ปีที่แล้ว

      @@Sissel1982 I will review this video and see what I can find

  • @Easelm
    @Easelm 2 หลายเดือนก่อน

    Seems like this would ruined performance for a bigger project.

  • @stute_01
    @stute_01 2 ปีที่แล้ว

    Awesome Dude,,... Anyhow its not for AR!..?

    • @LlamAcademy
      @LlamAcademy  2 ปีที่แล้ว

      Nope, this one is only for built in render pipeline

  • @itswilly
    @itswilly 3 ปีที่แล้ว +1

    Thanks man

  • @somestudent5253
    @somestudent5253 4 หลายเดือนก่อน

    Not working in player.

    • @LlamAcademy
      @LlamAcademy  4 หลายเดือนก่อน

      Sometimes if you have shader stripping turned too aggressively and don’t have any other transparent objects it can prevent these shader variants from loading in your build