Sabotender

Amplify - Seaweed shader

Jan 22nd, 2022 (edited)
395
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Made with Amplify Shader Editor
  2. // Available at the Unity Asset Store - http://u3d.as/y3X
  3. Shader "Seaweed"
  4. {
  5.     Properties
  6.     {
  7.         _MainTex("MainTex", 2D) = "white" {}
  8.         _AlphaClip("AlphaClip", Range( 0 , 1)) = 0
  9.         [HDR]_Tint("Tint", Color) = (0,0.7575803,1,0)
  10.         [Enum(UV,0,Vertex,1)]_Mode("Mode", Float) = 0
  11.         _WavePow("WavePow", Float) = 0.1
  12.         _WaveFreq("WaveFreq", Float) = 10
  13.         _WaveSpeed("WaveSpeed", Float) = 1
  14.  
  15.     }
  16.    
  17.     SubShader
  18.     {
  19.        
  20.        
  21.         Tags { "RenderType"="Opaque" }
  22.     LOD 0
  23.  
  24.         CGINCLUDE
  25.         #pragma target 3.0
  26.         ENDCG
  27.         Blend Off
  28.         AlphaToMask Off
  29.         Cull Back
  30.         ColorMask RGBA
  31.         ZWrite On
  32.         ZTest LEqual
  33.         Offset 0 , 0
  34.        
  35.        
  36.        
  37.         Pass
  38.         {
  39.             Name "Unlit"
  40.             Tags { "LightMode"="ForwardBase" }
  41.             CGPROGRAM
  42.  
  43.            
  44.  
  45.             #ifndef UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX
  46.             //only defining to not throw compilation error over Unity 5.5
  47.             #define UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input)
  48.             #endif
  49.             #pragma vertex vert
  50.             #pragma fragment frag
  51.             #pragma multi_compile_instancing
  52.             #include "UnityCG.cginc"
  53.             #include "UnityShaderVariables.cginc"
  54.  
  55.  
  56.             struct appdata
  57.             {
  58.                 float4 vertex : POSITION;
  59.                 float4 color : COLOR;
  60.                 float4 ase_texcoord : TEXCOORD0;
  61.                 UNITY_VERTEX_INPUT_INSTANCE_ID
  62.             };
  63.            
  64.             struct v2f
  65.             {
  66.                 float4 vertex : SV_POSITION;
  67.                 #ifdef ASE_NEEDS_FRAG_WORLD_POSITION
  68.                 float3 worldPos : TEXCOORD0;
  69.                 #endif
  70.                 float4 ase_texcoord1 : TEXCOORD1;
  71.                 UNITY_VERTEX_INPUT_INSTANCE_ID
  72.                 UNITY_VERTEX_OUTPUT_STEREO
  73.             };
  74.  
  75.             uniform float _Mode;
  76.             uniform float _WavePow;
  77.             uniform float _WaveFreq;
  78.             uniform float _WaveSpeed;
  79.             uniform sampler2D _MainTex;
  80.             uniform float4 _MainTex_ST;
  81.             uniform float4 _Tint;
  82.             uniform float _AlphaClip;
  83.  
  84.            
  85.             v2f vert ( appdata v )
  86.             {
  87.                 v2f o;
  88.                 UNITY_SETUP_INSTANCE_ID(v);
  89.                 UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
  90.                 UNITY_TRANSFER_INSTANCE_ID(v, o);
  91.  
  92.                 float2 texCoord131 = v.ase_texcoord.xy * float2( 1,1 ) + float2( 0,0 );
  93.                 float offset127 = ( _WavePow * sin( ( ( texCoord131.y * _WaveFreq ) + ( _Time.y * _WaveSpeed ) ) ) );
  94.                 float3 appendResult129 = (float3(offset127 , 0.0 , 0.0));
  95.                
  96.                 o.ase_texcoord1.xy = v.ase_texcoord.xy;
  97.                
  98.                 //setting value to unused interpolator channels and avoid initialization warnings
  99.                 o.ase_texcoord1.zw = 0;
  100.                 float3 vertexValue = float3(0, 0, 0);
  101.                 #if ASE_ABSOLUTE_VERTEX_POS
  102.                 vertexValue = v.vertex.xyz;
  103.                 #endif
  104.                 vertexValue = ( _Mode * appendResult129 );
  105.                 #if ASE_ABSOLUTE_VERTEX_POS
  106.                 v.vertex.xyz = vertexValue;
  107.                 #else
  108.                 v.vertex.xyz += vertexValue;
  109.                 #endif
  110.                 o.vertex = UnityObjectToClipPos(v.vertex);
  111.  
  112.                 #ifdef ASE_NEEDS_FRAG_WORLD_POSITION
  113.                 o.worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
  114.                 #endif
  115.                 return o;
  116.             }
  117.            
  118.             fixed4 frag (v2f i ) : SV_Target
  119.             {
  120.                 UNITY_SETUP_INSTANCE_ID(i);
  121.                 UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
  122.                 fixed4 finalColor;
  123.                 #ifdef ASE_NEEDS_FRAG_WORLD_POSITION
  124.                 float3 WorldPosition = i.worldPos;
  125.                 #endif
  126.                 float2 texCoord83 = i.ase_texcoord1.xy * float2( 1,1 ) + float2( 0,0 );
  127.                 float2 texCoord131 = i.ase_texcoord1.xy * float2( 1,1 ) + float2( 0,0 );
  128.                 float offset127 = ( _WavePow * sin( ( ( texCoord131.y * _WaveFreq ) + ( _Time.y * _WaveSpeed ) ) ) );
  129.                 float2 appendResult77 = (float2(( texCoord83.x + offset127 ) , texCoord83.y));
  130.                 float2 texCoord73 = i.ase_texcoord1.xy * _MainTex_ST.xy + appendResult77;
  131.                 float2 offsetUVs120 = texCoord73;
  132.                 float2 texCoord122 = i.ase_texcoord1.xy * float2( 1,1 ) + float2( 0,0 );
  133.                 float2 lerpResult118 = lerp( offsetUVs120 , texCoord122 , _Mode);
  134.                 float4 tex2DNode75 = tex2D( _MainTex, lerpResult118 );
  135.                 clip( tex2DNode75.a - _AlphaClip);
  136.                
  137.                
  138.                 finalColor = ( tex2DNode75 * _Tint );
  139.                 return finalColor;
  140.             }
  141.             ENDCG
  142.         }
  143.     }
  144.     CustomEditor "ASEMaterialInspector"
  145.    
  146.    
  147. }
  148. /*ASEBEGIN
  149. Version=18933
  150. 3152;181;1601;981;2410.525;-804.446;1;True;False
  151. Node;AmplifyShaderEditor.SimpleTimeNode;86;-2015.767,1448.807;Inherit;False;1;0;FLOAT;1;False;1;FLOAT;0
  152. Node;AmplifyShaderEditor.RangedFloatNode;82;-2042.766,1292.007;Float;False;Property;_WaveFreq;WaveFreq;5;0;Create;True;0;0;0;False;0;False;10;13.99;0;0;0;1;FLOAT;0
  153. Node;AmplifyShaderEditor.TextureCoordinatesNode;131;-2111.933,1161.14;Inherit;False;0;-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
  154. Node;AmplifyShaderEditor.RangedFloatNode;133;-1983.335,1526.739;Inherit;False;Property;_WaveSpeed;WaveSpeed;6;0;Create;True;0;0;0;False;0;False;1;1;0;0;0;1;FLOAT;0
  155. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;84;-1880.167,1240.207;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
  156. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;132;-1821.335,1457.739;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
  157. Node;AmplifyShaderEditor.SimpleAddOpNode;85;-1670.767,1350.808;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
  158. Node;AmplifyShaderEditor.RangedFloatNode;92;-1652.606,1237.862;Float;False;Property;_WavePow;WavePow;4;0;Create;True;0;0;0;False;0;False;0.1;0.5;0;0;0;1;FLOAT;0
  159. Node;AmplifyShaderEditor.SinOpNode;87;-1545.367,1343.007;Inherit;True;1;0;FLOAT;0;False;1;FLOAT;0
  160. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;91;-1365.406,1269.062;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
  161. Node;AmplifyShaderEditor.RegisterLocalVarNode;127;-1156.212,1263.87;Inherit;False;offset;-1;True;1;0;FLOAT;0;False;1;FLOAT;0
  162. Node;AmplifyShaderEditor.TextureCoordinatesNode;83;-2109.52,382.4394;Inherit;True;0;-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
  163. Node;AmplifyShaderEditor.GetLocalVarNode;130;-1883.434,489.7401;Inherit;False;127;offset;1;0;OBJECT;;False;1;FLOAT;0
  164. Node;AmplifyShaderEditor.SimpleAddOpNode;90;-1682.152,415.2448;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
  165. Node;AmplifyShaderEditor.TexturePropertyNode;74;-1875.761,163.2488;Float;True;Property;_MainTex;MainTex;0;0;Create;True;0;0;0;False;0;False;None;19493d4b01e9bb24ebe198331d349ca1;False;white;Auto;Texture2D;-1;0;2;SAMPLER2D;0;SAMPLERSTATE;1
  166. Node;AmplifyShaderEditor.TextureTransformNode;72;-1587.083,271.9844;Inherit;False;-1;False;1;0;SAMPLER2D;;False;2;FLOAT2;0;FLOAT2;1
  167. Node;AmplifyShaderEditor.DynamicAppendNode;77;-1537.365,440.5999;Inherit;True;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0
  168. Node;AmplifyShaderEditor.TextureCoordinatesNode;73;-1287.115,322.5456;Inherit;False;0;-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
  169. Node;AmplifyShaderEditor.RegisterLocalVarNode;120;-1058.724,318.4799;Inherit;False;offsetUVs;-1;True;1;0;FLOAT2;0,0;False;1;FLOAT2;0
  170. Node;AmplifyShaderEditor.RegisterLocalVarNode;125;-1600.762,150.2434;Inherit;False;tex;-1;True;1;0;SAMPLER2D;;False;1;SAMPLER2D;0
  171. Node;AmplifyShaderEditor.RangedFloatNode;115;-420.8201,221.5534;Inherit;False;Property;_Mode;Mode;3;1;[Enum];Create;True;0;2;UV;0;Vertex;1;0;False;0;False;0;1;0;0;0;1;FLOAT;0
  172. Node;AmplifyShaderEditor.TextureCoordinatesNode;122;-515.226,60.41732;Inherit;False;0;-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
  173. Node;AmplifyShaderEditor.GetLocalVarNode;121;-470.5206,-41.83761;Inherit;False;120;offsetUVs;1;0;OBJECT;;False;1;FLOAT2;0
  174. Node;AmplifyShaderEditor.GetLocalVarNode;126;-246.3326,-125.4924;Inherit;False;125;tex;1;0;OBJECT;;False;1;SAMPLER2D;0
  175. Node;AmplifyShaderEditor.LerpOp;118;-220.8718,-5.008037;Inherit;False;3;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;1;FLOAT2;0
  176. Node;AmplifyShaderEditor.ColorNode;67;36.56467,102.119;Float;False;Property;_Tint;Tint;2;1;[HDR];Create;True;0;0;0;False;0;False;0,0.7575803,1,0;0.4247508,0.7830189,0.502615,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  177. Node;AmplifyShaderEditor.GetLocalVarNode;128;-0.2017832,313.1494;Inherit;False;127;offset;1;0;OBJECT;;False;1;FLOAT;0
  178. Node;AmplifyShaderEditor.SamplerNode;75;-49.47306,-83.18158;Inherit;True;Property;_TextureSample0;Texture Sample 0;2;0;Create;True;0;0;0;False;0;False;-1;None;None;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
  179. Node;AmplifyShaderEditor.DynamicAppendNode;129;160.598,312.1494;Inherit;False;FLOAT3;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT3;0
  180. Node;AmplifyShaderEditor.RangedFloatNode;103;276.1326,152.4478;Inherit;False;Property;_AlphaClip;AlphaClip;1;0;Create;True;0;0;0;False;0;False;0;0.234;0;1;0;1;FLOAT;0
  181. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;66;281.7648,-88.28107;Inherit;True;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0
  182. Node;AmplifyShaderEditor.ClipNode;100;574.4559,32.0785;Inherit;False;3;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;COLOR;0
  183. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;117;294.5497,250.9735;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0
  184. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;2;857.6697,146.2849;Float;False;True;-1;2;ASEMaterialInspector;0;1;Seaweed;0770190933193b94aaa3065e307002fa;True;Unlit;0;0;Unlit;2;False;True;0;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;True;0;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;True;0;False;-1;False;True;0;False;-1;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;1;RenderType=Opaque=RenderType;True;2;False;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=ForwardBase;False;False;0;;0;0;Standard;1;Vertex Position,InvertActionOnDeselection;1;0;0;1;True;False;;False;0
  185. WireConnection;84;0;131;2
  186. WireConnection;84;1;82;0
  187. WireConnection;132;0;86;0
  188. WireConnection;132;1;133;0
  189. WireConnection;85;0;84;0
  190. WireConnection;85;1;132;0
  191. WireConnection;87;0;85;0
  192. WireConnection;91;0;92;0
  193. WireConnection;91;1;87;0
  194. WireConnection;127;0;91;0
  195. WireConnection;90;0;83;1
  196. WireConnection;90;1;130;0
  197. WireConnection;72;0;74;0
  198. WireConnection;77;0;90;0
  199. WireConnection;77;1;83;2
  200. WireConnection;73;0;72;0
  201. WireConnection;73;1;77;0
  202. WireConnection;120;0;73;0
  203. WireConnection;125;0;74;0
  204. WireConnection;118;0;121;0
  205. WireConnection;118;1;122;0
  206. WireConnection;118;2;115;0
  207. WireConnection;75;0;126;0
  208. WireConnection;75;1;118;0
  209. WireConnection;129;0;128;0
  210. WireConnection;66;0;75;0
  211. WireConnection;66;1;67;0
  212. WireConnection;100;0;66;0
  213. WireConnection;100;1;75;4
  214. WireConnection;100;2;103;0
  215. WireConnection;117;0;115;0
  216. WireConnection;117;1;129;0
  217. WireConnection;2;0;100;0
  218. WireConnection;2;1;117;0
  219. ASEEND*/
  220. //CHKSM=CA4418A09CD3E6BAB0A5EF35384B855327DCF68C
Add Comment
Please, Sign In to add comment