Pep
Pep

Reputation: 152

Cube is transparent for Text attached to it

I've added Text Mesh to a cube on 2 Sides

enter image description here

(in the object hierarchy, it "belongs" to the cube). With this, I now realise that the cube is apparently transparent. Actually not really, the only thing we can see going through the cube is the text. enter image description here

So, what am I doing wrong? I supposed it was a Shader's fault. (the A channel) But setting it to 255 doesn't change anything. Thank you

enter image description here

Upvotes: 1

Views: 460

Answers (1)

Botz3000
Botz3000

Reputation: 39650

I think the problem is that the shader used for the Text Mesh renders on top of everything by default (just like GUI Text). So the shader of the cube itself is not the problem.

You need to use another shader for the text, this is what i found:
http://wiki.unity3d.com/index.php?title=3DText

In case the link goes down, this is a shader you can use:

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
            }
        }
    }
}

Upvotes: 2

Related Questions