- Home /
 
 
               Question by 
               AVOlight · Jan 26, 2015 at 01:33 AM · 
                shadervertex colorvertex-lighting  
              
 
              Easy way to add Lighting to custom Vertex shader
Looking for an easy way to add lighting to my simple vertex shader
 Shader "LiveMesh/Simple" {
      SubShader {
         Tags {"RenderType"="Transparent" "Queue"="Transparent"}
         Fog { Mode Off }
         Lighting On
 
        Pass {
         ZWrite On
         Cull Back
         Blend SrcAlpha OneMinusSrcAlpha
 
         CGPROGRAM
         #pragma vertex vert
         #pragma fragment frag
 
         struct VertexInput {
             fixed4 vertex : POSITION;
             fixed4 color : COLOR;
             //fixed3 normal : NORMAL;
             //fixed4 tangent : TANGENT;
             //fixed4 texcoord : TEXCOORD;
             //fixed4 texcoord1 : TEXCOORD1;
         };
         struct VertexOutput {
             fixed4 pos : SV_POSITION;
             fixed4 col : COLOR;
         };
 
         VertexOutput vert (VertexInput v) {
 
             VertexOutput o;
             o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
             o.col = v.color;
             
             return o;
         }
 
         fixed4 frag(VertexOutput o) : COLOR {
             return o.col;
         }
 
          ENDCG
         }
      }
    }
 
              
               Comment
              
 
               
              Your answer