Skip to content

Instantly share code, notes, and snippets.

@smokelore
Last active May 29, 2016 19:39
Show Gist options
  • Save smokelore/0529724b692f606a419831a7fbc6cf52 to your computer and use it in GitHub Desktop.
Save smokelore/0529724b692f606a419831a7fbc6cf52 to your computer and use it in GitHub Desktop.
Shader "CookbookShaders/StandardDiffuse3" {
Properties {
_Color ("Color", Color) = (1, 1, 1, 1)
_AmbientColor ("Ambient Color", Color) = (1, 1, 1, 1)
_MySliderValue ("This is a Slider", Range(0, 10)) = 2.5
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
// We need to declare the properties variable type inside of the
// CGPROGRAM so we can access its value from the properties block.
CGPROGRAM
#pragma surface surf Standard fullforwardshadows
#pragma target 3.0
struct Input {
float2 uv_MainTex;
};
fixed4 _Color;
float4 _AmbientColor;
float _MySliderValue;
void surf (Input IN, inout SurfaceOutputStandard o) {
// We can then use the properties' values in our shader
fixed4 c = pow((_Color + _AmbientColor), _MySliderValue);
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment