You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

146 lines
8.2 KiB

  1. // Made with Amplify Shader Editor
  2. // Available at the Unity Asset Store - http://u3d.as/y3X
  3. Shader "ASESampleShaders/Terrain/SimpleTerrainAddPass"
  4. {
  5. Properties
  6. {
  7. [HideInInspector]_Control("Control", 2D) = "white" {}
  8. [HideInInspector]_Splat3("Splat3", 2D) = "white" {}
  9. [HideInInspector]_Splat2("Splat2", 2D) = "white" {}
  10. [HideInInspector]_Splat1("Splat1", 2D) = "white" {}
  11. [HideInInspector]_Splat0("Splat0", 2D) = "white" {}
  12. [HideInInspector]_Normal0("Normal0", 2D) = "white" {}
  13. [HideInInspector]_Normal1("Normal1", 2D) = "white" {}
  14. [HideInInspector]_Normal2("Normal2", 2D) = "white" {}
  15. [HideInInspector]_Normal3("Normal3", 2D) = "white" {}
  16. [HideInInspector]_Smoothness3("Smoothness3", Range( 0 , 1)) = 1
  17. [HideInInspector]_Smoothness1("Smoothness1", Range( 0 , 1)) = 1
  18. [HideInInspector]_Smoothness0("Smoothness0", Range( 0 , 1)) = 1
  19. [HideInInspector]_Smoothness2("Smoothness2", Range( 0 , 1)) = 1
  20. _Wetness("Wetness", Float) = 0
  21. _Metallic("Metallic", Range( 0 , 1)) = 0
  22. [HideInInspector] _texcoord( "", 2D ) = "white" {}
  23. [HideInInspector] __dirty( "", Int ) = 1
  24. }
  25. SubShader
  26. {
  27. Tags{ "RenderType" = "Opaque" "Queue" = "Geometry-99" "IgnoreProjector"="True" }
  28. Cull Back
  29. CGPROGRAM
  30. #include "UnityShaderVariables.cginc"
  31. #pragma target 3.0
  32. #pragma multi_compile_fog
  33. #define TERRAIN_SPLAT_ADDPASS
  34. #define TERRAIN_STANDARD_SHADER
  35. #pragma exclude_renderers gles
  36. #pragma surface surf Standard keepalpha vertex:vertexDataFunc decal:add finalcolor:SplatmapFinalColor
  37. struct Input
  38. {
  39. float2 uv_texcoord;
  40. float3 worldPos;
  41. };
  42. uniform sampler2D _Control;
  43. uniform float4 _Control_ST;
  44. uniform sampler2D _Normal0;
  45. uniform sampler2D _Splat0;
  46. uniform float4 _Splat0_ST;
  47. uniform sampler2D _Normal1;
  48. uniform sampler2D _Splat1;
  49. uniform float4 _Splat1_ST;
  50. uniform sampler2D _Normal2;
  51. uniform sampler2D _Splat2;
  52. uniform float4 _Splat2_ST;
  53. uniform sampler2D _Normal3;
  54. uniform sampler2D _Splat3;
  55. uniform float4 _Splat3_ST;
  56. uniform float _Smoothness0;
  57. uniform float _Smoothness1;
  58. uniform float _Smoothness2;
  59. uniform float _Smoothness3;
  60. uniform float _Metallic;
  61. uniform float _Wetness;
  62. void SplatmapFinalColor( Input SurfaceIn , SurfaceOutputStandard SurfaceOut , inout fixed4 FinalColor )
  63. {
  64. FinalColor *= SurfaceOut.Alpha;
  65. }
  66. void vertexDataFunc( inout appdata_full v, out Input o )
  67. {
  68. UNITY_INITIALIZE_OUTPUT( Input, o );
  69. float localCalculateTangents16_g11 = ( 0.0 );
  70. v.tangent.xyz = cross ( v.normal, float3( 0, 0, 1 ) );
  71. v.tangent.w = -1;
  72. float3 temp_cast_0 = (localCalculateTangents16_g11).xxx;
  73. v.vertex.xyz += temp_cast_0;
  74. }
  75. void surf( Input i , inout SurfaceOutputStandard o )
  76. {
  77. float2 uv_Control = i.uv_texcoord * _Control_ST.xy + _Control_ST.zw;
  78. float4 tex2DNode5_g11 = tex2D( _Control, uv_Control );
  79. float dotResult20_g11 = dot( tex2DNode5_g11 , float4(1,1,1,1) );
  80. float SplatWeight22_g11 = dotResult20_g11;
  81. float localSplatClip74_g11 = ( SplatWeight22_g11 );
  82. float SplatWeight74_g11 = SplatWeight22_g11;
  83. #if !defined(SHADER_API_MOBILE) && defined(TERRAIN_SPLAT_ADDPASS)
  84. clip(SplatWeight74_g11 == 0.0f ? -1 : 1);
  85. #endif
  86. float4 SplatControl26_g11 = ( tex2DNode5_g11 / ( localSplatClip74_g11 + 0.001 ) );
  87. float4 temp_output_59_0_g11 = SplatControl26_g11;
  88. float2 uv_Splat0 = i.uv_texcoord * _Splat0_ST.xy + _Splat0_ST.zw;
  89. float2 uv_Splat1 = i.uv_texcoord * _Splat1_ST.xy + _Splat1_ST.zw;
  90. float2 uv_Splat2 = i.uv_texcoord * _Splat2_ST.xy + _Splat2_ST.zw;
  91. float2 uv_Splat3 = i.uv_texcoord * _Splat3_ST.xy + _Splat3_ST.zw;
  92. float4 weightedBlendVar8_g11 = temp_output_59_0_g11;
  93. float4 weightedBlend8_g11 = ( weightedBlendVar8_g11.x*tex2D( _Normal0, uv_Splat0 ) + weightedBlendVar8_g11.y*tex2D( _Normal1, uv_Splat1 ) + weightedBlendVar8_g11.z*tex2D( _Normal2, uv_Splat2 ) + weightedBlendVar8_g11.w*tex2D( _Normal3, uv_Splat3 ) );
  94. o.Normal = UnpackNormal( weightedBlend8_g11 );
  95. float4 appendResult33_g11 = (float4(1.0 , 1.0 , 1.0 , _Smoothness0));
  96. float4 appendResult36_g11 = (float4(1.0 , 1.0 , 1.0 , _Smoothness1));
  97. float4 appendResult39_g11 = (float4(1.0 , 1.0 , 1.0 , _Smoothness2));
  98. float4 appendResult42_g11 = (float4(1.0 , 1.0 , 1.0 , _Smoothness3));
  99. float4 weightedBlendVar9_g11 = temp_output_59_0_g11;
  100. float4 weightedBlend9_g11 = ( weightedBlendVar9_g11.x*( appendResult33_g11 * tex2D( _Splat0, uv_Splat0 ) ) + weightedBlendVar9_g11.y*( appendResult36_g11 * tex2D( _Splat1, uv_Splat1 ) ) + weightedBlendVar9_g11.z*( appendResult39_g11 * tex2D( _Splat2, uv_Splat2 ) ) + weightedBlendVar9_g11.w*( appendResult42_g11 * tex2D( _Splat3, uv_Splat3 ) ) );
  101. float4 MixDiffuse28_g11 = weightedBlend9_g11;
  102. o.Albedo = MixDiffuse28_g11.xyz;
  103. o.Metallic = _Metallic;
  104. float3 ase_vertex3Pos = mul( unity_WorldToObject, float4( i.worldPos , 1 ) );
  105. o.Smoothness = saturate( pow( ( 1.0 - ase_vertex3Pos.y ) , _Wetness ) );
  106. o.Alpha = SplatWeight22_g11;
  107. }
  108. ENDCG
  109. }
  110. Fallback "Hidden/TerrainEngine/Splatmap/Diffuse-AddPass"
  111. CustomEditor "ASEMaterialInspector"
  112. }
  113. /*ASEBEGIN
  114. Version=15312
  115. 263;100;754;590;540.0595;267.8899;1.3;True;True
  116. Node;AmplifyShaderEditor.PosVertexDataNode;37;-423.6948,402.6638;Float;True;0;0;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  117. Node;AmplifyShaderEditor.OneMinusNode;36;-126.6948,411.1436;Float;False;1;0;FLOAT;0;False;1;FLOAT;0
  118. Node;AmplifyShaderEditor.RangedFloatNode;39;-105.9117,557.5325;Float;False;Property;_Wetness;Wetness;19;0;Create;True;0;0;False;0;0;0;0;0;0;1;FLOAT;0
  119. Node;AmplifyShaderEditor.PowerNode;38;114.0559,459.6325;Float;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
  120. Node;AmplifyShaderEditor.FunctionNode;50;-344.3317,49.79149;Float;False;Four Splats First Pass Terrain;1;;11;37452fdfb732e1443b7e39720d05b708;0;6;59;FLOAT4;0,0,0,0;False;60;FLOAT4;0,0,0,0;False;61;FLOAT3;0,0,0;False;57;FLOAT;0;False;58;FLOAT;0;False;62;FLOAT;0;False;6;FLOAT4;0;FLOAT3;14;FLOAT;56;FLOAT;45;FLOAT;19;FLOAT;17
  121. Node;AmplifyShaderEditor.RangedFloatNode;21;134.9534,153.83;Float;False;Property;_Metallic;Metallic;20;0;Create;True;0;0;False;0;0;0;0;1;0;1;FLOAT;0
  122. Node;AmplifyShaderEditor.WireNode;29;115.0688,271.207;Float;False;1;0;FLOAT;0;False;1;FLOAT;0
  123. Node;AmplifyShaderEditor.CustomExpressionNode;46;-329.9529,-92.93633;Float;False;FinalColor *= SurfaceOut.Alpha@;7;False;3;True;SurfaceIn;OBJECT;0;In;Input;True;SurfaceOut;OBJECT;0;In;SurfaceOutputStandard;True;FinalColor;OBJECT;0;InOut;fixed4;SplatmapFinalColor;False;True;4;0;FLOAT;0;False;1;OBJECT;0;False;2;OBJECT;0;False;3;OBJECT;0;False;2;FLOAT;0;OBJECT;4
  124. Node;AmplifyShaderEditor.SaturateNode;41;391.3052,383.6638;Float;False;1;0;FLOAT;0;False;1;FLOAT;0
  125. Node;AmplifyShaderEditor.StandardSurfaceOutputNode;0;657.0565,40.11808;Float;False;True;2;Float;ASEMaterialInspector;0;0;Standard;ASESampleShaders/Terrain/SimpleTerrainAddPass;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;Custom;0.5;True;False;-99;True;Opaque;;Geometry;All;True;True;True;False;True;True;True;True;True;True;True;True;True;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;-1;False;-1;-1;False;-1;0;False;0;0,0,0,0;VertexOffset;True;False;Cylindrical;False;Relative;0;Hidden/TerrainEngine/Splatmap/Diffuse-AddPass;0;-1;-1;-1;1;IgnoreProjector=True;False;0;0;False;-1;-1;0;False;-1;3;Pragma;multi_compile_fog;Define;TERRAIN_SPLAT_ADDPASS;Define;TERRAIN_STANDARD_SHADER;2;decal:add;finalcolor:SplatmapFinalColor;16;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;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
  126. WireConnection;36;0;37;2
  127. WireConnection;38;0;36;0
  128. WireConnection;38;1;39;0
  129. WireConnection;29;0;50;17
  130. WireConnection;41;0;38;0
  131. WireConnection;0;0;50;0
  132. WireConnection;0;1;50;14
  133. WireConnection;0;3;21;0
  134. WireConnection;0;4;41;0
  135. WireConnection;0;9;50;19
  136. WireConnection;0;11;29;0
  137. ASEEND*/
  138. //CHKSM=5A9BB9811B8450FF67AF3F02E0C5F54FD10EA292