Shader "Hovl/Particles/Distortion" { Properties { _InvFade ("Soft Particles Factor", Range(0.01,3.0)) = 1.0 _NormalMap("Normal Map", 2D) = "bump" {} _Distortionpower("Distortion power", Float) = 1 [Toggle]_Enablesimpleopacity("Enable simple opacity", Float) = 0 [HideInInspector] _texcoord( "", 2D ) = "white" {} } Category { SubShader { LOD 0 Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" } Blend SrcAlpha OneMinusSrcAlpha ColorMask RGB Cull Off Lighting Off ZWrite Off ZTest LEqual Fog { Mode Off} GrabPass{ } Pass { CGPROGRAM #if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED) #define ASE_DECLARE_SCREENSPACE_TEXTURE(tex) UNITY_DECLARE_SCREENSPACE_TEXTURE(tex); #else #define ASE_DECLARE_SCREENSPACE_TEXTURE(tex) UNITY_DECLARE_SCREENSPACE_TEXTURE(tex) #endif #ifndef UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX #define UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input) #endif #pragma vertex vert #pragma fragment frag #pragma fragmentoption ARB_precision_hint_fastest #pragma target 2.0 #pragma multi_compile_instancing #pragma multi_compile_particles #pragma multi_compile_fog #define ASE_NEEDS_FRAG_COLOR #include "UnityCG.cginc" struct appdata_t { float4 vertex : POSITION; fixed4 color : COLOR; float4 texcoord : TEXCOORD0; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct v2f { float4 vertex : SV_POSITION; fixed4 color : COLOR; float4 texcoord : TEXCOORD0; UNITY_FOG_COORDS(1) #ifdef SOFTPARTICLES_ON float4 projPos : TEXCOORD2; #endif UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO float4 ase_texcoord3 : TEXCOORD3; }; #if UNITY_VERSION >= 560 UNITY_DECLARE_DEPTH_TEXTURE( _CameraDepthTexture ); #else uniform sampler2D_float _CameraDepthTexture; #endif //Don't delete this comment // uniform sampler2D_float _CameraDepthTexture; uniform float _InvFade; ASE_DECLARE_SCREENSPACE_TEXTURE( _GrabTexture ) uniform sampler2D _NormalMap; uniform float4 _NormalMap_ST; uniform float _Distortionpower; uniform float _Enablesimpleopacity; inline float4 ASE_ComputeGrabScreenPos( float4 pos ) { #if UNITY_UV_STARTS_AT_TOP float scale = -1.0; #else float scale = 1.0; #endif float4 o = pos; o.y = pos.w * 0.5f; o.y = ( pos.y - o.y ) * _ProjectionParams.x * scale + o.y; return o; } v2f vert ( appdata_t v ) { v2f o; UNITY_SETUP_INSTANCE_ID(v); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); UNITY_TRANSFER_INSTANCE_ID(v, o); float4 ase_clipPos = UnityObjectToClipPos(v.vertex); float4 screenPos = ComputeScreenPos(ase_clipPos); o.ase_texcoord3 = screenPos; v.vertex.xyz += float3( 0, 0, 0 ) ; o.vertex = UnityObjectToClipPos(v.vertex); #ifdef SOFTPARTICLES_ON o.projPos = ComputeScreenPos (o.vertex); COMPUTE_EYEDEPTH(o.projPos.z); #endif o.color = v.color; o.texcoord = v.texcoord; UNITY_TRANSFER_FOG(o,o.vertex); return o; } fixed4 frag ( v2f i ) : SV_Target { UNITY_SETUP_INSTANCE_ID( i ); UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( i ); #ifdef SOFTPARTICLES_ON float sceneZ = LinearEyeDepth (SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(i.projPos))); float partZ = i.projPos.z; float fade = saturate (_InvFade * (sceneZ-partZ)); i.color.a *= fade; #endif float4 screenPos = i.ase_texcoord3; float4 ase_grabScreenPos = ASE_ComputeGrabScreenPos( screenPos ); float4 ase_grabScreenPosNorm = ase_grabScreenPos / ase_grabScreenPos.w; float2 uv_NormalMap = i.texcoord.xy * _NormalMap_ST.xy + _NormalMap_ST.zw; float3 tex2DNode29 = UnpackNormal( tex2D( _NormalMap, uv_NormalMap ) ); float4 screenColor8 = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_GrabTexture,( (ase_grabScreenPosNorm).xy - (( tex2DNode29 * ( (0.0 + (_Distortionpower - 0.0) * (1.0 - 0.0) / (1000.0 - 0.0)) * (( _Enablesimpleopacity )?( 1.0 ):( i.color.a )) ) )).xy )); float4 appendResult55 = (float4(saturate( screenColor8 ))); float4 appendResult56 = (float4(1.0 , 1.0 , 1.0 , ( saturate( ( ( ( abs( tex2DNode29.r ) + abs( tex2DNode29.g ) ) * 30.0 ) - 0.3 ) ) * (( _Enablesimpleopacity )?( i.color.a ):( 1.0 )) ))); fixed4 col = ( appendResult55 * appendResult56 ); return col; } ENDCG } } } Fallback Off } /*ASEBEGIN Version=19108 Node;AmplifyShaderEditor.GrabScreenPosition;40;-447.4607,49.29217;Inherit;False;0;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.ComponentMaskNode;39;-191.7806,65.19897;Inherit;False;True;True;False;False;1;0;FLOAT4;0,0,0,0;False;1;FLOAT2;0 Node;AmplifyShaderEditor.ScreenColorNode;8;224.0004,85.8997;Float;False;Global;_ScreenGrab0;Screen Grab 0;-1;0;Create;True;0;0;0;False;0;False;Object;-1;False;False;False;False;2;0;FLOAT2;0,0;False;1;FLOAT;0;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.SimpleSubtractOpNode;47;44.31388,88.50478;Inherit;False;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;32;-437.1129,252.4172;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;1;FLOAT3;0 Node;AmplifyShaderEditor.AbsOpNode;48;-454.1903,361.4375;Inherit;True;1;0;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.AbsOpNode;49;-457.3305,581.2555;Inherit;True;1;0;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleAddOpNode;50;-246.9333,479.197;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SaturateNode;53;386.1591,485.8874;Inherit;True;1;0;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;51;-110.4998,477.3373;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;30;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleSubtractOpNode;52;132.3624,477.5814;Inherit;True;2;0;FLOAT;0;False;1;FLOAT;0.3;False;1;FLOAT;0 Node;AmplifyShaderEditor.SaturateNode;58;396.4395,86.98833;Inherit;False;1;0;COLOR;0,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.DynamicAppendNode;56;778.1014,417.414;Inherit;False;FLOAT4;4;0;FLOAT;1;False;1;FLOAT;1;False;2;FLOAT;1;False;3;FLOAT;0;False;1;FLOAT4;0 Node;AmplifyShaderEditor.DynamicAppendNode;55;784.2459,227.2425;Inherit;False;FLOAT4;4;0;FLOAT4;0,0,0,0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT4;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;57;1004.299,316.7444;Inherit;False;2;2;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0,0,0,0;False;1;FLOAT4;0 Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;44;1178.971,315.4701;Float;False;True;-1;2;;0;11;Hovl/Particles/Distortion;0b6a9f8b4f707c74ca64c0be8e590de0;True;SubShader 0 Pass 0;0;0;SubShader 0 Pass 0;2;False;True;2;5;False;;10;False;;0;1;False;;0;False;;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;;False;True;True;True;True;False;0;False;;False;False;False;False;False;False;False;False;False;True;2;False;;True;3;False;;False;True;4;Queue=Transparent=Queue=0;IgnoreProjector=True;RenderType=Transparent=RenderType;PreviewType=Plane;False;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;False;True;0;False;0;;0;0;Standard;0;0;1;True;False;;False;0 Node;AmplifyShaderEditor.SamplerNode;29;-855.48,221.599;Inherit;True;Property;_NormalMap;Normal Map;0;0;Create;True;0;0;0;False;0;False;-1;35b32e8a0b24a3b4cb0ae232c4e6b17e;35b32e8a0b24a3b4cb0ae232c4e6b17e;True;0;True;bump;Auto;True;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;0,0;False;1;FLOAT2;0,0;False;2;FLOAT;1;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.SimpleMultiplyOpNode;59;-642.6158,523.6614;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;60;596.2004,502.084;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0 Node;AmplifyShaderEditor.ToggleSwitchNode;63;329.2662,779.8604;Inherit;False;Property;_Enablesimpleopacity;Enable simple opacity;2;0;Create;True;0;0;0;False;0;False;0;True;2;0;FLOAT;1;False;1;FLOAT;1;False;1;FLOAT;0 Node;AmplifyShaderEditor.ComponentMaskNode;36;-252.5805,251.0987;Inherit;True;True;True;False;True;1;0;FLOAT3;0,0,0;False;1;FLOAT2;0 Node;AmplifyShaderEditor.ToggleSwitchNode;62;-889.8087,599.8569;Inherit;False;Property;_Enablesimpleopacity;Enable simple opacity;2;0;Create;True;0;0;0;False;0;False;0;True;2;0;FLOAT;0;False;1;FLOAT;1;False;1;FLOAT;0 Node;AmplifyShaderEditor.VertexColorNode;41;-1117.413,708.8323;Inherit;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.RangedFloatNode;31;-1106.824,419.0397;Float;False;Property;_Distortionpower;Distortion power;1;0;Create;True;0;0;0;False;0;False;1;0;0;0;0;1;FLOAT;0 Node;AmplifyShaderEditor.TFHCRemapNode;65;-858.0944,425.3069;Inherit;False;5;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;1000;False;3;FLOAT;0;False;4;FLOAT;1;False;1;FLOAT;0 WireConnection;39;0;40;0 WireConnection;8;0;47;0 WireConnection;47;0;39;0 WireConnection;47;1;36;0 WireConnection;32;0;29;0 WireConnection;32;1;59;0 WireConnection;48;0;29;1 WireConnection;49;0;29;2 WireConnection;50;0;48;0 WireConnection;50;1;49;0 WireConnection;53;0;52;0 WireConnection;51;0;50;0 WireConnection;52;0;51;0 WireConnection;58;0;8;0 WireConnection;56;3;60;0 WireConnection;55;0;58;0 WireConnection;57;0;55;0 WireConnection;57;1;56;0 WireConnection;44;0;57;0 WireConnection;59;0;65;0 WireConnection;59;1;62;0 WireConnection;60;0;53;0 WireConnection;60;1;63;0 WireConnection;63;1;41;4 WireConnection;36;0;32;0 WireConnection;62;0;41;4 WireConnection;65;0;31;0 ASEEND*/ //CHKSM=A7291A6A5D5FE9215CA015915B07738F634AD9FE