- Home /
 
Shader which supports vertex colors and pixel lights?
Hello everyone, I'm facing a bit of a problem here: I need a shader which has the ability to colour individual vertices and be lit pixel by pixel. Until recently, I was planning to use just vertex shading, since I couldn't find any info about this. The thing, it looks like this: 
 
 As you can see, it is horrendously bizarre and even glitchy. Here is the shader I'm using right now:
 Shader "Alpha/VertexLit Colored" {
     Properties {
         _Color ("Main Color", Color) = (1,1,1,1)
         _SpecColor ("Spec Color", Color) = (1,1,1,0)
         _Emission ("Emmisive Color", Color) = (0,0,0,0)
         _Shininess ("Shininess", Range (0.01, 1)) = 0.7
         _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
     }
 
     SubShader {
         //ZWrite Off
         Alphatest Greater 0
         Tags {Queue=Transparent}
         Blend SrcAlpha OneMinusSrcAlpha 
         ColorMask RGB
         Pass {
             Material {
                 Shininess [_Shininess]
                 Specular [_SpecColor]
                 Emission [_Emission]    
             }
             ColorMaterial AmbientAndDiffuse
             Lighting On
             SeparateSpecular On
             SetTexture [_MainTex] {
                 Combine texture * primary, texture * primary
             }
             SetTexture [_MainTex] {
                 constantColor [_Color]
                 Combine previous * constant DOUBLE, previous * constant
             }
         }
     }
     Fallback "Alpha/VertexLit", 1
 }
 
              Answer by kroltan_ · Feb 08, 2014 at 05:45 PM
Answered at: http://gamedev.stackexchange.com/questions/68132/shader-which-supports-vertex-colors-and-pixel-lights
Your answer
 
             Follow this Question
Related Questions
Local position in vertex shader? 1 Answer
Quad vertex color shader 0 Answers
Shader - Using Multiple Pass for different shader target 1 Answer
Does AlphaToMask works in unity ? 0 Answers
Shader mesh not being effected by directional lights? 1 Answer