You know how you can change the surface mode of the materials as shown above. Well, I have a script where I want to make an object fade out when in front of the camera, but my object uses a texture rather than one of the Unity materials. Is there a way to make the texture transparent? At the moment, the script doesn’t work.
I think you are confused about how rendering works in Unity. Nothing is drawn using only textures. You must provide a material for Unity to know how to draw an object. Materials contain information such as the shader to use as well as a variety of serialized and often configurable information, including what textures to sample from, when drawing a mesh or fullscreen effect. You can learn more about them in the documentation section about Materials.
When I go to change something on my material in the Inspector, these are the options:
I’m looking for this option (Surface Type) but it isn’t there:
Is there a way to change the Surface Type on my material that I haven’t seen? Currently, changing the alpha doesn’t work as it isn’t transparent?
Make sure the image has an alpha channel which is not just all white in a graphics program of your choice
In the texture itself, make sure Alpha Source is set to Input Texture Alpha and Alpha Is Transparency is checked
Use a shader that has support for alpha testing (preferred for vegetation) or alpha blending
I can’t tell whether your shader “Low Poly Vegetation” has support for alpha. Since it’s a vegetation shader, it probably should have support. But you can temporarily switch to the standard shader to see whether alpha testing/blending is working with your texture. If it is not, it’s the texture itself. If it is, the shader doesn’t support alpha testing.
Alpha testing (aka alpha cutout) has only two alpha values - fully opaque and fully transparent. Alpha blending can also have varying levels of transparency. Alpha testing is way cheaper. Foliage almost always uses alpha testing. Alpha blending is usually only used for glass. Alpha blending also often has sorting and lighting issues.
Hi, thanks - I found there was a Transparent version of the shader. This worked but the output is a bit weird and I don’t think my script from the video works anymore.
Thanks for the help - I’ll try and figure out if I can get it to work
Ok, every time I try to fade an object with the transparent shader on, it doesn’t work properly. In the debug section, I look under the Keywords, there is nothing in “Valid Keywords”, but in “Invalid Keywords”, I have the tag “_ALPHABLEND_ON” - why is it coming up as invalid?