Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save yasuakiohama/a20ab6142978fdb6ab1c to your computer and use it in GitHub Desktop.
Save yasuakiohama/a20ab6142978fdb6ab1c to your computer and use it in GitHub Desktop.
Example-Diffuse Texture SimpleLambert.Shader
Shader "Example/Diffuse Texture2" {
Properties {
_MainTex ("Texture", 2D) = "white" {}
}
SubShader {
Tags { "RenderType" = "Opaque" }
CGPROGRAM
#pragma surface surf SimpleLambert
half4 LightingSimpleLambert (SurfaceOutput s, half3 lightDir, half atten) {
half NdotL = dot (s.Normal, lightDir);
half4 c;
c.rgb = s.Albedo * _LightColor0.rgb * (NdotL * atten * 2);
c.a = s.Alpha;
return c;
}
struct Input {
float2 uv_MainTex;
};
sampler2D _MainTex;
void surf (Input IN, inout SurfaceOutput o) {
o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb;
}
ENDCG
}
Fallback "Diffuse"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment