- Home /
The question is answered, right answer was accepted
1 way Text mesh?
Is there a way to have a text mesh only render on the front like a plane. I want to prevent this from happening.
Answer by aldonaletto · Aug 29, 2012 at 11:48 PM
You can use the shader below: it's based on the 3DText shader posted by @Eric5h5 in the Wiki, but was modified to cull out the back face. The first step is to save the shader in your Assets folder with a .shader extension - like 3DTextCullBack.shader, for instance. Once the shader has been saved, follow the instructions in the @Eric5h5's article to complete the job ( http://wiki.unity3d.com/index.php?title=3DText )
3D Shader with cull back:
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 } } } } As an extra bonus, this shader respects the depth test, thus objects in front of the 3DText will occlude it as expected (the original one rendered over everything in the scene!)
Answer by Eric5h5 · Aug 29, 2012 at 11:39 PM
Use a material with a shader that has "cull back" in it; the default font.shader uses "cull off". You can make a duplicate of the default font shader and change that.
Answer by Screenhog · Aug 29, 2012 at 11:19 PM
3D Text uses a specific shader that is double-sided. You'd have to change the shader somehow.
Follow this Question
Related Questions
text mesh. how would i make it face up? 1 Answer
Text Mesh pro and sprite atlas in 2019 1 Answer
3D Text diffuse shader? 1 Answer
Show Enemy Name On UI Canvas? 1 Answer