// Made with Amplify Shader Editor // Available at the Unity Asset Store - http://u3d.as/y3X Shader "EMD/S_RainWindow" { Properties { _RainMask("RainMask", 2D) = "white" {} _Streak_Tiling("Streak_Tiling", Vector) = (1,1,0,0) _Tint("Tint", Color) = (0.0235849,0.4647454,1,0) _Streak_Speed("Streak_Speed", Range( 0 , 3)) = 0.3 _Distort_Scale("Distort_Scale", Range( 0 , 10)) = 1 _Distort_Amount("Distort_Amount", Range( 0 , 1)) = 1 _Normal_Power("Normal_Power", Float) = 1 _Splotch_Scale("Splotch_Scale", Float) = 5 _Splotch_Speed("Splotch_Speed", Range( 0 , 1.5)) = 1 _Splotch_Power("Splotch_Power", Range( 0 , 1)) = 1 [Toggle(_OPACITYMASKTOGGLE_ON)] _OpacityMaskToggle("OpacityMaskToggle", Float) = 1 _Opacity_Amount("Opacity_Amount", Range( 0 , 1)) = 1 [HideInInspector] _texcoord( "", 2D ) = "white" {} [HideInInspector] __dirty( "", Int ) = 1 } SubShader { Tags{ "RenderType" = "Transparent" "Queue" = "Transparent+0" "IgnoreProjector" = "True" } Cull Back CGINCLUDE #include "UnityShaderVariables.cginc" #include "UnityPBSLighting.cginc" #include "Lighting.cginc" #pragma target 3.0 #pragma shader_feature_local _OPACITYMASKTOGGLE_ON #ifdef UNITY_PASS_SHADOWCASTER #undef INTERNAL_DATA #undef WorldReflectionVector #undef WorldNormalVector #define INTERNAL_DATA half3 internalSurfaceTtoW0; half3 internalSurfaceTtoW1; half3 internalSurfaceTtoW2; #define WorldReflectionVector(data,normal) reflect (data.worldRefl, half3(dot(data.internalSurfaceTtoW0,normal), dot(data.internalSurfaceTtoW1,normal), dot(data.internalSurfaceTtoW2,normal))) #define WorldNormalVector(data,normal) half3(dot(data.internalSurfaceTtoW0,normal), dot(data.internalSurfaceTtoW1,normal), dot(data.internalSurfaceTtoW2,normal)) #endif struct Input { float3 worldPos; float3 worldNormal; INTERNAL_DATA float2 uv_texcoord; }; uniform sampler2D _RainMask; uniform float _Streak_Speed; uniform float2 _Streak_Tiling; uniform float _Distort_Scale; uniform float _Distort_Amount; uniform float _Splotch_Speed; uniform float _Splotch_Scale; uniform float _Splotch_Power; uniform float _Normal_Power; uniform float4 _Tint; uniform float _Opacity_Amount; float3 mod2D289( float3 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; } float2 mod2D289( float2 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; } float3 permute( float3 x ) { return mod2D289( ( ( x * 34.0 ) + 1.0 ) * x ); } float snoise( float2 v ) { const float4 C = float4( 0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439 ); float2 i = floor( v + dot( v, C.yy ) ); float2 x0 = v - i + dot( i, C.xx ); float2 i1; i1 = ( x0.x > x0.y ) ? float2( 1.0, 0.0 ) : float2( 0.0, 1.0 ); float4 x12 = x0.xyxy + C.xxzz; x12.xy -= i1; i = mod2D289( i ); float3 p = permute( permute( i.y + float3( 0.0, i1.y, 1.0 ) ) + i.x + float3( 0.0, i1.x, 1.0 ) ); float3 m = max( 0.5 - float3( dot( x0, x0 ), dot( x12.xy, x12.xy ), dot( x12.zw, x12.zw ) ), 0.0 ); m = m * m; m = m * m; float3 x = 2.0 * frac( p * C.www ) - 1.0; float3 h = abs( x ) - 0.5; float3 ox = floor( x + 0.5 ); float3 a0 = x - ox; m *= 1.79284291400159 - 0.85373472095314 * ( a0 * a0 + h * h ); float3 g; g.x = a0.x * x0.x + h.x * x0.y; g.yz = a0.yz * x12.xz + h.yz * x12.yw; return 130.0 * dot( m, g ); } float3 PerturbNormal107_g1( float3 surf_pos, float3 surf_norm, float height, float scale ) { // "Bump Mapping Unparametrized Surfaces on the GPU" by Morten S. Mikkelsen float3 vSigmaS = ddx( surf_pos ); float3 vSigmaT = ddy( surf_pos ); float3 vN = surf_norm; float3 vR1 = cross( vSigmaT , vN ); float3 vR2 = cross( vN , vSigmaS ); float fDet = dot( vSigmaS , vR1 ); float dBs = ddx( height ); float dBt = ddy( height ); float3 vSurfGrad = scale * 0.05 * sign( fDet ) * ( dBs * vR1 + dBt * vR2 ); return normalize ( abs( fDet ) * vN - vSurfGrad ); } float2 voronoihash89( 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 voronoi89( 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 = voronoihash89( 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 StreakNSplotches;1,1,1,1;0;0 Node;AmplifyShaderEditor.RegisterLocalVarNode;104;-1338.648,2409.57;Inherit;True;Splotches;-1;True;1;0;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.RegisterLocalVarNode;24;-1197.104,-495.3581;Float;False;Streaks;-1;True;1;0;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.GetLocalVarNode;112;-669.0375,-1115.553;Inherit;False;24;Streaks;1;0;OBJECT;;False;1;FLOAT;0 Node;AmplifyShaderEditor.GetLocalVarNode;113;-648.762,-944.1273;Inherit;False;104;Splotches;1;0;OBJECT;;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleAddOpNode;114;-416.762,-1017.127;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SaturateNode;115;-267.7621,-1019.127;Inherit;True;1;0;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.CommentaryNode;158;-281.1639,-470.8122;Inherit;False;1527.3;411.4998;;6;154;171;173;157;156;155;Opacity;1,1,1,1;0;0 Node;AmplifyShaderEditor.CommentaryNode;83;-2584.314,1391.641;Inherit;False;1560.912;411.3195;;5;81;88;76;77;75;StreaksNormal;1,1,1,1;0;0 Node;AmplifyShaderEditor.CommentaryNode;145;-2513.378,-2843.053;Inherit;False;1685.433;668.8965;;8;142;161;160;133;141;144;135;132;Tint;1,1,1,1;0;0 Node;AmplifyShaderEditor.RegisterLocalVarNode;116;-55.76227,-1002.127;Inherit;False;StreakNSplotch;-1;True;1;0;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.ColorNode;132;-2451.378,-2581.933;Inherit;False;Constant;_Color0;Color 0;11;0;Create;True;0;0;0;False;0;False;0.9528302,0.9528302,0.9528302,0;0,0,0,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.ColorNode;135;-2463.378,-2767.933;Inherit;False;Constant;_Color1;Color 1;11;0;Create;True;0;0;0;False;0;False;0.4150943,0.4150943,0.4150943,0;0,0,0,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.GetLocalVarNode;144;-2390.955,-2340.28;Inherit;False;116;StreakNSplotch;1;0;OBJECT;;False;1;FLOAT;0 Node;AmplifyShaderEditor.GetLocalVarNode;75;-2534.314,1441.641;Inherit;False;116;StreakNSplotch;1;0;OBJECT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode;77;-2521.305,1659.63;Float;False;Property;_Normal_Power;Normal_Power;6;0;Create;True;0;0;0;False;0;False;1;1;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.GetLocalVarNode;155;-231.1639,-303.8122;Inherit;False;116;StreakNSplotch;1;0;OBJECT;;False;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode;156;-175.1639,-420.8122;Inherit;False;Constant;_Float1;Float 1;13;0;Create;True;0;0;0;False;0;False;1;0;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.StaticSwitch;154;123.636,-293.1122;Inherit;True;Property;_OpacityMaskToggle;OpacityMaskToggle;10;0;Create;True;0;0;0;False;0;False;0;1;1;True;;Toggle;2;Key0;Key1;Create;True;True;9;1;FLOAT;0;False;0;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT;0;False;7;FLOAT;0;False;8;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;76;-2256.305,1551.63;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode;171;408.0039,-407.594;Inherit;False;Property;_Opacity_Amount;Opacity_Amount;11;0;Create;True;0;0;0;False;0;False;1;1;0;1;0;1;FLOAT;0 Node;AmplifyShaderEditor.ColorNode;141;-2070.194,-2793.053;Inherit;False;Property;_Tint;Tint;2;0;Create;True;0;0;0;False;0;False;0.0235849,0.4647454,1,0;0.0235849,0.4647454,1,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.OneMinusNode;161;-2117.097,-2318.03;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.LerpOp;133;-2083.377,-2591.933;Inherit;True;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.LerpOp;160;-1778.897,-2692.13;Inherit;True;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0 Node;AmplifyShaderEditor.FunctionNode;88;-1844.958,1552.37;Inherit;False;Normal From Height;-1;;2;1942fe2c5f1a1f94881a33d532e4afeb;0;2;20;FLOAT;0;False;110;FLOAT;1;False;2;FLOAT3;40;FLOAT3;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;173;740.0039,-282.594;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.RegisterLocalVarNode;81;-1273.005,1551.202;Float;False;StreaksNormal;-1;True;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0 Node;AmplifyShaderEditor.RegisterLocalVarNode;157;1002.836,-302.8122;Inherit;False;Opacity;-1;True;1;0;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.RegisterLocalVarNode;142;-1081.449,-2619.719;Inherit;False;Albedo;-1;True;1;0;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.GetLocalVarNode;82;781.0571,-951.9244;Inherit;False;81;StreaksNormal;1;0;OBJECT;0;False;1;FLOAT3;0 Node;AmplifyShaderEditor.GetLocalVarNode;143;789.1217,-1042.851;Inherit;False;142;Albedo;1;0;OBJECT;;False;1;COLOR;0 Node;AmplifyShaderEditor.GetLocalVarNode;159;592.495,-642.4875;Inherit;False;157;Opacity;1;0;OBJECT;;False;1;FLOAT;0 Node;AmplifyShaderEditor.GetLocalVarNode;166;606.0959,-869.5304;Inherit;False;-1;;1;0;OBJECT;;False;1;FLOAT;0 Node;AmplifyShaderEditor.StandardSurfaceOutputNode;0;1079.026,-1010.494;Float;False;True;-1;2;ASEMaterialInspector;0;0;Standard;EMD/S_RainWindow;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;False;False;False;False;False;False;Back;0;False;-1;0;False;-1;False;0;False;-1;0;False;-1;False;0;Transparent;0.5;True;True;0;False;Transparent;;Transparent;All;16;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;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;;-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;47;0;45;0 WireConnection;47;1;48;0 WireConnection;87;20;47;0 WireConnection;67;0;87;40 WireConnection;20;0;18;0 WireConnection;34;0;33;0 WireConnection;91;0;90;0 WireConnection;91;1;92;0 WireConnection;68;0;67;0 WireConnection;68;1;69;0 WireConnection;10;0;9;0 WireConnection;21;0;20;1 WireConnection;21;1;20;2 WireConnection;89;0;85;0 WireConnection;89;1;91;0 WireConnection;89;2;86;0 WireConnection;35;0;34;3 WireConnection;35;1;34;2 WireConnection;58;0;68;0 WireConnection;41;0;10;0 WireConnection;41;1;42;0 WireConnection;36;0;35;0 WireConnection;36;1;23;0 WireConnection;94;0;89;0 WireConnection;22;0;23;0 WireConnection;22;1;21;0 WireConnection;11;0;41;0 WireConnection;110;0;9;2 WireConnection;96;0;94;0 WireConnection;96;1;89;1 WireConnection;74;0;22;0 WireConnection;74;1;72;0 WireConnection;73;0;36;0 WireConnection;73;1;72;0 WireConnection;29;0;27;0 WireConnection;29;1;28;0 WireConnection;98;0;96;0 WireConnection;98;2;99;0 WireConnection;16;0;11;2 WireConnection;26;0;74;0 WireConnection;26;1;29;0 WireConnection;32;0;73;0 WireConnection;32;1;29;0 WireConnection;109;0;110;0 WireConnection;14;0;11;0 WireConnection;111;0;42;0 WireConnection;111;1;109;0 WireConnection;37;1;32;0 WireConnection;97;1;98;0 WireConnection;95;0;89;0 WireConnection;1;1;26;0 WireConnection;100;0;97;2 WireConnection;100;1;95;0 WireConnection;15;0;111;0 WireConnection;38;1;37;1 WireConnection;38;2;39;0 WireConnection;30;1;1;1 WireConnection;30;2;31;0 WireConnection;40;0;38;0 WireConnection;40;1;30;0 WireConnection;102;0;100;0 WireConnection;102;1;103;0 WireConnection;107;0;102;0 WireConnection;107;1;108;0 WireConnection;43;0;40;0 WireConnection;104;0;107;0 WireConnection;24;0;43;0 WireConnection;114;0;112;0 WireConnection;114;1;113;0 WireConnection;115;0;114;0 WireConnection;116;0;115;0 WireConnection;154;1;156;0 WireConnection;154;0;155;0 WireConnection;76;0;75;0 WireConnection;76;1;77;0 WireConnection;161;0;144;0 WireConnection;133;0;135;0 WireConnection;133;1;132;0 WireConnection;133;2;144;0 WireConnection;160;0;141;0 WireConnection;160;1;133;0 WireConnection;160;2;161;0 WireConnection;88;20;76;0 WireConnection;173;0;154;0 WireConnection;173;1;171;0 WireConnection;81;0;88;40 WireConnection;157;0;173;0 WireConnection;142;0;160;0 WireConnection;0;0;143;0 WireConnection;0;1;82;0 WireConnection;0;4;166;0 WireConnection;0;9;159;0 ASEEND*/ //CHKSM=397884781D2B79F7B8F3224FE61ADF9919BAC594