Building.shader 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. // Made with Amplify Shader Editor
  2. // Available at the Unity Asset Store - http://u3d.as/y3X
  3. Shader "ADON/Building"
  4. {
  5. Properties
  6. {
  7. _Color0("Color 0", Color) = (0,0,0,0)
  8. _Cutoff( "Mask Clip Value", Float ) = 0
  9. _StartDitheringFade("Start Dithering Fade", Float) = 0
  10. _EndDitheringFade("End Dithering Fade", Float) = 1
  11. [HideInInspector] __dirty( "", Int ) = 1
  12. }
  13. SubShader
  14. {
  15. Tags{ "RenderType" = "TransparentCutout" "Queue" = "AlphaTest+0" "IgnoreProjector" = "True" }
  16. Cull Back
  17. CGPROGRAM
  18. #include "UnityShaderVariables.cginc"
  19. #pragma target 3.0
  20. #pragma surface surf StandardSpecular keepalpha addshadow fullforwardshadows vertex:vertexDataFunc
  21. struct Input
  22. {
  23. float eyeDepth;
  24. float4 screenPosition;
  25. };
  26. uniform float4 _Color0;
  27. uniform float _StartDitheringFade;
  28. uniform float _EndDitheringFade;
  29. uniform float _Cutoff = 0;
  30. inline float Dither8x8Bayer( int x, int y )
  31. {
  32. const float dither[ 64 ] = {
  33. 1, 49, 13, 61, 4, 52, 16, 64,
  34. 33, 17, 45, 29, 36, 20, 48, 32,
  35. 9, 57, 5, 53, 12, 60, 8, 56,
  36. 41, 25, 37, 21, 44, 28, 40, 24,
  37. 3, 51, 15, 63, 2, 50, 14, 62,
  38. 35, 19, 47, 31, 34, 18, 46, 30,
  39. 11, 59, 7, 55, 10, 58, 6, 54,
  40. 43, 27, 39, 23, 42, 26, 38, 22};
  41. int r = y * 8 + x;
  42. return dither[r] / 64; // same # of instructions as pre-dividing due to compiler magic
  43. }
  44. void vertexDataFunc( inout appdata_full v, out Input o )
  45. {
  46. UNITY_INITIALIZE_OUTPUT( Input, o );
  47. o.eyeDepth = -UnityObjectToViewPos( v.vertex.xyz ).z;
  48. float4 ase_screenPos = ComputeScreenPos( UnityObjectToClipPos( v.vertex ) );
  49. o.screenPosition = ase_screenPos;
  50. }
  51. void surf( Input i , inout SurfaceOutputStandardSpecular o )
  52. {
  53. o.Albedo = _Color0.rgb;
  54. o.Alpha = 1;
  55. float temp_output_25_0 = ( _StartDitheringFade + _ProjectionParams.y );
  56. float4 ase_screenPos = i.screenPosition;
  57. float4 ase_screenPosNorm = ase_screenPos / ase_screenPos.w;
  58. ase_screenPosNorm.z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? ase_screenPosNorm.z : ase_screenPosNorm.z * 0.5 + 0.5;
  59. float2 clipScreen31 = ase_screenPosNorm.xy * _ScreenParams.xy;
  60. float dither31 = Dither8x8Bayer( fmod(clipScreen31.x, 8), fmod(clipScreen31.y, 8) );
  61. clip( ( ( ( i.eyeDepth + -temp_output_25_0 ) / ( _EndDitheringFade - temp_output_25_0 ) ) - dither31 ) - _Cutoff );
  62. }
  63. ENDCG
  64. }
  65. Fallback "Diffuse"
  66. CustomEditor "ASEMaterialInspector"
  67. }
  68. /*ASEBEGIN
  69. Version=18909
  70. 505;198;1473;711;2973.224;678.0644;2.980381;True;True
  71. Node;AmplifyShaderEditor.CommentaryNode;22;-1518.002,1514.104;Inherit;False;297.1897;243;Correction for near plane clipping;1;23;;1,1,1,1;0;0
  72. Node;AmplifyShaderEditor.ProjectionParams;23;-1445.302,1563.404;Inherit;False;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  73. Node;AmplifyShaderEditor.RangedFloatNode;24;-1492.217,1341.683;Float;False;Property;_StartDitheringFade;Start Dithering Fade;3;0;Create;True;0;0;0;False;0;False;0;0;0;0;0;1;FLOAT;0
  74. Node;AmplifyShaderEditor.SimpleAddOpNode;25;-1206.725,1345.215;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
  75. Node;AmplifyShaderEditor.RangedFloatNode;26;-1025.753,1302.688;Float;False;Property;_EndDitheringFade;End Dithering Fade;4;0;Create;True;0;0;0;False;0;False;1;12;0;0;0;1;FLOAT;0
  76. Node;AmplifyShaderEditor.NegateNode;28;-1015.338,1221.335;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
  77. Node;AmplifyShaderEditor.SurfaceDepthNode;27;-1465.634,1157.101;Inherit;False;0;1;0;FLOAT3;0,0,0;False;1;FLOAT;0
  78. Node;AmplifyShaderEditor.SimpleAddOpNode;29;-806.2531,1161.789;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
  79. Node;AmplifyShaderEditor.SimpleSubtractOpNode;30;-808.9528,1316.588;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
  80. Node;AmplifyShaderEditor.SimpleDivideOpNode;32;-622.453,1218.289;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
  81. Node;AmplifyShaderEditor.DitheringNode;31;-428.2169,1303.594;Inherit;False;1;False;4;0;FLOAT;0;False;1;SAMPLER2D;;False;2;FLOAT4;0,0,0,0;False;3;SAMPLERSTATE;;False;1;FLOAT;0
  82. Node;AmplifyShaderEditor.SimpleSubtractOpNode;33;-172.2169,1223.594;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
  83. Node;AmplifyShaderEditor.ColorNode;19;-665.246,-7.055243;Inherit;False;Property;_Color0;Color 0;0;0;Create;True;0;0;0;False;0;False;0,0,0,0;0.2713153,0.4291188,0.8584906,1;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  84. Node;AmplifyShaderEditor.RangedFloatNode;21;-303.4442,182.8889;Inherit;False;Property;_Float0;Float 0;1;0;Create;True;0;0;0;False;0;False;0;1;0;0;0;1;FLOAT;0
  85. Node;AmplifyShaderEditor.StandardSurfaceOutputNode;0;-2.816066,-2.816066;Float;False;True;-1;2;ASEMaterialInspector;0;0;StandardSpecular;ADON/Building;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;False;False;False;False;False;False;Back;0;False;-1;0;False;-1;False;0;False;-1;0;False;-1;False;0;Masked;0;True;True;0;False;TransparentCutout;;AlphaTest;All;16;all;True;True;True;True;0;False;-1;False;0;False;-1;255;False;-1;255;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;False;2;15;10;25;False;0.5;True;0;5;False;-1;10;False;-1;0;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;0;0.6084906,0.8249723,1,0;VertexOffset;True;False;Cylindrical;False;Relative;0;;2;-1;-1;-1;0;False;0;0;False;-1;-1;0;False;-1;0;0;0;False;0.1;False;-1;0;False;-1;False;16;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT3;0,0,0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT3;0,0,0;False;7;FLOAT3;0,0,0;False;8;FLOAT;0;False;9;FLOAT;0;False;10;FLOAT;0;False;13;FLOAT3;0,0,0;False;11;FLOAT3;0,0,0;False;12;FLOAT3;0,0,0;False;14;FLOAT4;0,0,0,0;False;15;FLOAT3;0,0,0;False;0
  86. WireConnection;25;0;24;0
  87. WireConnection;25;1;23;2
  88. WireConnection;28;0;25;0
  89. WireConnection;29;0;27;0
  90. WireConnection;29;1;28;0
  91. WireConnection;30;0;26;0
  92. WireConnection;30;1;25;0
  93. WireConnection;32;0;29;0
  94. WireConnection;32;1;30;0
  95. WireConnection;33;0;32;0
  96. WireConnection;33;1;31;0
  97. WireConnection;0;0;19;0
  98. WireConnection;0;10;33;0
  99. ASEEND*/
  100. //CHKSM=5C26860FDF8FA85BF3E1B6CF06ACA37698F02E80