• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
10
Question by DaveA · Jan 26, 2011 at 12:49 AM · shaderrenderingtextz-depth

Text mesh (font material) renders on top of everything, any way to change that?

I have these objects with some text on them floating in my space (labeling things as it were). My problem is that apparently, text is drawn last, so it is visible always, even if it should be occluded by intervening solid objects. Is there a way to fix that? Do I have to muck with the shader on it?

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image MFKJ · Jun 11, 2020 at 08:48 AM 0
Share

Its 2020, For new Text $$anonymous$$esh Pro you can use distance field shader here is the demo https://youtu.be/7HnixlwlQ5Q

7 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Cascho01 · Nov 23, 2015 at 11:52 AM

@Ngoc Ngo Any way to get the color set with TextMesh working?

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Ngoc Ngo · Nov 23, 2015 at 12:00 PM 0
Share

I don't know, but I haven't checked in a year, so maybe somebody has done it somewhere. $$anonymous$$eep looking. Good luck! And don't forget to post it here once you found a way, it may help someone.

avatar image
7

Answer by Ngoc Ngo · Aug 22, 2014 at 12:30 AM

The shader has been moved here: http://wiki.unity3d.com/index.php?title=3DText

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

This one won't use the color set with TextMesh though.

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Eldoir · Oct 10, 2017 at 09:08 AM 1
Share

Worked perfectly for me. As you said, the shader "disables" the color of Text$$anonymous$$esh, but you can set the color with the Shader ins$$anonymous$$d of the Text$$anonymous$$esh, so it's pretty much the same result. I attached a pic for future readers.alt text

pic.png (29.3 kB)
avatar image jvhgamer Eldoir · Dec 07, 2017 at 09:10 PM 0
Share

@Eldoir Is it possible to do this for GUI elements such as Buttons as well? Fleshed out detailed question post link here. Unsure how this solution translates to Buttons as they allow for a variety of color options based on how they are interacted with (i.e.: Normal, Highlighted, Pressed, Disabled)

avatar image AtifatGamy · Oct 05, 2018 at 11:19 AM 0
Share

Thanks allot This works on $$anonymous$$e...

avatar image sabint · Oct 05, 2021 at 08:28 AM 0
Share

But where is the font texture?

  • ‹
  • 1
  • 2

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

16 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

2.5D perspective rendering order challenges 2 Answers

Camera with shader? 2 Answers

Screen freezes after running the game [ Shaders problem ] 0 Answers

U5 shader coming out solid black on newer iOS devices (iPad 2 Air / iPhone 6) 1 Answer

Subtractive Rendering? 4 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges