Ivy.shader 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. // Made with Amplify Shader Editor
  2. // Available at the Unity Asset Store - http://u3d.as/y3X
  3. Shader "Custom/Lordenfel/Ivy"
  4. {
  5. Properties
  6. {
  7. _Albedo("Albedo", 2D) = "white" {}
  8. _Cutoff( "Mask Clip Value", Float ) = 0.47
  9. _Normal("Normal", 2D) = "bump" {}
  10. _Mask("Mask", 2D) = "white" {}
  11. _SmoothnessMin("Smoothness Min", Float) = 0.49
  12. _SmoothnessMax("Smoothness Max", Float) = 0.8
  13. _Specular("Specular", Float) = 0.12
  14. _EdgeShift("Edge Shift", Float) = -0.4
  15. _OpacityContrast("Opacity Contrast", Float) = 0.26
  16. _Transmission("Transmission", Float) = 3.5
  17. [HideInInspector] _texcoord( "", 2D ) = "white" {}
  18. [HideInInspector] __dirty( "", Int ) = 1
  19. }
  20. SubShader
  21. {
  22. Tags{ "RenderType" = "TransparentCutout" "Queue" = "AlphaTest+0" }
  23. Cull Off
  24. CGPROGRAM
  25. #include "UnityPBSLighting.cginc"
  26. #pragma target 3.0
  27. #pragma surface surf StandardSpecularCustom keepalpha addshadow fullforwardshadows exclude_path:deferred
  28. struct Input
  29. {
  30. float2 uv_texcoord;
  31. float4 vertexColor : COLOR;
  32. };
  33. struct SurfaceOutputStandardSpecularCustom
  34. {
  35. half3 Albedo;
  36. half3 Normal;
  37. half3 Emission;
  38. half3 Specular;
  39. half Smoothness;
  40. half Occlusion;
  41. half Alpha;
  42. half3 Transmission;
  43. };
  44. uniform sampler2D _Normal;
  45. uniform float4 _Normal_ST;
  46. uniform sampler2D _Albedo;
  47. uniform float4 _Albedo_ST;
  48. uniform float _Specular;
  49. uniform float _SmoothnessMin;
  50. uniform float _SmoothnessMax;
  51. uniform float _Transmission;
  52. uniform float _EdgeShift;
  53. uniform sampler2D _Mask;
  54. uniform float4 _Mask_ST;
  55. uniform float _OpacityContrast;
  56. uniform float _Cutoff = 0.47;
  57. float4 CalculateContrast( float contrastValue, float4 colorTarget )
  58. {
  59. float t = 0.5 * ( 1.0 - contrastValue );
  60. return mul( float4x4( contrastValue,0,0,t, 0,contrastValue,0,t, 0,0,contrastValue,t, 0,0,0,1 ), colorTarget );
  61. }
  62. inline half4 LightingStandardSpecularCustom(SurfaceOutputStandardSpecularCustom s, half3 viewDir, UnityGI gi )
  63. {
  64. half3 transmission = max(0 , -dot(s.Normal, gi.light.dir)) * gi.light.color * s.Transmission;
  65. half4 d = half4(s.Albedo * transmission , 0);
  66. SurfaceOutputStandardSpecular r;
  67. r.Albedo = s.Albedo;
  68. r.Normal = s.Normal;
  69. r.Emission = s.Emission;
  70. r.Specular = s.Specular;
  71. r.Smoothness = s.Smoothness;
  72. r.Occlusion = s.Occlusion;
  73. r.Alpha = s.Alpha;
  74. return LightingStandardSpecular (r, viewDir, gi) + d;
  75. }
  76. inline void LightingStandardSpecularCustom_GI(SurfaceOutputStandardSpecularCustom s, UnityGIInput data, inout UnityGI gi )
  77. {
  78. #if defined(UNITY_PASS_DEFERRED) && UNITY_ENABLE_REFLECTION_BUFFERS
  79. gi = UnityGlobalIllumination(data, s.Occlusion, s.Normal);
  80. #else
  81. UNITY_GLOSSY_ENV_FROM_SURFACE( g, s, data );
  82. gi = UnityGlobalIllumination( data, s.Occlusion, s.Normal, g );
  83. #endif
  84. }
  85. void surf( Input i , inout SurfaceOutputStandardSpecularCustom o )
  86. {
  87. float2 uv_Normal = i.uv_texcoord * _Normal_ST.xy + _Normal_ST.zw;
  88. o.Normal = UnpackNormal( tex2D( _Normal, uv_Normal ) );
  89. float2 uv_Albedo = i.uv_texcoord * _Albedo_ST.xy + _Albedo_ST.zw;
  90. float4 tex2DNode10 = tex2D( _Albedo, uv_Albedo );
  91. o.Albedo = tex2DNode10.rgb;
  92. float3 temp_cast_1 = (_Specular).xxx;
  93. o.Specular = temp_cast_1;
  94. float lerpResult15 = lerp( _SmoothnessMin , _SmoothnessMax , tex2DNode10.r);
  95. o.Smoothness = lerpResult15;
  96. o.Transmission = ( tex2DNode10 * _Transmission ).rgb;
  97. o.Alpha = 1;
  98. float2 uv_Mask = i.uv_texcoord * _Mask_ST.xy + _Mask_ST.zw;
  99. float4 tex2DNode1 = tex2D( _Mask, uv_Mask );
  100. float4 temp_cast_3 = (( tex2DNode1.r + tex2DNode1.b )).xxxx;
  101. clip( ( ( ( CalculateContrast(_EdgeShift,temp_cast_3) + i.vertexColor.a ) * tex2DNode1.a ) * _OpacityContrast ).r - _Cutoff );
  102. }
  103. ENDCG
  104. }
  105. Fallback "Standard (Specular setup)"
  106. CustomEditor "ASEMaterialInspector"
  107. }
  108. /*ASEBEGIN
  109. Version=18100
  110. 618;78;1779;1215;1425.294;334.7736;1;True;False
  111. Node;AmplifyShaderEditor.SamplerNode;1;-1871.086,167.9506;Inherit;True;Property;_Mask;Mask;3;0;Create;True;0;0;False;0;False;-1;None;b99774c781a7ee149a75be07767e55d0;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
  112. Node;AmplifyShaderEditor.RangedFloatNode;4;-1479.086,350.9505;Inherit;False;Property;_EdgeShift;Edge Shift;7;0;Create;True;0;0;False;0;False;-0.4;-0.53;0;0;0;1;FLOAT;0
  113. Node;AmplifyShaderEditor.SimpleAddOpNode;2;-1454.086,207.9505;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
  114. Node;AmplifyShaderEditor.VertexColorNode;6;-1226.308,416.6938;Inherit;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  115. Node;AmplifyShaderEditor.SimpleContrastOpNode;3;-1263.086,199.9505;Inherit;True;2;1;COLOR;0,0,0,0;False;0;FLOAT;0;False;1;COLOR;0
  116. Node;AmplifyShaderEditor.SimpleAddOpNode;5;-973.308,343.6936;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0
  117. Node;AmplifyShaderEditor.SamplerNode;10;-850.3923,-153.335;Inherit;True;Property;_Albedo;Albedo;0;0;Create;True;0;0;False;0;False;-1;None;291f629bc04efe2499aad0de0173196d;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;16;-417.3762,227.6658;Inherit;False;Property;_SmoothnessMin;Smoothness Min;4;0;Create;True;0;0;False;0;False;0.49;0.2;0;0;0;1;FLOAT;0
  119. Node;AmplifyShaderEditor.RangedFloatNode;17;-412.3762,311.6658;Inherit;False;Property;_SmoothnessMax;Smoothness Max;5;0;Create;True;0;0;False;0;False;0.8;1.5;0;0;0;1;FLOAT;0
  120. Node;AmplifyShaderEditor.RangedFloatNode;9;-838.4924,491.4194;Inherit;False;Property;_OpacityContrast;Opacity Contrast;8;0;Create;True;0;0;False;0;False;0.26;0.5;0;0;0;1;FLOAT;0
  121. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;7;-784.4924,350.4194;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0
  122. Node;AmplifyShaderEditor.RangedFloatNode;12;-506.3762,150.6658;Inherit;False;Property;_Transmission;Transmission;9;0;Create;True;0;0;False;0;False;3.5;3.5;0;0;0;1;FLOAT;0
  123. Node;AmplifyShaderEditor.LerpOp;15;-193.3762,241.6658;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT;0
  124. Node;AmplifyShaderEditor.RangedFloatNode;14;-267.3762,147.6658;Inherit;False;Property;_Specular;Specular;6;0;Create;True;0;0;False;0;False;0.12;0.05;0;0;0;1;FLOAT;0
  125. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;13;-311.3762,50.66583;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0
  126. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;8;-602.4924,430.4194;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0
  127. Node;AmplifyShaderEditor.SamplerNode;11;-840.3762,79.66583;Inherit;True;Property;_Normal;Normal;2;0;Create;True;0;0;False;0;False;-1;None;d181deedb4a5bba43bb15e36d739e25f;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
  128. Node;AmplifyShaderEditor.StandardSurfaceOutputNode;0;86,64;Float;False;True;-1;2;ASEMaterialInspector;0;0;StandardSpecular;Custom/Lordenfel/Ivy;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;Off;0;False;-1;0;False;-1;False;0;False;-1;0;False;-1;False;0;Masked;0.47;True;True;0;False;TransparentCutout;;AlphaTest;ForwardOnly;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
  129. WireConnection;2;0;1;1
  130. WireConnection;2;1;1;3
  131. WireConnection;3;1;2;0
  132. WireConnection;3;0;4;0
  133. WireConnection;5;0;3;0
  134. WireConnection;5;1;6;4
  135. WireConnection;7;0;5;0
  136. WireConnection;7;1;1;4
  137. WireConnection;15;0;16;0
  138. WireConnection;15;1;17;0
  139. WireConnection;15;2;10;1
  140. WireConnection;13;0;10;0
  141. WireConnection;13;1;12;0
  142. WireConnection;8;0;7;0
  143. WireConnection;8;1;9;0
  144. WireConnection;0;0;10;0
  145. WireConnection;0;1;11;0
  146. WireConnection;0;3;14;0
  147. WireConnection;0;4;15;0
  148. WireConnection;0;6;13;0
  149. WireConnection;0;10;8;0
  150. ASEEND*/
  151. //CHKSM=7CC0BF4C991F7CD29C0374B4C63AF194617ACE3B