- Home /
How to add Vertex color to Emission color on this shader?
I have this shader that I have hacked together from ones I found "if you recognize the code, thankyou!"
Shader "Game/Terrain" {
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" {}
_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
}
SubShader {
ZWrite on
Alphatest Greater [_Cutoff]
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="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
}
}
}
}
My Question is how would I change it so that the vertex color is added to the emission color, so that if I set the vertex color to red the objects glows red. The same way setting the emission color to red does now.
Thank you
Comment
Best Answer
Answer by MCHammond · Feb 03, 2013 at 04:34 PM
I have achieved the desired effect by changing line 23:
From: ColorMaterial AmbientAndDiffuse
To: ColorMaterial Emission