- Home /
Simple vertex color + light shader
Hello developers, I have this simple shader here which reads vertex colors from the 3D model...
Shader "Vertex Color Lit" {
Properties {
_MainTex ("Texture", 2D) = "white" {}
}
SubShader {
Tags { "Queue"="Geometry" }
Pass {
BindChannels {
Bind "Color", color
Bind "Vertex", vertex
Bind "TexCoord", texcoord
}
SetTexture [_MainTex] {
Combine texture * primary
}
}
}
}
I'm having some hard times at adding basic illumination to it. Adding a simple Lighting On
in the Pass makes the object look deep black. I kept trying for an hour without success, I'm pretty sure I'm missing something very basic here. Thanks for anyone willing to help!
Comment
Best Answer
Answer by DanjelRicci · Sep 26, 2014 at 10:10 AM
I found a different shader which works perfectly. I didn't need the BindChannels
instructions, I just needed the ColorMaterial AmbientAndDiffuse
instruction. Here's the shader:
Shader "Vertex Color Lit" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader {
Pass {
Lighting On
ColorMaterial AmbientAndDiffuse
SetTexture [_MainTex] {
combine texture * primary DOUBLE
}
}
}
}