- Home /
Question by
Light997 · Jun 22, 2015 at 08:52 PM ·
shaderlightingshadowshader writing
Combining a custom shader with a normal one
Hello, I wanted to ask if it is possible to combine the following two shaders in Unity:
A custom Vertexcolor shader I made so that I could import vertexpainted models from Blender
The Unity Toon shader
I want to combine them because the Vertexcolor shader does not react to light, which is a big problem since my game is heavily based on lighting.
Here's the script for my custom shader:
Shader "Custom/Vertexcolors" {
Properties {
}
SubShader {
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
struct vertexInput {
float4 vertex : POSITION;
float4 color : COLOR;
};
struct vertexOutput {
float4 pos : SV_POSITION;
float4 vertCol: COLOR;
};
vertexOutput vert(vertexInput v){
vertexOutput o;
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
o.vertCol = v.color;
return o;
}
float4 frag(vertexOutput i) : COLOR
{
return i.vertCol;
}
ENDCG
}
}
//FallBack "Diffuse"
}
Comment