- Home /
Is there a material/shader that appears through every object?
Hello,
I am looking to make a health bar that appears above the player's head, and I would like to make it so that it appears through everything (kind of like how 3DText is). Is there a way to achieve this?
Thanks!
Answer by Owen-Reynolds · May 01, 2014 at 08:23 PM
Look-up how to make 3DText not appear through everything, then do the opposite.
It will involve copying the shader code (not as hard as it sounds) and changing the depthTest(?) setting and maybe renderQueue. Answers here about "fixing" 3DText cover it pretty well. Just make your After look like their Before.
after trying what you told me to do for about 30 $$anonymous$$utes, I realized that I could just apply the GUI/Text shader on the healthbar to achieve the desired effect. Still, thank you for the answer!
That will work fine for solid colors, but not for a texture. The GUI/Text shader expects the texture to be a jumble of letters. It grabs/rotates a letter-sized chunk of whatever texture you give it.
If you do want a textured health bar, changing just ZTEST and Queue is really a "is that all it was -- that giant block of shader code was scaring me -- so glad it I just had to change two things at the top" situation.
Yeah, I just never learned to modify shaders so it confused the hell outta me. I will keep in $$anonymous$$d what you said next time I run into similar problem. Thanks!
Your answer
Follow this Question
Related Questions
How can I edit Material Textures without creating a new Shader?,How to edit Material Texture 1 Answer
It is possible to clone and modify one of the existing shaders 0 Answers
Gl.Lines appearing over objects 0 Answers
How would I make a shader that gives this appearance? 0 Answers
Shader: get back scene pixel color? 1 Answer