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?
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.
@@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.
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
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
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 :)
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.
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
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!
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!
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.
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?
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
amazing tutorial. I really didnt want to go into shader graph, thanks
Another great tutorial, as always. you are the best!
I appreciate it!
Kinda hard to code but you explained very well, thanks!
Geez dude. You're insane!
But like… in a good way? 😊I hope
@@LlamAcademy Yeah
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?
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.
@@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.
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
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
@@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 :)
Awesome job!
Thank you!
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 :)
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.
thank you very much
You're welcome 🙌!
Very good stuff. You should play with shaders some. Vertex shaders are a lot of fun.
I'll get there eventually 😄
Hii there, whenever I build, no matter what the instancing of materials seems not to work
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
Now the question is... how to do this with URP...
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!
@@LlamAcademy I really want to know this as well!
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!
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!
@@LlamAcademy may i ask if there are any updates on this?
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.
I will take a look at it soon and see what the issues are with normal / height maps!
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?
@@LlamAcademy i have create a littel video check it out here to the fade problem : th-cam.com/video/b16rVmG2EME/w-d-xo.html
I have the same problem.
@@Sissel1982 I will review this video and see what I can find
Seems like this would ruined performance for a bigger project.
Awesome Dude,,... Anyhow its not for AR!..?
Nope, this one is only for built in render pipeline
Thanks man
You're welcome!
Not working in player.
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