I know absolutely nothing about shaders at this point. I am using the 3DText shader found on the wiki:
http://www.unifycommunity.com/wiki/index.php?title=3DText
I have my text in a completely dark scene and I want the text only to show when it is illuminated. Basically I want it to behave as a regular diffuse texture, but allow me to change the text dynamically like a 3DText object.
Hmmm… I see that when I change “Lighting Off” to “Lighting On” (I’m just playing around) Unity gives me the error “Shader wants normals, but the mesh doesn’t have them”.
That makes sense. Lighting can’t be computed without normals. Is there a way to fake it then?
Unity’s 3D text doesn’t pre-calculate normals, but luckily it only has a single normal because it is just a flat surface. The good news is that this means you can make a shader that assumes the normal and does appropriate lighting. The bad news is that it can’t use the fixed function pipeline, so you’ll have to write some Cg.
I would start with the diffuse or diffuse(fast) shader. I’m not sure right now which way 3D text faces, but you should just be able to read the normal out of the X, Y or Z column of the modelview matrix.
I can look into trying this out on the weekend.