一、描述
模型导入unity时出现这种情况是因为模型用了双面材质,而Unity不支持双面材质。故导入模型到Unity中,会出现一面有贴图,另一面透明的情况。
二、方法
新建一个Shader,代码如下:
Shader "MyShader/Text" {
Properties {
_Color ("Main Color", Color) = (1,1,1,0)
_SpecColor ("Spec Color", Color) = (1,1,1,1)
_Emission ("Emmisive Color", Color) = (0,0,0,0)
_Shininess ("Shininess", Range (0.01, 1)) = 0.7
_FrontTex ("Front (RGB)", 2D) = "white" { }
_BackTex ("Back (RGB)", 2D) = "white" { }
}
SubShader {
Material {
Diffuse [_Color]
Ambient [_Color]
Shininess [_Shininess]
Specular [_SpecColor]
Emission [_Emission]
}
Lighting On
SeparateSpecular On
Blend SrcAlpha OneMinusSrcAlpha
Pass {
Cull Front
SetTexture [_BackTex] {
Combine Primary * Texture
}
}
Pass {
Cull Back
SetTexture [_FrontTex] {
Combine Primary * Texture
}}}}
三、总结
觉得有用就留下评论吧^-^
版权声明:本文为dicunsi2939原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。