ThreeWayBlend.shader 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. // Made with Amplify Shader Editor
  2. // Available at the Unity Asset Store - http://u3d.as/y3X
  3. Shader "Custom/Lordenfel/ThreeWayBlend"
  4. {
  5. Properties
  6. {
  7. _Layer1Albedo("Layer 1 Albedo", 2D) = "white" {}
  8. _Layer1Normal("Layer 1 Normal", 2D) = "bump" {}
  9. _Layer1SmoothnessMin("Layer 1 Smoothness Min", Float) = 0.2
  10. _Layer3SmoothnessMin("Layer 3 Smoothness Min", Float) = 0.2
  11. _Layer2SmoothnessMin("Layer 2 Smoothness Min", Float) = 0.2
  12. _Layer1SmoothnessMax("Layer 1 Smoothness Max", Float) = 0.8
  13. _Layer3SmoothnessMax("Layer 3 Smoothness Max", Float) = 0.8
  14. _Layer2SmoothnessMax("Layer 2 Smoothness Max", Float) = 0.8
  15. _Layer2Albedo("Layer 2 Albedo", 2D) = "white" {}
  16. _Layer3Albedo("Layer 3 Albedo", 2D) = "white" {}
  17. _Layer2Normal("Layer 2 Normal", 2D) = "bump" {}
  18. _Layer3Normal("Layer 3 Normal", 2D) = "bump" {}
  19. _Specular("Specular", Float) = 0.02
  20. _Layer3EdgeSmoothness("Layer 3 Edge Smoothness", Float) = 50
  21. _Layer3BlendPrecision("Layer 3 Blend Precision", Float) = 5
  22. _Layer2EdgeSmoothness("Layer 2 Edge Smoothness", Float) = 50
  23. _Layer2BlendPrecision("Layer 2 Blend Precision", Float) = 5
  24. [HideInInspector] _texcoord( "", 2D ) = "white" {}
  25. [HideInInspector] __dirty( "", Int ) = 1
  26. }
  27. SubShader
  28. {
  29. Tags{ "RenderType" = "Opaque" "Queue" = "Geometry+0" }
  30. Cull Back
  31. CGPROGRAM
  32. #pragma target 3.0
  33. #pragma surface surf StandardSpecular keepalpha addshadow fullforwardshadows
  34. struct Input
  35. {
  36. float2 uv_texcoord;
  37. float4 vertexColor : COLOR;
  38. };
  39. uniform sampler2D _Layer1Normal;
  40. uniform float4 _Layer1Normal_ST;
  41. uniform sampler2D _Layer2Normal;
  42. uniform float4 _Layer2Normal_ST;
  43. uniform float _Layer2EdgeSmoothness;
  44. uniform float _Layer2BlendPrecision;
  45. uniform sampler2D _Layer1Albedo;
  46. uniform float4 _Layer1Albedo_ST;
  47. uniform sampler2D _Layer3Normal;
  48. uniform float4 _Layer3Normal_ST;
  49. uniform float _Layer3EdgeSmoothness;
  50. uniform float _Layer3BlendPrecision;
  51. uniform sampler2D _Layer2Albedo;
  52. uniform float4 _Layer2Albedo_ST;
  53. uniform sampler2D _Layer3Albedo;
  54. uniform float4 _Layer3Albedo_ST;
  55. uniform float _Specular;
  56. uniform float _Layer1SmoothnessMin;
  57. uniform float _Layer1SmoothnessMax;
  58. uniform float _Layer2SmoothnessMin;
  59. uniform float _Layer2SmoothnessMax;
  60. uniform float _Layer3SmoothnessMin;
  61. uniform float _Layer3SmoothnessMax;
  62. void surf( Input i , inout SurfaceOutputStandardSpecular o )
  63. {
  64. float2 uv_Layer1Normal = i.uv_texcoord * _Layer1Normal_ST.xy + _Layer1Normal_ST.zw;
  65. float2 uv_Layer2Normal = i.uv_texcoord * _Layer2Normal_ST.xy + _Layer2Normal_ST.zw;
  66. float temp_output_2_0_g4 = _Layer2EdgeSmoothness;
  67. float temp_output_5_0_g4 = ( temp_output_2_0_g4 / _Layer2BlendPrecision );
  68. float temp_output_4_0_g4 = ( 1.0 - i.vertexColor.r );
  69. float lerpResult7_g4 = lerp( ( 1.0 - temp_output_5_0_g4 ) , temp_output_5_0_g4 , temp_output_4_0_g4);
  70. float2 uv_Layer1Albedo = i.uv_texcoord * _Layer1Albedo_ST.xy + _Layer1Albedo_ST.zw;
  71. float4 tex2DNode1 = tex2D( _Layer1Albedo, uv_Layer1Albedo );
  72. float lerpResult11_g4 = lerp( ( temp_output_2_0_g4 + lerpResult7_g4 ) , ( ( 1.0 - temp_output_2_0_g4 ) + lerpResult7_g4 ) , tex2DNode1.a);
  73. float clampResult12_g4 = clamp( lerpResult11_g4 , 0.0 , 1.0 );
  74. float lerpResult13_g4 = lerp( 0.0 , clampResult12_g4 , temp_output_4_0_g4);
  75. float temp_output_28_0 = lerpResult13_g4;
  76. float3 lerpResult17 = lerp( UnpackNormal( tex2D( _Layer1Normal, uv_Layer1Normal ) ) , UnpackNormal( tex2D( _Layer2Normal, uv_Layer2Normal ) ) , temp_output_28_0);
  77. float2 uv_Layer3Normal = i.uv_texcoord * _Layer3Normal_ST.xy + _Layer3Normal_ST.zw;
  78. float temp_output_2_0_g5 = _Layer3EdgeSmoothness;
  79. float temp_output_5_0_g5 = ( temp_output_2_0_g5 / _Layer3BlendPrecision );
  80. float temp_output_4_0_g5 = ( 1.0 - i.vertexColor.g );
  81. float lerpResult7_g5 = lerp( ( 1.0 - temp_output_5_0_g5 ) , temp_output_5_0_g5 , temp_output_4_0_g5);
  82. float2 uv_Layer2Albedo = i.uv_texcoord * _Layer2Albedo_ST.xy + _Layer2Albedo_ST.zw;
  83. float4 tex2DNode7 = tex2D( _Layer2Albedo, uv_Layer2Albedo );
  84. float lerpResult18 = lerp( tex2DNode1.a , tex2DNode7.a , temp_output_28_0);
  85. float lerpResult11_g5 = lerp( ( temp_output_2_0_g5 + lerpResult7_g5 ) , ( ( 1.0 - temp_output_2_0_g5 ) + lerpResult7_g5 ) , lerpResult18);
  86. float clampResult12_g5 = clamp( lerpResult11_g5 , 0.0 , 1.0 );
  87. float lerpResult13_g5 = lerp( 0.0 , clampResult12_g5 , temp_output_4_0_g5);
  88. float temp_output_33_0 = lerpResult13_g5;
  89. float3 lerpResult26 = lerp( lerpResult17 , UnpackNormal( tex2D( _Layer3Normal, uv_Layer3Normal ) ) , temp_output_33_0);
  90. o.Normal = lerpResult26;
  91. float4 lerpResult15 = lerp( tex2DNode1 , tex2DNode7 , temp_output_28_0);
  92. float2 uv_Layer3Albedo = i.uv_texcoord * _Layer3Albedo_ST.xy + _Layer3Albedo_ST.zw;
  93. float4 tex2DNode20 = tex2D( _Layer3Albedo, uv_Layer3Albedo );
  94. float4 lerpResult24 = lerp( lerpResult15 , tex2DNode20 , temp_output_33_0);
  95. o.Albedo = lerpResult24.rgb;
  96. float3 temp_cast_1 = (_Specular).xxx;
  97. o.Specular = temp_cast_1;
  98. float lerpResult4 = lerp( _Layer1SmoothnessMin , _Layer1SmoothnessMax , tex2DNode1.r);
  99. float lerpResult9 = lerp( _Layer2SmoothnessMin , _Layer2SmoothnessMax , tex2DNode7.r);
  100. float lerpResult16 = lerp( lerpResult4 , lerpResult9 , temp_output_28_0);
  101. float lerpResult23 = lerp( _Layer3SmoothnessMin , _Layer3SmoothnessMax , tex2DNode20.r);
  102. float lerpResult25 = lerp( lerpResult16 , lerpResult23 , temp_output_33_0);
  103. o.Smoothness = lerpResult25;
  104. o.Alpha = 1;
  105. }
  106. ENDCG
  107. }
  108. Fallback "Standard (Specular setup)"
  109. CustomEditor "ASEMaterialInspector"
  110. }
  111. /*ASEBEGIN
  112. Version=18100
  113. -1913;353;1824;1058;4571.206;747.649;2.235434;True;False
  114. Node;AmplifyShaderEditor.VertexColorNode;12;-3371.165,200.9968;Inherit;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  115. Node;AmplifyShaderEditor.RangedFloatNode;30;-3194.101,112.261;Inherit;False;Property;_Layer2BlendPrecision;Layer 2 Blend Precision;16;0;Create;True;0;0;False;0;False;5;5;0;0;0;1;FLOAT;0
  116. Node;AmplifyShaderEditor.OneMinusNode;29;-3152.101,221.261;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
  117. Node;AmplifyShaderEditor.SamplerNode;1;-3728.55,-195.3502;Inherit;True;Property;_Layer1Albedo;Layer 1 Albedo;0;0;Create;True;0;0;False;0;False;-1;None;59d8ee64e2b2c734c8f99343379c0317;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;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;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  118. Node;AmplifyShaderEditor.RangedFloatNode;31;-3211.101,32.26099;Inherit;False;Property;_Layer2EdgeSmoothness;Layer 2 Edge Smoothness;15;0;Create;True;0;0;False;0;False;50;50;0;0;0;1;FLOAT;0
  119. Node;AmplifyShaderEditor.SamplerNode;7;-3720.558,559.9141;Inherit;True;Property;_Layer2Albedo;Layer 2 Albedo;8;0;Create;True;0;0;False;0;False;-1;None;ad6fbdf7765069843882fa17825d3237;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;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;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  120. Node;AmplifyShaderEditor.FunctionNode;28;-2894.101,66.26099;Inherit;False;HeightLerp_Lordenfel;-1;;4;f647aa9a482e9f84281f939249978d59;0;4;1;FLOAT;0.5;False;2;FLOAT;50;False;3;FLOAT;5;False;4;FLOAT;0.5;False;1;FLOAT;0
  121. Node;AmplifyShaderEditor.RangedFloatNode;39;-3385.709,570.1342;Inherit;False;Property;_Layer2SmoothnessMax;Layer 2 Smoothness Max;7;0;Create;True;0;0;False;0;False;0.8;0.8;0;0;0;1;FLOAT;0
  122. Node;AmplifyShaderEditor.RangedFloatNode;38;-3384.709,480.1342;Inherit;False;Property;_Layer2SmoothnessMin;Layer 2 Smoothness Min;4;0;Create;True;0;0;False;0;False;0.2;0.2;0;0;0;1;FLOAT;0
  123. Node;AmplifyShaderEditor.RangedFloatNode;6;-3313.805,-206.2624;Inherit;False;Property;_Layer1SmoothnessMax;Layer 1 Smoothness Max;5;0;Create;True;0;0;False;0;False;0.8;0.8;0;0;0;1;FLOAT;0
  124. Node;AmplifyShaderEditor.RangedFloatNode;5;-3308.805,-284.2622;Inherit;False;Property;_Layer1SmoothnessMin;Layer 1 Smoothness Min;2;0;Create;True;0;0;False;0;False;0.2;0.2;0;0;0;1;FLOAT;0
  125. Node;AmplifyShaderEditor.RangedFloatNode;21;-1694.057,-25.70866;Inherit;False;Property;_Layer3SmoothnessMin;Layer 3 Smoothness Min;3;0;Create;True;0;0;False;0;False;0.2;0.2;0;0;0;1;FLOAT;0
  126. Node;AmplifyShaderEditor.OneMinusNode;32;-2168.777,666.765;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
  127. Node;AmplifyShaderEditor.LerpOp;18;-2452.312,514.1393;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT;0
  128. Node;AmplifyShaderEditor.RangedFloatNode;22;-1696.057,64.2912;Inherit;False;Property;_Layer3SmoothnessMax;Layer 3 Smoothness Max;6;0;Create;True;0;0;False;0;False;0.8;0.8;0;0;0;1;FLOAT;0
  129. Node;AmplifyShaderEditor.LerpOp;9;-3042.962,503.4957;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT;0
  130. Node;AmplifyShaderEditor.SamplerNode;20;-2174.052,-300.3235;Inherit;True;Property;_Layer3Albedo;Layer 3 Albedo;9;0;Create;True;0;0;False;0;False;-1;None;fe4b83417e99751488852bcf466972d5;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;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;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  131. Node;AmplifyShaderEditor.LerpOp;4;-3044.305,-201.2623;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT;0
  132. Node;AmplifyShaderEditor.SamplerNode;8;-3720.558,771.9143;Inherit;True;Property;_Layer2Normal;Layer 2 Normal;10;0;Create;True;0;0;False;0;False;-1;None;c4ee664a4a0e37b4ca781c3187aea05e;True;0;True;bump;Auto;True;Object;-1;Auto;Texture2D;6;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;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  133. Node;AmplifyShaderEditor.RangedFloatNode;35;-2164.475,485.3649;Inherit;False;Property;_Layer3EdgeSmoothness;Layer 3 Edge Smoothness;13;0;Create;True;0;0;False;0;False;50;50;0;0;0;1;FLOAT;0
  134. Node;AmplifyShaderEditor.RangedFloatNode;36;-2146.475,564.365;Inherit;False;Property;_Layer3BlendPrecision;Layer 3 Blend Precision;14;0;Create;True;0;0;False;0;False;5;5;0;0;0;1;FLOAT;0
  135. Node;AmplifyShaderEditor.SamplerNode;2;-3727.55,12.6498;Inherit;True;Property;_Layer1Normal;Layer 1 Normal;1;0;Create;True;0;0;False;0;False;-1;None;5e6ec4a68e49dcc4aa7ea6ab378e4a88;True;0;True;bump;Auto;True;Object;-1;Auto;Texture2D;6;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;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  136. Node;AmplifyShaderEditor.LerpOp;23;-1436.055,7.291305;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT;0
  137. Node;AmplifyShaderEditor.LerpOp;16;-2455.297,85.81567;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT;0
  138. Node;AmplifyShaderEditor.LerpOp;15;-2447.861,-140.6095;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0
  139. Node;AmplifyShaderEditor.FunctionNode;33;-1864.575,495.9651;Inherit;False;HeightLerp_Lordenfel;-1;;5;f647aa9a482e9f84281f939249978d59;0;4;1;FLOAT;0.5;False;2;FLOAT;50;False;3;FLOAT;5;False;4;FLOAT;0.5;False;1;FLOAT;0
  140. Node;AmplifyShaderEditor.LerpOp;17;-2456.597,290.732;Inherit;False;3;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT;0;False;1;FLOAT3;0
  141. Node;AmplifyShaderEditor.SamplerNode;19;-2174.052,-89.62315;Inherit;True;Property;_Layer3Normal;Layer 3 Normal;11;0;Create;True;0;0;False;0;False;-1;None;eddb60cbfc043ad488f68dfbdda29886;True;0;True;bump;Auto;True;Object;-1;Auto;Texture2D;6;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;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  142. Node;AmplifyShaderEditor.LerpOp;26;-1163.609,379.7777;Inherit;False;3;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT;0;False;1;FLOAT3;0
  143. Node;AmplifyShaderEditor.LerpOp;24;-1159.682,-167.4163;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0
  144. Node;AmplifyShaderEditor.RangedFloatNode;37;-989.1133,22.35301;Inherit;False;Property;_Specular;Specular;12;0;Create;True;0;0;False;0;False;0.02;0.05;0;0;0;1;FLOAT;0
  145. Node;AmplifyShaderEditor.LerpOp;25;-1162.3,104.8717;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT;0
  146. Node;AmplifyShaderEditor.StandardSurfaceOutputNode;0;-771.344,-38.47826;Float;False;True;-1;2;ASEMaterialInspector;0;0;StandardSpecular;Custom/Lordenfel/ThreeWayBlend;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;Back;0;False;-1;0;False;-1;False;0;False;-1;0;False;-1;False;0;Opaque;0.5;True;True;0;False;Opaque;;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;0;0;False;-1;0;False;-1;0;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;0;0,0,0,0;VertexOffset;True;False;Cylindrical;False;Relative;0;Standard (Specular setup);-1;-1;-1;-1;0;False;0;0;False;-1;-1;0;False;-1;0;0;0;False;0.1;False;-1;0;False;-1;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
  147. WireConnection;29;0;12;1
  148. WireConnection;28;1;1;4
  149. WireConnection;28;2;31;0
  150. WireConnection;28;3;30;0
  151. WireConnection;28;4;29;0
  152. WireConnection;32;0;12;2
  153. WireConnection;18;0;1;4
  154. WireConnection;18;1;7;4
  155. WireConnection;18;2;28;0
  156. WireConnection;9;0;38;0
  157. WireConnection;9;1;39;0
  158. WireConnection;9;2;7;1
  159. WireConnection;4;0;5;0
  160. WireConnection;4;1;6;0
  161. WireConnection;4;2;1;1
  162. WireConnection;23;0;21;0
  163. WireConnection;23;1;22;0
  164. WireConnection;23;2;20;1
  165. WireConnection;16;0;4;0
  166. WireConnection;16;1;9;0
  167. WireConnection;16;2;28;0
  168. WireConnection;15;0;1;0
  169. WireConnection;15;1;7;0
  170. WireConnection;15;2;28;0
  171. WireConnection;33;1;18;0
  172. WireConnection;33;2;35;0
  173. WireConnection;33;3;36;0
  174. WireConnection;33;4;32;0
  175. WireConnection;17;0;2;0
  176. WireConnection;17;1;8;0
  177. WireConnection;17;2;28;0
  178. WireConnection;26;0;17;0
  179. WireConnection;26;1;19;0
  180. WireConnection;26;2;33;0
  181. WireConnection;24;0;15;0
  182. WireConnection;24;1;20;0
  183. WireConnection;24;2;33;0
  184. WireConnection;25;0;16;0
  185. WireConnection;25;1;23;0
  186. WireConnection;25;2;33;0
  187. WireConnection;0;0;24;0
  188. WireConnection;0;1;26;0
  189. WireConnection;0;3;37;0
  190. WireConnection;0;4;25;0
  191. ASEEND*/
  192. //CHKSM=A0788610E79AAFDEC9C3A708E0CE756A4D099D19