Guest User

Untitled

a guest
Jun 24th, 2013
446
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Shader "GameboyRamp"
  2. {
  3. Properties
  4. {
  5. _LightinRamp("_LightinRamp", 2D) = "white" {}
  6. _MainTexture("_MainTexture", 2D) = "gray" {}
  7. _TexInfluence("_TexInfluence", Range(0,1) ) = 1
  8. _TextureDarkness("_TextureDarkness", Range(0,1) ) = 0.5
  9.  
  10. }
  11.  
  12. SubShader
  13. {
  14. Tags
  15. {
  16. "Queue"="Geometry"
  17. "IgnoreProjector"="False"
  18. "RenderType"="Opaque"
  19.  
  20. }
  21.  
  22.  
  23. Cull Back
  24. ZWrite On
  25. ZTest LEqual
  26. ColorMask RGBA
  27. Fog{
  28. }
  29.  
  30.  
  31. CGPROGRAM
  32. #pragma surface surf BlinnPhongEditor vertex:vert
  33. #pragma target 2.0
  34.  
  35.  
  36. sampler2D _LightinRamp;
  37. sampler2D _MainTexture;
  38. float _TexInfluence;
  39. float _TextureDarkness;
  40.  
  41. struct EditorSurfaceOutput {
  42. half3 Albedo;
  43. half3 Normal;
  44. half3 Emission;
  45. half3 Gloss;
  46. half Specular;
  47. half Alpha;
  48. half4 Custom;
  49. };
  50.  
  51. inline half4 LightingBlinnPhongEditor_PrePass (EditorSurfaceOutput s, half4 light)
  52. {
  53. float4 Luminance0= Luminance( light.xyz ).xxxx;
  54. float4 Subtract0=float4( s.Albedo.x, s.Albedo.y, s.Albedo.z, 1.0 ) - _TextureDarkness.xxxx;
  55. float4 Multiply0=Subtract0 * _TexInfluence.xxxx;
  56. float4 Add1=Luminance0 + Multiply0;
  57. float4 Assemble0=float4(Add1.x, float4( 0.0, 0.0, 0.0, 0.0 ).y, float4( 0.0, 0.0, 0.0, 0.0 ).z, float4( 0.0, 0.0, 0.0, 0.0 ).w);
  58. float4 Tex2D0=tex2D(_LightinRamp,Assemble0.xy);
  59. return Tex2D0;
  60.  
  61. }
  62.  
  63. inline half4 LightingBlinnPhongEditor (EditorSurfaceOutput s, half3 lightDir, half3 viewDir, half atten)
  64. {
  65. half3 h = normalize (lightDir + viewDir);
  66.  
  67. half diff = max (0, dot ( lightDir, s.Normal ));
  68.  
  69. float nh = max (0, dot (s.Normal, h));
  70. float spec = pow (nh, s.Specular*128.0);
  71.  
  72. half4 res;
  73. res.rgb = _LightColor0.rgb * diff;
  74. res.w = spec * Luminance (_LightColor0.rgb);
  75. res *= atten * 2.0;
  76.  
  77. return LightingBlinnPhongEditor_PrePass( s, res );
  78. }
  79.  
  80. struct Input {
  81. float2 uv_MainTexture;
  82.  
  83. };
  84.  
  85. void vert (inout appdata_full v, out Input o) {
  86. float4 VertexOutputMaster0_0_NoInput = float4(0,0,0,0);
  87. float4 VertexOutputMaster0_1_NoInput = float4(0,0,0,0);
  88. float4 VertexOutputMaster0_2_NoInput = float4(0,0,0,0);
  89. float4 VertexOutputMaster0_3_NoInput = float4(0,0,0,0);
  90.  
  91.  
  92. }
  93.  
  94.  
  95. void surf (Input IN, inout EditorSurfaceOutput o) {
  96. o.Normal = float3(0.0,0.0,1.0);
  97. o.Alpha = 1.0;
  98. o.Albedo = 0.0;
  99. o.Emission = 0.0;
  100. o.Gloss = 0.0;
  101. o.Specular = 0.0;
  102. o.Custom = 0.0;
  103.  
  104. float4 Sampled2D0=tex2D(_MainTexture,IN.uv_MainTexture.xy);
  105. float4 Master0_1_NoInput = float4(0,0,1,1);
  106. float4 Master0_2_NoInput = float4(0,0,0,0);
  107. float4 Master0_3_NoInput = float4(0,0,0,0);
  108. float4 Master0_4_NoInput = float4(0,0,0,0);
  109. float4 Master0_5_NoInput = float4(1,1,1,1);
  110. float4 Master0_7_NoInput = float4(0,0,0,0);
  111. float4 Master0_6_NoInput = float4(1,1,1,1);
  112. o.Albedo = Sampled2D0;
  113.  
  114. o.Normal = normalize(o.Normal);
  115. }
  116. ENDCG
  117. }
  118. Fallback "Diffuse"
  119. }
RAW Paste Data