- Home /
Can transparent textures be lightmapped?
I'm wondering if there's any way to get textures to cast colored shadows? The effect is like a candle in a jar, where the jar (cylinder) has colored glass, and I want to have that spot or point light projected onto the table around it. Baked or realtime. Projector component? Doesn't seem like that would work. The best I've gotten so far is using a PNG with alpha using the Transparent/Diffuse shader will cast a gray shadow (the alpha of the PNG). I'd like to get the RGB's to contribute to the shadow too. Any ideas?
Answer by DaveA · Feb 27, 2011 at 05:10 AM
Get the source for the built-in shaders, edit Alpha-Diffuse to add this line to the properties block:
_TransparencyLM ("Transmissive Colour", 2D) = "white" {}
Rename it to something like Alpha-Diffuse-LM (in the code and the file name), and use that instead of Transparent/Diffuse.
See http://unity3d.com/support/documentation/Manual/LightmappingInDepth.html
Answer by JC Cappelletti · Apr 13, 2011 at 01:08 PM
I've found that the key to getting Beast to render any transparency into Lightmaps was in this note added recently to the Lightmapping manual.
"Note: When mapping materials to Beast, Unity detects the 'kind' of the shader by the shader's properties and path/name keywords such as: 'Specular', 'Transparent', 'Self-Illumin', etc."
To make this work, I needed to add "Transparent/" in front of the shader title like this:
Shader "RimBumpSpecCutout" {
Shader "Transparent/RimBumpSpecCutout" {
Simply adding the word Transparent into the title didn't work. I had to make "Transparent" the SubMenu name alone. It messed up my sorting in the Shader Menu, but with that simple addition, all the transparent and cutout shaders I had already worked without any other changes.
Unfortunately, it did not automatically make the Transmissive Color work since I didn't have that property in my shaders. I get how to add the _TransparencyLM property at the top of a shader, but what is the code for the bottom part:
o.Alpha = _TransparencyLM.rgb;
?????
Please let me know if anyone has this working.
Your answer
Follow this Question
Related Questions
Lightmapping terrain WITHOUT trees 1 Answer
[UNITY v5 Personal Edition 64] Shadows quality troubles 0 Answers
How to access color & texture functions of a "RawImage Script" simontaneously?? 0 Answers
Why does my opaque texture seem to be transparent? 2 Answers
How to change the color of predefine portion of the texture? 1 Answer