How to make 3d Text invisible through 3D Game object... for a complete beginner
Okay, I know that there are a lot of threads about that problem, but I've try them and either it does not work for me, either I don't understand what I have to do... Or the options I have to mess with is not available....
I have Unity 5.5. (the free version) and I'm a complete beginner. Like... The obvious is not obvious for me. Anyway, the problem is well known: 3D text is visible through other 3D object (walls, cubes, etc) when I try the game.
Here's what I think I understand I have to do :
1) Create a new shader and modify its code with what I want (what type of shader ? Unlit? Standard? Compute?)
2) Apply the font texture (of the font I want to use) to that shader. (That part, I can do)
3) Apply the shader to a new material created for this purpose (Errr. I can't. The shader I've created is not in the propositions anywhere in the inspector.)
4) Apply the new material on the mesh renderer. (Can't do it since I can't assign the shader to a new material).
I've seen something else, and I don't know if it's normal : the font texture is completely uneditable.
Can anybody give me a step by step description of what I have to do to solve the problem?
Thanks a lot (And I really am sorry to post another thread about this subject... I really am)
So, I really do not mean to push you, but do you know how to do this ? I just want to know if I keep looking on the Internet of if I wait an answer here :) Thank you, btw - for commenting, I mean - It's kind of nice knowing you're not completely unnoticed :)
Answer by Namey5 · Mar 09, 2017 at 09:41 AM
There are plenty of threads around this, and it's not exactly simple if you don't understand how shaders work. You need to download the built-in shaders from Unity's website;
https://unity3d.com/get-unity/download/archive
Then open the Font shader (under "DefaultResources"). Then find the line that says something like (ZTest Always). Set it to "ZTest LEqual". Then, change the first line of the shader to something like:
Shader "Custom/Text Shader"
So that you can distinguish between them in Unity. Take that shader into your Unity project assets, then use that as the shader for the material, and make sure to add the font texture. As long as you select a font in the Text Options, and use the font texture for that exact font it should work.
Thank you! :)
That's exactly the kind of answer I needed. It's clear and everything, and it works! This is amazing :D
Thanks a lot. Only your answer helped. Other threads redirect to some wiki page shader that doesn't work in Unity 5.
Thank you @Namey5 You made it so easy for me! I agree with urvashi412. I was able to set up a bunch of fonts in this way
I had a really hard time with this too. After spending several hours on this issue searching around, finding this page, not getting it to work, and then finally co$$anonymous$$g back to it and getting this to work, I decided I'd write this to help anyone else who got stuck. Here are some step by step instructions:
Go to https://unity3d.com/get-unity/download/archive as mentioned in the accepted answer by @Namey5.
Find the version of unit that you have, then on the Downloads dropdown click "Built in Shaders." It will automatically download a zip called builtin_shaders or something like that. Like so: Image
In this zip, go to the folder DefaultResources and open Font.shader. This is the default font shader.
Create a new font material (name it 3DText or something), create a new shader (it doesn't matter what type; standard, unlit, etc), and copy over everything from Font.shader into this file, replacing everything it originally had.
Change the new shader file as in @Namey5's answer. Good luck!
EDIT:
Well co$$anonymous$$g back to this I still got confused, so here is a few steps afterwards. To use:
Create a 3D text object.
In the Text $$anonymous$$esh for that object, drag and drop your previous font material (for me, ARIAL).
In the $$anonymous$$esh Renderer for that object, under materials, put in your new font material (i.e. 3DText).
I don't know why I had to do step #2, but after a bit of testing that is the only way I could get it to work :)
Your answer
Follow this Question
Related Questions
How do you stop 3d Text from rendering through objects? 0 Answers
Reveal Nearby Objects Relative to Player 0 Answers
Custom split color font 0 Answers
3D Text, oh my... 1 Answer