Advertisement
Guest User

Untitled

a guest
Jun 27th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. Shader "CookbookShaders/SimpleLambert"
  2. {
  3. Properties
  4. {
  5. _MainTex ("Albedo (RGB)", 2D) = "white" {}
  6. }
  7. SubShader
  8. {
  9. Tags { "RenderType"="Opaque" }
  10. LOD 200
  11.  
  12. CGPROGRAM
  13. // Instead of Standard, use a custom lighting model
  14. #pragma surface surf SimpleLambert
  15.  
  16. #pragma target 3.0
  17.  
  18. sampler2D _MainTex;
  19.  
  20. struct Input
  21. {
  22. float2 uv_MainTex;
  23. };
  24.  
  25. void surf (Input IN, inout SurfaceOutput o)
  26. {
  27. o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb;
  28. }
  29.  
  30. half4 LightingSimpleLambert (SurfaceOutput s, half3 lightDir, half atten)
  31. {
  32. half NdotL = dot(s.Normal, lightDir);
  33. half4 c;
  34. // _LightColor0 variable contains the color of the light that is calculated
  35. c.rgb = s.Albedo * _LightColor0.rgb * (NdotL * atten * 1);
  36. c.a = s.Alpha;
  37.  
  38. return c;
  39. }
  40. ENDCG
  41. }
  42. FallBack "Diffuse"
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement