252 lines
14 KiB
Plaintext
252 lines
14 KiB
Plaintext
// Upgrade NOTE: upgraded instancing buffer 'Water' to new syntax.
|
|
|
|
// Made with Amplify Shader Editor
|
|
// Available at the Unity Asset Store - http://u3d.as/y3X
|
|
Shader "Water"
|
|
{
|
|
Properties
|
|
{
|
|
_MainCol("MainCol", Color) = (0.1713243,0.4016109,0.4716981,0)
|
|
_Tex_N1("Tex_N1", 2D) = "bump" {}
|
|
_N1Int("N1 Int", Range( 0 , 1)) = 0.5
|
|
_N1Size("N1 Size", Vector) = (0.1,0.1,0,0)
|
|
_WaveSpeed("Wave Speed", Float) = 0.2
|
|
_N1WaveDir("N1WaveDir", Vector) = (-1,0.5,0,0)
|
|
_Tex_N2("Tex_N2", 2D) = "bump" {}
|
|
_N2Int("N2 Int", Range( 0 , 1)) = 0.5
|
|
_N2Size("N2 Size", Vector) = (0.1,0.1,0,0)
|
|
_N2WaveDir("N2WaveDir", Vector) = (-1,0.5,0,0)
|
|
_N2WaveSpeed("N2Wave Speed", Float) = 0.2
|
|
_Smooth("Smooth", Range( 0 , 1)) = 0.4
|
|
_Metal("Metal", Range( 0 , 1)) = 0.4
|
|
_Opacityint("Opacity int", Range( 0 , 1)) = 0
|
|
[HideInInspector] _texcoord( "", 2D ) = "white" {}
|
|
[HideInInspector] __dirty( "", Int ) = 1
|
|
}
|
|
|
|
SubShader
|
|
{
|
|
Tags{ "RenderType" = "Transparent" "Queue" = "Transparent+0" "IgnoreProjector" = "True" }
|
|
Cull Back
|
|
CGINCLUDE
|
|
#include "UnityStandardUtils.cginc"
|
|
#include "UnityShaderVariables.cginc"
|
|
#include "UnityPBSLighting.cginc"
|
|
#include "Lighting.cginc"
|
|
#pragma target 3.0
|
|
#pragma multi_compile_instancing
|
|
#define ASE_USING_SAMPLING_MACROS 1
|
|
#if defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (defined(SHADER_TARGET_SURFACE_ANALYSIS) && !defined(SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER))//ASE Sampler Macros
|
|
#define SAMPLE_TEXTURE2D(tex,samplerTex,coord) tex.Sample(samplerTex,coord)
|
|
#else//ASE Sampling Macros
|
|
#define SAMPLE_TEXTURE2D(tex,samplerTex,coord) tex2D(tex,coord)
|
|
#endif//ASE Sampling Macros
|
|
|
|
struct Input
|
|
{
|
|
float2 uv_texcoord;
|
|
};
|
|
|
|
UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex_N1);
|
|
uniform float _WaveSpeed;
|
|
uniform float2 _N1WaveDir;
|
|
SamplerState sampler_Tex_N1;
|
|
uniform float _N1Int;
|
|
UNITY_DECLARE_TEX2D_NOSAMPLER(_Tex_N2);
|
|
uniform float _N2WaveSpeed;
|
|
uniform float2 _N2WaveDir;
|
|
SamplerState sampler_Tex_N2;
|
|
uniform float _N2Int;
|
|
uniform float4 _MainCol;
|
|
uniform float _Metal;
|
|
uniform float _Smooth;
|
|
uniform float _Opacityint;
|
|
|
|
UNITY_INSTANCING_BUFFER_START(Water)
|
|
UNITY_DEFINE_INSTANCED_PROP(float2, _N1Size)
|
|
#define _N1Size_arr Water
|
|
UNITY_DEFINE_INSTANCED_PROP(float2, _N2Size)
|
|
#define _N2Size_arr Water
|
|
UNITY_INSTANCING_BUFFER_END(Water)
|
|
|
|
void surf( Input i , inout SurfaceOutputStandard o )
|
|
{
|
|
float mulTime33 = _Time.y * _WaveSpeed;
|
|
float2 _N1Size_Instance = UNITY_ACCESS_INSTANCED_PROP(_N1Size_arr, _N1Size);
|
|
float2 uv_TexCoord76 = i.uv_texcoord * _N1Size_Instance;
|
|
float2 panner75 = ( mulTime33 * _N1WaveDir + uv_TexCoord76);
|
|
float3 tex2DNode25 = UnpackNormal( SAMPLE_TEXTURE2D( _Tex_N1, sampler_Tex_N1, panner75 ) );
|
|
float4 appendResult144 = (float4(( tex2DNode25.r * _N1Int ) , ( tex2DNode25.g * _N1Int ) , tex2DNode25.b , 0.0));
|
|
float mulTime85 = _Time.y * _N2WaveSpeed;
|
|
float2 _N2Size_Instance = UNITY_ACCESS_INSTANCED_PROP(_N2Size_arr, _N2Size);
|
|
float2 uv_TexCoord90 = i.uv_texcoord * _N2Size_Instance;
|
|
float2 panner86 = ( mulTime85 * _N2WaveDir + uv_TexCoord90);
|
|
float3 tex2DNode79 = UnpackNormal( SAMPLE_TEXTURE2D( _Tex_N2, sampler_Tex_N2, panner86 ) );
|
|
float4 appendResult142 = (float4(( tex2DNode79.r * _N2Int ) , ( tex2DNode79.g * _N2Int ) , tex2DNode79.b , 0.0));
|
|
float3 VarNormal138 = BlendNormals( appendResult144.xyz , appendResult142.xyz );
|
|
o.Normal = VarNormal138;
|
|
float4 VarAlbedo136 = _MainCol;
|
|
o.Albedo = VarAlbedo136.rgb;
|
|
o.Metallic = _Metal;
|
|
o.Smoothness = _Smooth;
|
|
o.Alpha = _Opacityint;
|
|
}
|
|
|
|
ENDCG
|
|
CGPROGRAM
|
|
#pragma surface surf Standard alpha:fade keepalpha fullforwardshadows
|
|
|
|
ENDCG
|
|
Pass
|
|
{
|
|
Name "ShadowCaster"
|
|
Tags{ "LightMode" = "ShadowCaster" }
|
|
ZWrite On
|
|
CGPROGRAM
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
#pragma target 3.0
|
|
#pragma multi_compile_shadowcaster
|
|
#pragma multi_compile UNITY_PASS_SHADOWCASTER
|
|
#pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2
|
|
#include "HLSLSupport.cginc"
|
|
#if ( SHADER_API_D3D11 || SHADER_API_GLCORE || SHADER_API_GLES || SHADER_API_GLES3 || SHADER_API_METAL || SHADER_API_VULKAN )
|
|
#define CAN_SKIP_VPOS
|
|
#endif
|
|
#include "UnityCG.cginc"
|
|
#include "Lighting.cginc"
|
|
#include "UnityPBSLighting.cginc"
|
|
sampler3D _DitherMaskLOD;
|
|
struct v2f
|
|
{
|
|
V2F_SHADOW_CASTER;
|
|
float2 customPack1 : TEXCOORD1;
|
|
float3 worldPos : TEXCOORD2;
|
|
float4 tSpace0 : TEXCOORD3;
|
|
float4 tSpace1 : TEXCOORD4;
|
|
float4 tSpace2 : TEXCOORD5;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
UNITY_VERTEX_OUTPUT_STEREO
|
|
};
|
|
v2f vert( appdata_full v )
|
|
{
|
|
v2f o;
|
|
UNITY_SETUP_INSTANCE_ID( v );
|
|
UNITY_INITIALIZE_OUTPUT( v2f, o );
|
|
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o );
|
|
UNITY_TRANSFER_INSTANCE_ID( v, o );
|
|
Input customInputData;
|
|
float3 worldPos = mul( unity_ObjectToWorld, v.vertex ).xyz;
|
|
half3 worldNormal = UnityObjectToWorldNormal( v.normal );
|
|
half3 worldTangent = UnityObjectToWorldDir( v.tangent.xyz );
|
|
half tangentSign = v.tangent.w * unity_WorldTransformParams.w;
|
|
half3 worldBinormal = cross( worldNormal, worldTangent ) * tangentSign;
|
|
o.tSpace0 = float4( worldTangent.x, worldBinormal.x, worldNormal.x, worldPos.x );
|
|
o.tSpace1 = float4( worldTangent.y, worldBinormal.y, worldNormal.y, worldPos.y );
|
|
o.tSpace2 = float4( worldTangent.z, worldBinormal.z, worldNormal.z, worldPos.z );
|
|
o.customPack1.xy = customInputData.uv_texcoord;
|
|
o.customPack1.xy = v.texcoord;
|
|
o.worldPos = worldPos;
|
|
TRANSFER_SHADOW_CASTER_NORMALOFFSET( o )
|
|
return o;
|
|
}
|
|
half4 frag( v2f IN
|
|
#if !defined( CAN_SKIP_VPOS )
|
|
, UNITY_VPOS_TYPE vpos : VPOS
|
|
#endif
|
|
) : SV_Target
|
|
{
|
|
UNITY_SETUP_INSTANCE_ID( IN );
|
|
Input surfIN;
|
|
UNITY_INITIALIZE_OUTPUT( Input, surfIN );
|
|
surfIN.uv_texcoord = IN.customPack1.xy;
|
|
float3 worldPos = IN.worldPos;
|
|
half3 worldViewDir = normalize( UnityWorldSpaceViewDir( worldPos ) );
|
|
SurfaceOutputStandard o;
|
|
UNITY_INITIALIZE_OUTPUT( SurfaceOutputStandard, o )
|
|
surf( surfIN, o );
|
|
#if defined( CAN_SKIP_VPOS )
|
|
float2 vpos = IN.pos;
|
|
#endif
|
|
half alphaRef = tex3D( _DitherMaskLOD, float3( vpos.xy * 0.25, o.Alpha * 0.9375 ) ).a;
|
|
clip( alphaRef - 0.01 );
|
|
SHADOW_CASTER_FRAGMENT( IN )
|
|
}
|
|
ENDCG
|
|
}
|
|
}
|
|
Fallback "Diffuse"
|
|
CustomEditor "ASEMaterialInspector"
|
|
}
|
|
/*ASEBEGIN
|
|
Version=18935
|
|
1913;125;1920;894;2488.361;-753.5627;1;True;True
|
|
Node;AmplifyShaderEditor.Vector2Node;88;-5890.384,482.9011;Inherit;False;InstancedProperty;_N2Size;N2 Size;8;0;Create;True;0;0;0;False;0;False;0.1,0.1;1,1;0;3;FLOAT2;0;FLOAT;1;FLOAT;2
|
|
Node;AmplifyShaderEditor.RangedFloatNode;31;-5462.138,165.0794;Inherit;False;Property;_WaveSpeed;Wave Speed;4;0;Create;True;0;0;0;False;0;False;0.2;0.03;0;0;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;87;-5732.61,941.5832;Inherit;False;Property;_N2WaveSpeed;N2Wave Speed;10;0;Create;True;0;0;0;False;0;False;0.2;0.05;0;0;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.Vector2Node;78;-5658.146,-307.0432;Inherit;False;InstancedProperty;_N1Size;N1 Size;3;0;Create;True;0;0;0;False;0;False;0.1,0.1;3,0.5;0;3;FLOAT2;0;FLOAT;1;FLOAT;2
|
|
Node;AmplifyShaderEditor.SimpleTimeNode;85;-5468.766,906.3513;Inherit;True;1;0;FLOAT;1;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.TextureCoordinatesNode;90;-5631.44,447.9568;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
|
|
Node;AmplifyShaderEditor.TextureCoordinatesNode;76;-5397.968,-347.547;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
|
|
Node;AmplifyShaderEditor.Vector2Node;77;-5473.128,-26.79488;Inherit;False;Property;_N1WaveDir;N1WaveDir;5;0;Create;True;0;0;0;False;0;False;-1,0.5;1,-0.5;0;3;FLOAT2;0;FLOAT;1;FLOAT;2
|
|
Node;AmplifyShaderEditor.SimpleTimeNode;33;-5198.294,129.8473;Inherit;True;1;0;FLOAT;1;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.Vector2Node;89;-5728,748.4096;Inherit;False;Property;_N2WaveDir;N2WaveDir;9;0;Create;True;0;0;0;False;0;False;-1,0.5;-1,0.5;0;3;FLOAT2;0;FLOAT;1;FLOAT;2
|
|
Node;AmplifyShaderEditor.PannerNode;75;-5155.083,-108.9721;Inherit;False;3;0;FLOAT2;0,0;False;2;FLOAT2;0,1;False;1;FLOAT;1;False;1;FLOAT2;0
|
|
Node;AmplifyShaderEditor.PannerNode;86;-5258.255,644.4326;Inherit;True;3;0;FLOAT2;0,0;False;2;FLOAT2;0,1;False;1;FLOAT;1;False;1;FLOAT2;0
|
|
Node;AmplifyShaderEditor.SamplerNode;25;-4880.578,-136.1587;Inherit;True;Property;_Tex_N1;Tex_N1;1;0;Create;True;0;0;0;False;0;False;-1;None;1bec69f41ff39e64d951fce4994e9fde;True;0;True;bump;Auto;True;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;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.RangedFloatNode;93;-5005.905,403.1549;Inherit;False;Property;_N1Int;N1 Int;2;0;Create;True;0;0;0;False;0;False;0.5;0.3;0;1;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SamplerNode;79;-4909.996,610.9186;Inherit;True;Property;_Tex_N2;Tex_N2;6;0;Create;True;0;0;0;False;0;False;-1;None;b59a4af6e63d67c49b1c808edeb0ea9e;True;0;True;bump;Auto;True;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;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.RangedFloatNode;92;-5024.348,965.045;Inherit;False;Property;_N2Int;N2 Int;7;0;Create;True;0;0;0;False;0;False;0.5;0.2;0;1;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;91;-4575.878,747.4017;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;140;-4562.113,991.5313;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;145;-4591.284,395.6144;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;94;-4539.551,44.69257;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.DynamicAppendNode;142;-4321.044,833.7137;Inherit;True;FLOAT4;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT4;0
|
|
Node;AmplifyShaderEditor.DynamicAppendNode;144;-4299.514,233.8968;Inherit;True;FLOAT4;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT4;0
|
|
Node;AmplifyShaderEditor.ColorNode;71;-2635.603,-348.3813;Inherit;False;Property;_MainCol;MainCol;0;0;Create;True;0;0;0;False;0;False;0.1713243,0.4016109,0.4716981,0;0.345098,0.4509804,0.4186104,1;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.BlendNormalsNode;143;-3988.447,463.6055;Inherit;True;0;3;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;1;FLOAT3;0
|
|
Node;AmplifyShaderEditor.RegisterLocalVarNode;138;-3656.799,514.3877;Inherit;False;VarNormal;-1;True;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0
|
|
Node;AmplifyShaderEditor.RegisterLocalVarNode;136;-2333.948,-389.4832;Inherit;False;VarAlbedo;-1;True;1;0;COLOR;0,0,0,0;False;1;COLOR;0
|
|
Node;AmplifyShaderEditor.GetLocalVarNode;137;-1776,976;Inherit;False;136;VarAlbedo;1;0;OBJECT;;False;1;COLOR;0
|
|
Node;AmplifyShaderEditor.GetLocalVarNode;139;-1784.483,1052.97;Inherit;False;138;VarNormal;1;0;OBJECT;;False;1;FLOAT3;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;50;-1850.066,1250.386;Inherit;False;Property;_Smooth;Smooth;11;0;Create;True;0;0;0;False;0;False;0.4;0.9;0;1;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;146;-1849.793,1139.253;Inherit;False;Property;_Metal;Metal;12;0;Create;True;0;0;0;False;0;False;0.4;0.5;0;1;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;147;-1901.361,1379.563;Inherit;False;Property;_Opacityint;Opacity int;13;0;Create;True;0;0;0;False;0;False;0;0.47;0;1;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.StandardSurfaceOutputNode;99;-1505.959,1036.725;Float;False;True;-1;2;ASEMaterialInspector;0;0;Standard;Water;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;False;False;False;False;False;False;Back;1;False;-1;3;False;-1;False;0;False;-1;0;False;-1;False;0;Transparent;0.5;True;True;0;True;Transparent;;Transparent;All;18;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;0;5;False;-1;10;False;-1;0;False;-1;0;False;-1;0;False;0;0,0,0,0;VertexOffset;True;False;Cylindrical;False;True;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;True;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
|
|
WireConnection;85;0;87;0
|
|
WireConnection;90;0;88;0
|
|
WireConnection;76;0;78;0
|
|
WireConnection;33;0;31;0
|
|
WireConnection;75;0;76;0
|
|
WireConnection;75;2;77;0
|
|
WireConnection;75;1;33;0
|
|
WireConnection;86;0;90;0
|
|
WireConnection;86;2;89;0
|
|
WireConnection;86;1;85;0
|
|
WireConnection;25;1;75;0
|
|
WireConnection;79;1;86;0
|
|
WireConnection;91;0;79;1
|
|
WireConnection;91;1;92;0
|
|
WireConnection;140;0;79;2
|
|
WireConnection;140;1;92;0
|
|
WireConnection;145;0;25;2
|
|
WireConnection;145;1;93;0
|
|
WireConnection;94;0;25;1
|
|
WireConnection;94;1;93;0
|
|
WireConnection;142;0;91;0
|
|
WireConnection;142;1;140;0
|
|
WireConnection;142;2;79;3
|
|
WireConnection;144;0;94;0
|
|
WireConnection;144;1;145;0
|
|
WireConnection;144;2;25;3
|
|
WireConnection;143;0;144;0
|
|
WireConnection;143;1;142;0
|
|
WireConnection;138;0;143;0
|
|
WireConnection;136;0;71;0
|
|
WireConnection;99;0;137;0
|
|
WireConnection;99;1;139;0
|
|
WireConnection;99;3;146;0
|
|
WireConnection;99;4;50;0
|
|
WireConnection;99;9;147;0
|
|
ASEEND*/
|
|
//CHKSM=70F483106ACB5AADDBF8391F96B6265D460388F2 |