- Home /
Question by
Entretoize · Apr 18, 2020 at 10:33 AM ·
pngtransparent shader
How to use a transparent png as a model texture ?
Hello, it seems impossible to have a "semi-transparent" texture in unity, if you set the material to opaque it is totally opaque, if you set it to transparent it is totally transparent and if you set to cutout it is either invisible or opaque. I'm using, Autodesk interactive, I tried several other's, anyway I need normal map, specular...
Is it possible or unity is just ... bad !?
Thanks
Comment
Answer by Entretoize · Apr 18, 2020 at 10:59 AM
I found the anwser here : https://www.patreon.com/posts/c-script-to-hide-7678022 It doesn't seem possible in the editor, but to enable alpha in the game I needed to se that :
foreach (Material m in Roof.GetComponent<Renderer>().materials)
{
m.SetFloat("_Mode", 2);
m.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
m.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
m.SetInt("_ZWrite", 0);
m.DisableKeyword("_ALPHATEST_ON");
m.EnableKeyword("_ALPHABLEND_ON");
m.DisableKeyword("_ALPHAPREMULTIPLY_ON");
m.renderQueue = 3000;
}
Your answer
Follow this Question
Related Questions
Image resize and save 0 Answers
Android: Preparing textures for 16-bit compression 1 Answer
Unity ruins image horribly 3 Answers