- Home /
I need my alpha to show only where it is not lit.
Hi all!
I'm struggling on this one! I have a map with an alpha channel, I display it thru an Transparent shader, but I need it to be fully transparent everywhere the light hit the object. This way, I'll see my map, with it's transparence, but only on the shadowy side of my object.
I believe I must substract the lighting value in the alpha, but I can't achieve it! Any help guys?...
PJ
I think you'll have to write your own shader for this.
Here is some stuff on how to do custom lighting in shaders: http://docs.unity3d.com/$$anonymous$$anual/SL-SurfaceShaderLightingExamples.html
So you'll have to write something that does something with the alpha value depending on light I guess. Yea, that's kind of vague, but I can't really help much more.
Subtracting the lighting value in the alpha does sound about right for what you want to do I think. If you have a custom shader you can post it and maybe someone (probably not me, I'm not very good at them) can help you further with it.
Answer by PJisAnarchist · Mar 21, 2015 at 02:40 PM
Yeah, thanks. I just solved it an hour ago with:
1 - dot (s.Normal, lightDir);
But it didnt helped me much, and I discovered a bug. I have an alpha'd shader on a second object over a first one, and if the second object is a plane, I cant see thru the opaque areas, while if is a sphere, I can. It makes no sense, I may bug report that.
Anyway, thx Siaran for the kind answer. PJ
Your answer
Follow this Question
Related Questions
Blending and Decaying Alphas 0 Answers
Alpha not displaying when changed in code, unless changed manually in the inspector 0 Answers
Shader that makes object transparent as light hits it 0 Answers
Fading in/out SVGs without showing the half-transparent SVG-layers 1 Answer
Can someone add a 2D texture alpha mask to this planet shader 0 Answers