- Home /
Change specific vertex colours in a shader
So, I have a super simple vertex shader set up. What it does currently is pull the vertex colours and display them. Duh. But, what I'd like it to do is pull the vertex colours, maybe store them in variables or an array, and then allow me to recolour each vertex colour independent of the other.
I know that I can use RGB as a sort of masking technique, but what if I had more colours than simply RGB?
Here is my super simple shader currently for reference. Thanks!! :D
Shader "vertexColor_shader"
{
Properties
{
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB)", 2D) = "white"{}
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Lambert
#pragma vertex vert
float4 _Color;
sampler2D _MainTex;
struct Input
{
float3 vertColors;
float2 uv_MainTex;
};
void vert(inout appdata_full v, out Input o)
{
UNITY_INITIALIZE_OUTPUT(Input,o)
o.vertColors = v.color.rgb;
}
void surf (Input IN, inout SurfaceOutput o)
{
half4 tex = tex2D (_MainTex, IN.uv_MainTex);
o.Albedo = tex.rgb * _Color.rgb * IN.vertColors;
o.Alpha = tex.a;
}
ENDCG
}
FallBack "Diffuse"
}
Not sure if this bumps, or if bumping is even allowed, but I definitely still need a bit of advice on this. ^_^
Try in the Shaders section of the forums : http://forum.unity3d.com/forums/shaders.16/
Just use the forums period, UA is dead.
Have posted there also. :P
I didn't realize UA was dead? o_O Admittedly I have't been around in awhile... What did I miss? :O