mask 1.shader 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. // Made with Amplify Shader Editor
  2. // Available at the Unity Asset Store - http://u3d.as/y3X
  3. Shader "UV"
  4. {
  5. Properties
  6. {
  7. _TMD("TMD", Float) = 0
  8. _AO("AO", 2D) = "white" {}
  9. _Int("Int", Float) = 0
  10. _MASK("MASK", 2D) = "white" {}
  11. _Float0("Float 0", Float) = 0
  12. [HideInInspector] _texcoord2( "", 2D ) = "white" {}
  13. [HideInInspector] _texcoord( "", 2D ) = "white" {}
  14. [HideInInspector] __dirty( "", Int ) = 1
  15. }
  16. SubShader
  17. {
  18. Pass
  19. {
  20. ColorMask 0
  21. ZTest LEqual
  22. ZWrite On
  23. }
  24. Tags{ "RenderType" = "Transparent" "Queue" = "Geometry+0" "IsEmissive" = "true" }
  25. Cull Back
  26. ZWrite Off
  27. Blend SrcAlpha OneMinusSrcAlpha , SrcAlpha OneMinusSrcAlpha
  28. CGINCLUDE
  29. #include "UnityPBSLighting.cginc"
  30. #include "Lighting.cginc"
  31. #pragma target 3.0
  32. struct Input
  33. {
  34. float2 uv_texcoord;
  35. float2 uv2_texcoord2;
  36. };
  37. uniform sampler2D _AO;
  38. uniform float4 _AO_ST;
  39. uniform float _Int;
  40. uniform float _TMD;
  41. uniform sampler2D _MASK;
  42. uniform float _Float0;
  43. inline half4 LightingUnlit( SurfaceOutput s, half3 lightDir, half atten )
  44. {
  45. return half4 ( 0, 0, 0, s.Alpha );
  46. }
  47. void surf( Input i , inout SurfaceOutput o )
  48. {
  49. float2 uv_AO = i.uv_texcoord * _AO_ST.xy + _AO_ST.zw;
  50. o.Emission = ( tex2D( _AO, uv_AO ) * _Int ).rgb;
  51. float4 temp_cast_1 = (_TMD).xxxx;
  52. o.Alpha = max( temp_cast_1 , ( tex2D( _MASK, i.uv2_texcoord2 ) * _Float0 ) ).r;
  53. }
  54. ENDCG
  55. CGPROGRAM
  56. #pragma surface surf Unlit keepalpha fullforwardshadows
  57. ENDCG
  58. Pass
  59. {
  60. Name "ShadowCaster"
  61. Tags{ "LightMode" = "ShadowCaster" }
  62. ZWrite On
  63. CGPROGRAM
  64. #pragma vertex vert
  65. #pragma fragment frag
  66. #pragma target 3.0
  67. #pragma multi_compile_shadowcaster
  68. #pragma multi_compile UNITY_PASS_SHADOWCASTER
  69. #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2
  70. #include "HLSLSupport.cginc"
  71. #if ( SHADER_API_D3D11 || SHADER_API_GLCORE || SHADER_API_GLES || SHADER_API_GLES3 || SHADER_API_METAL || SHADER_API_VULKAN )
  72. #define CAN_SKIP_VPOS
  73. #endif
  74. #include "UnityCG.cginc"
  75. #include "Lighting.cginc"
  76. #include "UnityPBSLighting.cginc"
  77. sampler3D _DitherMaskLOD;
  78. struct v2f
  79. {
  80. V2F_SHADOW_CASTER;
  81. float4 customPack1 : TEXCOORD1;
  82. float3 worldPos : TEXCOORD2;
  83. UNITY_VERTEX_INPUT_INSTANCE_ID
  84. UNITY_VERTEX_OUTPUT_STEREO
  85. };
  86. v2f vert( appdata_full v )
  87. {
  88. v2f o;
  89. UNITY_SETUP_INSTANCE_ID( v );
  90. UNITY_INITIALIZE_OUTPUT( v2f, o );
  91. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o );
  92. UNITY_TRANSFER_INSTANCE_ID( v, o );
  93. Input customInputData;
  94. float3 worldPos = mul( unity_ObjectToWorld, v.vertex ).xyz;
  95. half3 worldNormal = UnityObjectToWorldNormal( v.normal );
  96. o.customPack1.xy = customInputData.uv_texcoord;
  97. o.customPack1.xy = v.texcoord;
  98. o.customPack1.zw = customInputData.uv2_texcoord2;
  99. o.customPack1.zw = v.texcoord1;
  100. o.worldPos = worldPos;
  101. TRANSFER_SHADOW_CASTER_NORMALOFFSET( o )
  102. return o;
  103. }
  104. half4 frag( v2f IN
  105. #if !defined( CAN_SKIP_VPOS )
  106. , UNITY_VPOS_TYPE vpos : VPOS
  107. #endif
  108. ) : SV_Target
  109. {
  110. UNITY_SETUP_INSTANCE_ID( IN );
  111. Input surfIN;
  112. UNITY_INITIALIZE_OUTPUT( Input, surfIN );
  113. surfIN.uv_texcoord = IN.customPack1.xy;
  114. surfIN.uv2_texcoord2 = IN.customPack1.zw;
  115. float3 worldPos = IN.worldPos;
  116. half3 worldViewDir = normalize( UnityWorldSpaceViewDir( worldPos ) );
  117. SurfaceOutput o;
  118. UNITY_INITIALIZE_OUTPUT( SurfaceOutput, o )
  119. surf( surfIN, o );
  120. #if defined( CAN_SKIP_VPOS )
  121. float2 vpos = IN.pos;
  122. #endif
  123. half alphaRef = tex3D( _DitherMaskLOD, float3( vpos.xy * 0.25, o.Alpha * 0.9375 ) ).a;
  124. clip( alphaRef - 0.01 );
  125. SHADOW_CASTER_FRAGMENT( IN )
  126. }
  127. ENDCG
  128. }
  129. }
  130. Fallback "Diffuse"
  131. CustomEditor "ASEMaterialInspector"
  132. }
  133. /*ASEBEGIN
  134. Version=18703
  135. 1934;128;1906;967;1214.932;398.2451;1.460677;True;True
  136. Node;AmplifyShaderEditor.TextureCoordinatesNode;93;-342.9869,132.2362;Inherit;False;1;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  137. Node;AmplifyShaderEditor.SamplerNode;92;-23.80075,129.9149;Inherit;True;Property;_MASK;MASK;4;0;Create;True;0;0;False;0;False;-1;None;af74e589ca46f32409cc29d79a3d5fab;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  138. Node;AmplifyShaderEditor.RangedFloatNode;95;178.5536,444.5653;Inherit;False;Property;_Float0;Float 0;5;0;Create;True;0;0;False;0;False;0;0.95;0;0;0;1;FLOAT;0
  139. Node;AmplifyShaderEditor.SamplerNode;88;10.19949,-748.707;Inherit;True;Property;_AO;AO;2;0;Create;True;0;0;False;0;False;-1;None;bd67a39ef7b25384f879fc48014d7c98;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  140. Node;AmplifyShaderEditor.RangedFloatNode;90;126.5354,-413.7923;Inherit;False;Property;_Int;Int;3;0;Create;True;0;0;False;0;False;0;1;0;0;0;1;FLOAT;0
  141. Node;AmplifyShaderEditor.RangedFloatNode;77;89.88595,-198.7182;Inherit;False;Property;_TMD;TMD;1;0;Create;True;0;0;False;0;False;0;1;0;0;0;1;FLOAT;0
  142. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;94;453.1608,320.4077;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0
  143. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;89;350.5354,-552.7923;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0
  144. Node;AmplifyShaderEditor.SimpleMaxOpNode;91;479.6775,63.62598;Inherit;False;2;0;FLOAT;0;False;1;COLOR;0,0,0,0;False;1;COLOR;0
  145. Node;AmplifyShaderEditor.StandardSurfaceOutputNode;0;634.314,-506.8333;Float;False;True;-1;2;ASEMaterialInspector;0;0;Unlit;UV;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;Back;2;False;-1;0;False;-1;False;0;False;-1;0;False;-1;True;3;Custom;0.5;True;True;0;True;Transparent;;Geometry;All;14;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;2;5;False;-1;10;False;-1;2;5;False;-1;10;False;-1;0;False;-1;0;False;-1;0;False;0;0,0,0,0;VertexOffset;True;False;Cylindrical;False;Relative;0;;0;-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;15;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT;0;False;4;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
  146. WireConnection;92;1;93;0
  147. WireConnection;94;0;92;0
  148. WireConnection;94;1;95;0
  149. WireConnection;89;0;88;0
  150. WireConnection;89;1;90;0
  151. WireConnection;91;0;77;0
  152. WireConnection;91;1;94;0
  153. WireConnection;0;2;89;0
  154. WireConnection;0;9;91;0
  155. ASEEND*/
  156. //CHKSM=BE6AA1339E3BE8CCA2EF3815D66EED4332DBA5B5