Files
LowPolyRPG/Assets/Hayq Art/Middle Ages Low Poly/Shaders/SH_Water.shader
Caleb Sandford deQuincey 715fb68744 Initial commitment
2025-06-25 11:10:11 +01:00

108 lines
4.8 KiB
GLSL

// Made with Amplify Shader Editor
// Available at the Unity Asset Store - http://u3d.as/y3X
Shader "SH_Water"
{
Properties
{
_WaterSpeed("Water Speed", Float) = 1
_Density("Density", Float) = 15
_Color_1("Color_1", Color) = (0.006289184,0.3638146,1,0)
_Color_2("Color_2", Color) = (0,0.264021,0.6886792,0)
[HideInInspector] _texcoord( "", 2D ) = "white" {}
[HideInInspector] __dirty( "", Int ) = 1
}
SubShader
{
Tags{ "RenderType" = "Opaque" "Queue" = "Geometry+0" "IsEmissive" = "true" }
Cull Back
CGPROGRAM
#include "UnityShaderVariables.cginc"
#pragma target 3.0
#pragma surface surf Standard keepalpha addshadow fullforwardshadows
struct Input
{
float2 uv_texcoord;
};
uniform float _Density;
uniform float _WaterSpeed;
uniform float4 _Color_1;
uniform float4 _Color_2;
float2 voronoihash1( float2 p )
{
p = float2( dot( p, float2( 127.1, 311.7 ) ), dot( p, float2( 269.5, 183.3 ) ) );
return frac( sin( p ) *43758.5453);
}
float voronoi1( float2 v, float time, inout float2 id, inout float2 mr, float smoothness, inout float2 smoothId )
{
float2 n = floor( v );
float2 f = frac( v );
float F1 = 8.0;
float F2 = 8.0; float2 mg = 0;
for ( int j = -1; j <= 1; j++ )
{
for ( int i = -1; i <= 1; i++ )
{
float2 g = float2( i, j );
float2 o = voronoihash1( n + g );
o = ( sin( time + o * 6.2831 ) * 0.5 + 0.5 ); float2 r = f - g - o;
float d = 0.5 * dot( r, r );
if( d<F1 ) {
F2 = F1;
F1 = d; mg = g; mr = r; id = o;
} else if( d<F2 ) {
F2 = d;
}
}
}
return F1;
}
void surf( Input i , inout SurfaceOutputStandard o )
{
float mulTime4 = _Time.y * _WaterSpeed;
float time1 = mulTime4;
float2 voronoiSmoothId1 = 0;
float2 coords1 = i.uv_texcoord * _Density;
float2 id1 = 0;
float2 uv1 = 0;
float voroi1 = voronoi1( coords1, time1, id1, uv1, 0, voronoiSmoothId1 );
o.Emission = ( ( voroi1 * _Color_1 ) + _Color_2 ).rgb;
o.Alpha = 1;
}
ENDCG
}
Fallback "Diffuse"
CustomEditor "ASEMaterialInspector"
}
/*ASEBEGIN
Version=18935
6.339622;4.528302;2305.811;904.5849;2425.523;484.4689;1.809207;True;True
Node;AmplifyShaderEditor.RangedFloatNode;6;-939.6434,-181.2399;Inherit;False;Property;_WaterSpeed;Water Speed;0;0;Create;True;0;0;0;False;0;False;1;1;0;0;0;1;FLOAT;0
Node;AmplifyShaderEditor.SimpleTimeNode;4;-747.2973,-167.9699;Inherit;False;1;0;FLOAT;1;False;1;FLOAT;0
Node;AmplifyShaderEditor.RangedFloatNode;5;-722.1965,-82.30161;Inherit;False;Property;_Density;Density;1;0;Create;True;0;0;0;False;0;False;15;15;0;0;0;1;FLOAT;0
Node;AmplifyShaderEditor.VoronoiNode;1;-526.2435,-103.0663;Inherit;True;0;0;1;0;1;False;1;False;False;False;4;0;FLOAT2;0,0;False;1;FLOAT;0;False;2;FLOAT;1;False;3;FLOAT;0;False;3;FLOAT;0;FLOAT2;1;FLOAT2;2
Node;AmplifyShaderEditor.ColorNode;8;-582.1114,189.99;Inherit;False;Property;_Color_1;Color_1;2;0;Create;True;0;0;0;False;0;False;0.006289184,0.3638146,1,0;0.006289184,0.3638146,1,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;7;-296.2572,-99.48325;Inherit;True;2;2;0;FLOAT;0;False;1;COLOR;0,0,0,0;False;1;COLOR;0
Node;AmplifyShaderEditor.ColorNode;10;-287.2111,273.2134;Inherit;False;Property;_Color_2;Color_2;3;0;Create;True;0;0;0;False;0;False;0,0.264021,0.6886792,0;0,0.264021,0.6886792,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
Node;AmplifyShaderEditor.SimpleAddOpNode;11;-42.96827,-101.2925;Inherit;True;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0
Node;AmplifyShaderEditor.StandardSurfaceOutputNode;0;213.4863,-25.32889;Float;False;True;-1;2;ASEMaterialInspector;0;0;Standard;SH_Water;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;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;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;True;Relative;0;;-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;False;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;4;0;6;0
WireConnection;1;1;4;0
WireConnection;1;2;5;0
WireConnection;7;0;1;0
WireConnection;7;1;8;0
WireConnection;11;0;7;0
WireConnection;11;1;10;0
WireConnection;0;2;11;0
ASEEND*/
//CHKSM=C3EDF9E5A36DBEC87181BAEA7DA72F4B4D85D875