Simple ShaderLab code for Flat color material


// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'</code>

Shader "Custom/SimpleShader" {
Properties {
  _AmbientLightColor("Ambient Light", Color) = (1,1,1,1)
  _AmbientLightIntensity("Ambient Light Intensity", Range(0.0,1.0)) = 1.0
}
SubShader
{
  Pass
  {
   CGPROGRAM

   #pragma vertex vertexShader
   #pragma fragment fragmentShader

   fixed4 _AmbientLightColor;
   float _AmbientLightIntensity;

   //Input : POSITION
   //Output: SV_POSITION
   float4 vertexShader(float4 v:POSITION) : SV_POSITION
   {
     //The vertex position is multiplied
     //with the MVP matrices of Unity.

     return UnityObjectToClipPos(v);
   }

   //OUTPUT : A render target
   fixed4 fragmentShader() : SV_Target
   {
     return _AmbientLightColor * _AmbientLightIntensity;
   }

   ENDCG
  }
 }
}

About Max
My Interests: ------------------ Programming

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: