Hi, I didnt think this would be a difficult task or maybe I’ve just made myself confused but I am trying to fade an object and unless I’m misunderstanding I have to set the rendering mode to transparent. But I do not wish to see particles and other such things through the object when it is at 100% alpha. Is there a way where I can still lower the alpha and therefore make the object transparent but while at 100% the object is completely opaque?
There’s a actually a function which does exactly that in standart shader editor script. Download the source and look it up, I don’t have the source on me right now.
Thanks for the help. I made it so that the shader is swapped whenever I need to drop the alpha below 1.0.
Also, when I built the game I needed to manually include the shader as I used Shader.Find() to replace the shader. Placing the downloaded shader from unity’s download page inside “Assets/Resources” worked.
It sounds like you’re looking for an attribute of a Transparent Cutout Shader. That said, if you’re looking to make an alternative capable of doing both, the shader code could be approached with something like:
tex.a = floor(tex.a);
This would take your texture’s alpha value and reduce all fractions down to the nearest whole number, so anything less than 1 would instead be 0.
For any shader purely based around all-or-nothing transparency (i.e. cutout), however, you would be better off utilizing a proper transparent cutout shader instead. Those can instead be based instead around clipping pixels based on the alpha value.