- Home /
 
Add Light To Shader
Hi guys I wrote a shader which one blend 2 textures :
_MainTexture is drawed normaly
_SecondTexture is blended to _MainTexture but it is visible when _Mask is on _SecondTexture
Shader work's perfectly but I dont know how to add light to it.
 Properties
    {
           _Color ("Main Color (A=Opacity)", Color) = (1,1,1,1)
          _MainTex ("Base (A=Opacity)", 2D) = ""
          _SecondTexture ("Second Texture (A=Opacity)", 2D) = ""
           _Mask ("Culling Mask", 2D) = "white" {}    
    }
    SubShader
    {
       Pass
       {
          Lighting On
          Blend SrcAlpha OneMinusSrcAlpha
          SetTexture [_Mask] {combine texture * constant ConstantColor[_Color]}
          SetTexture [_SecondTexture] {
          ConstantColor[_Color]
          combine texture * previous
          }
          SetTexture [_MainTex] {
          combine texture  + previous
          }
       }
    }
 
               I trying turn Light On or add tags but when I move any lights to object with this shader then light is not affect on it. I want to achive effect like on standard Diffuse shader
Answer by Cruz.Guinho · Jan 16, 2015 at 01:34 AM
You can use a simple Lambert surface shader, and set your combined textures. like this http://docs.unity3d.com/Manual/SL-SurfaceShaderExamples.html
Your answer
 
             Follow this Question
Related Questions
3D Text Shader with light 0 Answers
point light custom falloff 2 Answers
Particles dont receive light correctly 2 Answers
Line Renderer Ilumination 1 Answer
Specularity Material Problem 0 Answers