- Home /
How do you create genuine shadows from a Text Mesh?
We have a need to create genuine shadows from TextMeshes in game, using either a GUItext on a Canvas or a 3Dtext. All the current solutions we've seen, such as offsetting a duplicate behind the text, produce simple photoshop-like drop shadows. We want to cast shadows just like those from a complex object; ones that will cast correctly on complex backgrounds, as in the illustration. It appears that the existing "Font Material" shader does not cast shadows.
The closest we've been able to get so far is to duplicate the text GameObject, give it a slight -Z offset,, then apply a standard shader material to the duplicate... with the unacceptable result that each letter receives a solid color box around it.
It appears that the Text Mesh Pro ($65) and TestFX ($30) plug-ins accomplish this, tho documentation to achieve this particular effect looks scant. If there is a simple way to do it in native Unity, we'd prefer it.
Extra points for fast responses, as we are on a very tight deadline.
Answer by gregroberts · Jul 17, 2015 at 02:43 PM
UPDATE : I just found Typogenic, an open source text rendering library that appears to accomplish this. Am implementing and will report back.
This worked perfectly in Unity 5.1.1. Here is the initial test result, textmesh shadows rendered onto cube and sphere solids
Caveat: It does require pre-processing of fonts to create the shadowcasters: