Single color shader example in the Built-In Render Pipeline
HLSL shader examples in the Built-in Render Pipeline
Checkerboard pattern shader example in the Built-In Render Pipeline
Single color shader example in the Built-In Render Pipeline
Shader "Unlit/SingleColor"
{
Properties
{
// Color property for material inspector, default to white
_Color ("Main Color", Color) = (1,1,1,1)
}
SubShader
{
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
// vertex shader
// this time instead of using "appdata" struct, just spell inputs manually,
// and instead of returning v2f struct, also just return a single output
// float4 clip position
float4 vert (float4 vertex : POSITION) : SV_POSITION
{
return mul(UNITY_MATRIX_MVP, vertex);
}
// color from the material
fixed4 _Color;
// pixel shader, no inputs needed
fixed4 frag () : SV_Target
{
return _Color; // just return it
}
ENDCG
}
}
}
HLSL shader examples in the Built-in Render Pipeline
Checkerboard pattern shader example in the Built-In Render Pipeline