Shadows and 3D Text
Are shadows on 3D Text meant to work?
I have the default 3D Text object (the one the Unity editor gives you when you select Game Object -> 3D Object -> 3D Text). Sitting in front of a plane. Other objects cast shadows onto the plane just fine but the text does not. The default settings on the text look like they set up to enabled shadows - which suggests this sort of thing is possible as you would have thought they would at least be disabled by for efficiency if it's not supported.
I can get shadows to appear if I change the material but obviously that prevents the text rendering correctly and the shadows are just blocks.
I've seen other questions about this but they are either out of date, suggesting text shadows are a pro-only feature, or they suggest work-arounds, without saying whether text shadows should actually work at all.
Anyone know about this?
Answer by Graphics_Dev · Jan 13, 2016 at 01:28 PM
No shadows won't just work without a special shader. If you want better 3D text, try using Blender (or any other modeling program) to build real 3D text that can be used like any other model.
That's a shame. The fact that those options are exposed in the UI really does make it look like they are supported. It's set to receive and cast shadows by default so I bet that's sucking up resources for people who haven't thought to turn it off.
Anyway thanks for the suggestion however the text I'm working with is going to be set by the user at runtime with their choice of font. So, short of generating separate models for each character of each supported font, that's not really an option for me.
Please mark this answer as correct to close the question :^)
Oh, one real hack to sort of fudge this is to make 2 text objects and position them where one looks like the other's shadow. You can make the shadow text italic for a little more realism, and you can set the alpha of the shadow so its not so bold. Also by making the scale negative, you can get the shadows to the other side of the text -- whichever would be closest to the lighting you have in the scene. Then just change both texts at the same time based on user input.
I have attached a Unity package demo to my answer if you would like a reference for this trick.
Thanks for the suggestion and in particular for the demo! I will take a look, I might be able to get the kind of result I'm after but I expect it won't be quite enough for my situation - at least as it stands.
Currently my light source is moving, so I would need to have something continuously updating the position of the shadow text to match the movement of the light. I could do that but the result would still only look good when the light is close to being directly in front of text. For larger angles I would need to skew/shear the shadows and I'm not sure how I would do that given that Unity only lets you access an object's scale, rotation and position, rather than it's transform matrix directly. Obviously italics achieves the effect, as you mention, but only for small set of angles.
Even for small angles the shadow text will probably look incorrect if there happens to be a normal mesh nearby casting correct shadows and making the difference obvious.
Still with that suggestion I may be able to rework how my scene is set up to make it work. Thanks again!
Your answer
Follow this Question
Related Questions
Add hard shadows to a Toon Shader 0 Answers
Use Text Best fit to fit vertically and not horizontally 0 Answers
3d Text update. How its work? 1 Answer
How to cast terrain detail shadow? 0 Answers