Skip to content

Instantly share code, notes, and snippets.

@matthewholliday
Created June 5, 2022 22:41
Show Gist options
  • Save matthewholliday/c26e64d94178e09f26c734c830bb37f4 to your computer and use it in GitHub Desktop.
Save matthewholliday/c26e64d94178e09f26c734c830bb37f4 to your computer and use it in GitHub Desktop.
Unity Diffuse Shader Template
Shader "MatthewShaders/StandardDiffuse"
{
Properties
{
//Defining a property that will be used to set the Albedo for this material.
_Color ("Color", Color) = (1,1,1,1)
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types.
#pragma surface surf Standard fullforwardshadows
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
//Not being used, but the compiler will not allow this to be empty.
struct Input
{
float2 uv_MainTex;
};
//This variable will contain the value from the _Color property set in the inspector.
fixed4 _Color;
void surf (Input IN, inout SurfaceOutputStandard o)
{
//We set the Albedo property of the SurfaceOutputStandard struct based on the _Color property.
o.Albedo = _Color.rgb;
}
ENDCG
}
FallBack "Diffuse"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment