3DText

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
(Removing all content from page)
m (Reverted edits by Joseph05408 (Talk); changed back to last version by Eric5h5)
Line 1: Line 1:
 +
[[Category: ShaderLab]]
 +
[[Category: Font]]
 +
Author: Eric Haines (Eric5h5)
 +
==Description==
 +
When using 3D text, the default shader is the same one used for GUIText, which makes the 3D text always appear on top of objects. This is frequently not what you want when using 3D text, so this 3DText shader makes it behave properly.
  
 +
==Usage==
 +
Place this shader somewhere in your Assets folder hierarchy.  Then, replace the font material on the mesh renderer of the 3D text with a different material that uses this shader (and the appropriate font texture of course).
 +
 +
==ShaderLab - 3DText.shader==
 +
<shaderlab>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 On Fog { Mode Off }
 +
  Blend SrcAlpha OneMinusSrcAlpha
 +
  Pass {
 +
      Color [_Color]
 +
      SetTexture [_MainTex] {
 +
        combine primary, texture * primary
 +
      }
 +
  }
 +
}
 +
}
 +
</shaderlab>

Revision as of 19:29, 19 October 2009

Author: Eric Haines (Eric5h5)

Description

When using 3D text, the default shader is the same one used for GUIText, which makes the 3D text always appear on top of objects. This is frequently not what you want when using 3D text, so this 3DText shader makes it behave properly.

Usage

Place this shader somewhere in your Assets folder hierarchy. Then, replace the font material on the mesh renderer of the 3D text with a different material that uses this shader (and the appropriate font texture of course).

ShaderLab - 3DText.shader

<shaderlab>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 On Fog { Mode Off } 
  Blend SrcAlpha OneMinusSrcAlpha 
  Pass { 
     Color [_Color] 
     SetTexture [_MainTex] { 
        combine primary, texture * primary 
     } 
  } 

} } </shaderlab>

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox