Hey everybody
I’m new to shaders and i’m trying to make a shader that is totally black and casts a pitch black shadow.
So far i’ve tried this:
Shader "Custom/Testimus" {
Properties {
_Color ("Color", Color) = (1.0,1.0,1.0,1.0)
_Color1 ("Shadow Color", Color) = (1,1,1,1)
}
SubShader {
Pass{
CGPROGRAM
//Pragmas
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_fwdbase
#pragma fragmentoption ARB_precision_hint_fastest
#include "UnityCG.cginc"
#include "AutoLight.cginc"
struct appdata_pos
{
float4 vertex : POSITION;
};
struct v2f
{
float4 pos : SV_POSITION;
LIGHTING_COORDS (0,1)
};
v2f vert (appdata_pos v)
{
v2f o;
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
TRANSFER_VERTEX_TO_FRAGMENT(o);
return o;
}
fixed4 _Color1;
fixed4 frag(v2f i) : COLOR
{
return _Color1 * LIGHT_ATTENUATION(i);
}
//User defined variable
uniform float4 _Color;
//Base input structs
struct vertexInput{
float4 vertex : POSITION;
};
struct vertexOutput{
float4 pos : SV_POSITION;
};
//Vertex function
vertexOutput vert(vertexInput v){
vertexOutput o;
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
return o;
}
//fragment function
float4 frag(vertexOutput i) : COLOR
{
return _Color;
}
ENDCG
}
}
Fallback "Diffuse"
Fallback "VertexLit"
}
Some of this is still a little confusing to me, but i followed some different guides and now i’m here.
The shader color is fine, and as long as 2 boxes don’t have this same shader, then the pitch black shadow works fine, until i got it on both, then it stops casting the shadow
Any kind of advise is GREATLY appreciated