unity里面的3dtext可以很方便得使用,包括了替换材质等等
替换字体简单的就是下面视图步骤,注意使用的Texture是导入字体后的Texture
shader使用以下基本写法,稍稍更改下就行
ShaderLab - 3DText.shader
Shader "GUI/3D Text Shader" {
Properties {
_MainTex ("Font Texture", 2D) = "white" {}
_Color ("Text Color", Color) = (1,1,1,1)
}
SubShader {
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
Lighting Off Cull Off ZWrite Off Fog { Mode Off }
Blend SrcAlpha OneMinusSrcAlpha
Pass {
Color [_Color]
SetTexture [_MainTex] {
combine primary, texture * primary
}
}
}
}
ShaderLab - 3DTextOneSided.shader
Replacing "Cull Off" to "Cull Back", makes the text one sided.
Shader "GUI/3D Text Shader - Cull Back" {
Properties {
_MainTex ("Font Texture", 2D) = "white" {}
_Color ("Text Color", Color) = (1,1,1,1)
}
SubShader {
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
Lighting Off Cull Back ZWrite Off Fog { Mode Off }
Blend SrcAlpha OneMinusSrcAlpha
Pass {
Color [_Color]
SetTexture [_MainTex] {
combine primary, texture * primary
}
}
}
}
链接
http://wiki.unity3d.com/index.php?title=3DText