zrrz111

CullOffDiffuse

Apr 8th, 2016
785
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. Shader "Custom/CullOffDiffuse" {
  2. Properties {
  3. _MainTex ("Base (RGB)", 2D) = "white" {}
  4. }
  5. SubShader {
  6. Tags { "RenderType"="Opaque" }
  7. LOD 200
  8. Cull Back
  9.  
  10. CGPROGRAM
  11. #pragma surface surf Lambert
  12.  
  13. sampler2D _MainTex;
  14.  
  15. struct Input {
  16. float2 uv_MainTex;
  17. };
  18.  
  19. void surf (Input IN, inout SurfaceOutput o) {
  20. half4 c = tex2D (_MainTex, IN.uv_MainTex);
  21. o.Albedo = c.rgb;
  22. o.Alpha = c.a;
  23. }
  24. ENDCG
  25.  
  26. Cull Front
  27.  
  28. CGPROGRAM
  29. #pragma surface surf LightBacks
  30.  
  31. half4 LightingLightBacks (SurfaceOutput s, half3 lightDir, half atten) {
  32. half NdotL = dot (s.Normal * -1, lightDir);
  33. half4 c;
  34. c.rgb = s.Albedo * _LightColor0.rgb * (NdotL * atten);
  35. c.a = s.Alpha;
  36. return c;
  37. }
  38.  
  39. sampler2D _MainTex;
  40.  
  41. struct Input {
  42. float2 uv_MainTex;
  43. };
  44.  
  45. void surf (Input IN, inout SurfaceOutput o) {
  46. half4 c = tex2D (_MainTex, IN.uv_MainTex);
  47. o.Albedo = c.rgb;
  48. o.Alpha = c.a;
  49. }
  50. ENDCG
  51. }
  52. FallBack "Diffuse"
  53. }
Advertisement
Add Comment
Please, Sign In to add comment