Advertisement
Guest User

Sprites-Bumpmapped

a guest
Nov 20th, 2013
1,214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. Shader "Sprites/Bumpmapped"
  2. {
  3. Properties
  4. {
  5. [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
  6. _Color ("Tint", Color) = (1,1,1,1)
  7. [MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
  8. }
  9.  
  10. SubShader
  11. {
  12. Tags
  13. {
  14. "Queue"="Transparent"
  15. "IgnoreProjector"="True"
  16. "RenderType"="Transparent"
  17. "PreviewType"="Plane"
  18. "CanUseSpriteAtlas"="True"
  19. }
  20. LOD 300
  21.  
  22. Cull Off
  23. Lighting Off
  24. ZWrite Off
  25. Fog { Mode Off }
  26. Blend SrcAlpha OneMinusSrcAlpha
  27.  
  28. CGPROGRAM
  29. #pragma surface surf Lambert alpha vertex:vert
  30. #pragma multi_compile DUMMY PIXELSNAP_ON
  31.  
  32. sampler2D _MainTex;
  33. fixed4 _Color;
  34.  
  35. struct Input
  36. {
  37. float2 uv_MainTex;
  38. fixed4 color;
  39. };
  40.  
  41. void vert (inout appdata_full v, out Input o)
  42. {
  43. #if defined(PIXELSNAP_ON) && !defined(SHADER_API_FLASH)
  44. v.vertex = UnityPixelSnap (v.vertex);
  45. #endif
  46. v.normal = float3(0,0,-1);
  47. v.tangent = float4(1, 0, 0, -1);
  48.  
  49. UNITY_INITIALIZE_OUTPUT(Input, o);
  50. o.color = _Color;
  51. }
  52.  
  53. void surf (Input IN, inout SurfaceOutput o)
  54. {
  55. fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * IN.color;
  56. o.Albedo = c.rgb;
  57. o.Alpha = c.a;
  58. o.Normal = UnpackNormal(tex2D(_MainTex, IN.uv_MainTex+float2(0.5, 0)));
  59. }
  60. ENDCG
  61. }
  62.  
  63. Fallback "Sprites/Diffuse"
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement