ASE Shader 实现拖尾效果
2022-09-06 本文已影响0人
Boyce_Lig
GIF2.gif
image.png
image.png
image.png
image.png
image.png
image.png
image.png
附上源码:
// Made with Amplify Shader Editor
// Available at the Unity Asset Store - http://u3d.as/y3X
Shader "Custom/Trailing"
{
Properties
{
_MainTex("MainTex", 2D) = "white" {}
_FlowStrength("Flow Strength", Float) = 0.3
_StartColor("Start Color", Color) = (0.1215686,0.4431373,1,1)
_EndColor("End Color", Color) = (1,0.1372549,0.7725491,1)
_TimeScale("Time Scale", Float) = 1.2
_Emission("Emission", Float) = 4
[Toggle(_USEDARKEDGE_ON)] _UseDarkedge("Use Darkedge", Float) = 1
[HideInInspector] _texcoord( "", 2D ) = "white" {}
[HideInInspector] __dirty( "", Int ) = 1
}
SubShader
{
Tags{ "RenderType" = "Transparent" "Queue" = "Transparent+0" "IgnoreProjector" = "True" "IsEmissive" = "true" }
Cull Back
CGPROGRAM
#include "UnityShaderVariables.cginc"
#pragma target 3.0
#pragma shader_feature_local _USEDARKEDGE_ON
#pragma surface surf Unlit alpha:fade keepalpha noshadow noambient novertexlights nolightmap nodynlightmap nodirlightmap nofog nometa noforwardadd
struct Input
{
float2 uv_texcoord;
float4 vertexColor : COLOR;
};
uniform float4 _StartColor;
uniform float4 _EndColor;
uniform float _Emission;
uniform sampler2D _MainTex;
uniform float _TimeScale;
uniform float _FlowStrength;
inline half4 LightingUnlit( SurfaceOutput s, half3 lightDir, half atten )
{
return half4 ( 0, 0, 0, s.Alpha );
}
void surf( Input i , inout SurfaceOutput o )
{
float U18 = i.uv_texcoord.x;
float3 lerpResult47 = lerp( (_StartColor).rgb , (_EndColor).rgb , U18);
float clampResult23 = clamp( ( i.uv_texcoord.y * ( 1.0 - i.uv_texcoord.y ) * ( 1.0 - U18 ) * 6.0 ) , 0.0 , 1.0 );
float Mask25 = clampResult23;
float mulTime4 = _Time.y * _TimeScale;
float Time5 = mulTime4;
float2 UV2 = i.uv_texcoord;
float2 panner6 = ( Time5 * float2( -1,0 ) + UV2);
float2 panner60 = ( Time5 * float2( -0.8,0 ) + ( UV2 + ( ( ( (tex2D( _MainTex, panner6 )).rg + -0.5 ) * 2.0 ) * _FlowStrength * U18 ) ));
float2 panner16 = ( Time5 * float2( -1,-0.2 ) + UV2);
float clampResult35 = clamp( ( ( ( 1.0 - U18 ) + -0.55 ) * 2.0 ) , 0.25 , 0.75 );
float clampResult38 = clamp( ( ( tex2D( _MainTex, panner16 ).g + clampResult35 ) - ( U18 * 0.9 ) ) , 0.0 , 1.0 );
float temp_output_57_0 = ( i.vertexColor.a * Mask25 * tex2D( _MainTex, panner60 ).b * clampResult38 );
#ifdef _USEDARKEDGE_ON
float staticSwitch44 = temp_output_57_0;
#else
float staticSwitch44 = 1.0;
#endif
o.Emission = ( ( lerpResult47 * (i.vertexColor).rgb * _Emission ) * staticSwitch44 );
o.Alpha = temp_output_57_0;
}
ENDCG
}
CustomEditor "ASEMaterialInspector"
}
/*ASEBEGIN
Version=18935
640;336;1920;737;-1102.614;438.8271;1;True;True
Node;AmplifyShaderEditor.RangedFloatNode;3;-1044,164.5;Inherit;False;Property;_TimeScale;Time Scale;4;0;Create;True;0;0;0;False;0;False;1.2;1;0;0;0;1;FLOAT;0
Node;AmplifyShaderEditor.TextureCoordinatesNode;1;-975,-29.5;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
Node;AmplifyShaderEditor.SimpleTimeNode;4;-848,168.5;Inherit;False;1;0;FLOAT;1;False;1;FLOAT;0
Node;AmplifyShaderEditor.RegisterLocalVarNode;5;-610,151.5;Inherit;False;Time;-1;True;1;0;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.RegisterLocalVarNode;2;-707,-27.5;Inherit;False;UV;-1;True;1;0;FLOAT2;0,0;False;1;FLOAT2;0
Node;AmplifyShaderEditor.PannerNode;6;-340,-2.5;Inherit;False;3;0;FLOAT2;0,0;False;2;FLOAT2;-1,0;False;1;FLOAT;1;False;1;FLOAT2;0
Node;AmplifyShaderEditor.RegisterLocalVarNode;18;-617.9092,470.6239;Inherit;False;U;-1;True;1;0;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.TexturePropertyNode;9;-352,-231.5;Inherit;True;Property;_MainTex;MainTex;0;0;Create;True;0;0;0;False;0;False;None;None;False;white;Auto;Texture2D;-1;0;2;SAMPLER2D;0;SAMPLERSTATE;1
Node;AmplifyShaderEditor.SamplerNode;8;-61,-27.5;Inherit;True;Property;_TextureSample0;Texture Sample 0;0;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
Node;AmplifyShaderEditor.GetLocalVarNode;31;-366.6106,-704.3259;Inherit;False;18;U;1;0;OBJECT;;False;1;FLOAT;0
Node;AmplifyShaderEditor.GetLocalVarNode;17;-362.1842,-443.198;Inherit;False;5;Time;1;0;OBJECT;;False;1;FLOAT;0
Node;AmplifyShaderEditor.GetLocalVarNode;15;-361.7106,-551.6705;Inherit;False;2;UV;1;0;OBJECT;;False;1;FLOAT2;0
Node;AmplifyShaderEditor.OneMinusNode;33;-116.6106,-398.3259;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.ComponentMaskNode;10;320,-27.5;Inherit;False;True;True;False;False;1;0;COLOR;0,0,0,0;False;1;FLOAT2;0
Node;AmplifyShaderEditor.FunctionNode;12;653,-20.5;Inherit;False;ConstantBiasScale;-1;;2;63208df05c83e8e49a48ffbdce2e43a0;0;3;3;FLOAT2;0,0;False;1;FLOAT;-0.5;False;2;FLOAT;2;False;1;FLOAT2;0
Node;AmplifyShaderEditor.RangedFloatNode;27;668.3524,137.7958;Inherit;False;Property;_FlowStrength;Flow Strength;1;0;Create;True;0;0;0;False;0;False;0.3;0.3;0;0;0;1;FLOAT;0
Node;AmplifyShaderEditor.GetLocalVarNode;28;677.3524,223.7958;Inherit;False;18;U;1;0;OBJECT;;False;1;FLOAT;0
Node;AmplifyShaderEditor.PannerNode;16;-137.0463,-543.597;Inherit;False;3;0;FLOAT2;0,0;False;2;FLOAT2;-1,-0.2;False;1;FLOAT;1;False;1;FLOAT2;0
Node;AmplifyShaderEditor.OneMinusNode;20;-409.4092,292.524;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.RangedFloatNode;22;-364.9092,558.6239;Inherit;False;Constant;_Float0;Float 0;1;0;Create;True;0;0;0;False;0;False;6;0;0;0;0;1;FLOAT;0
Node;AmplifyShaderEditor.OneMinusNode;19;-403.5092,468.7238;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.FunctionNode;34;129.3894,-367.3259;Inherit;False;ConstantBiasScale;-1;;3;63208df05c83e8e49a48ffbdce2e43a0;0;3;3;FLOAT;0;False;1;FLOAT;-0.55;False;2;FLOAT;2;False;1;FLOAT;0
Node;AmplifyShaderEditor.SamplerNode;13;135.2894,-574.6705;Inherit;True;Property;_TextureSample1;Texture Sample 1;0;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
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;21;-192.9092,245.6239;Inherit;False;4;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;26;992.3524,-3.204163;Inherit;False;3;3;0;FLOAT2;0,0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT2;0
Node;AmplifyShaderEditor.ClampOpNode;35;386.3894,-366.3259;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0.25;False;2;FLOAT;0.75;False;1;FLOAT;0
Node;AmplifyShaderEditor.GetLocalVarNode;64;991.3444,-109.2514;Inherit;False;2;UV;1;0;OBJECT;;False;1;FLOAT2;0
Node;AmplifyShaderEditor.SimpleAddOpNode;62;1222.022,-56.09367;Inherit;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0
Node;AmplifyShaderEditor.ClampOpNode;23;-9.90918,251.6239;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;1;False;1;FLOAT;0
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;32;404.3894,-682.3259;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0.9;False;1;FLOAT;0
Node;AmplifyShaderEditor.GetLocalVarNode;61;1186.074,105.6926;Inherit;False;5;Time;1;0;OBJECT;;False;1;FLOAT;0
Node;AmplifyShaderEditor.SimpleAddOpNode;36;572.3894,-494.3259;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.SimpleSubtractOpNode;37;711.3894,-566.3259;Inherit;True;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.PannerNode;60;1454.838,-47.0265;Inherit;False;3;0;FLOAT2;0,0;False;2;FLOAT2;-0.8,0;False;1;FLOAT;1;False;1;FLOAT2;0
Node;AmplifyShaderEditor.RegisterLocalVarNode;25;221.1714,254.2223;Inherit;True;Mask;-1;True;1;0;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.ColorNode;49;1591.404,-715.7863;Inherit;False;Property;_EndColor;End Color;3;0;Create;True;0;0;0;False;0;False;1,0.1372549,0.7725491,1;0,0,0,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
Node;AmplifyShaderEditor.ColorNode;48;1587.404,-901.7863;Inherit;False;Property;_StartColor;Start Color;2;0;Create;True;0;0;0;False;0;False;0.1215686,0.4431373,1,1;0,0,0,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
Node;AmplifyShaderEditor.ClampOpNode;38;931.117,-561.5178;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;1;False;1;FLOAT;0
Node;AmplifyShaderEditor.ComponentMaskNode;51;1841.931,-707.4863;Inherit;False;True;True;True;False;1;0;COLOR;0,0,0,0;False;1;FLOAT3;0
Node;AmplifyShaderEditor.SamplerNode;30;1730.425,-154.6975;Inherit;True;Property;_TextureSample2;Texture Sample 2;0;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
Node;AmplifyShaderEditor.GetLocalVarNode;58;2085.802,-161.5408;Inherit;False;25;Mask;1;0;OBJECT;;False;1;FLOAT;0
Node;AmplifyShaderEditor.VertexColorNode;54;1866.391,-449.7178;Inherit;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
Node;AmplifyShaderEditor.GetLocalVarNode;53;1854.391,-584.7179;Inherit;False;18;U;1;0;OBJECT;;False;1;FLOAT;0
Node;AmplifyShaderEditor.ComponentMaskNode;50;1842.931,-843.4863;Inherit;False;True;True;True;False;1;0;COLOR;0,0,0,0;False;1;FLOAT3;0
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;57;2345.659,-128.1744;Inherit;True;4;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.ComponentMaskNode;55;2130.392,-571.7179;Inherit;False;True;True;True;False;1;0;COLOR;0,0,0,0;False;1;FLOAT3;0
Node;AmplifyShaderEditor.RangedFloatNode;56;2184.954,-471.3403;Inherit;False;Property;_Emission;Emission;5;0;Create;True;0;0;0;False;0;False;4;4;0;0;0;1;FLOAT;0
Node;AmplifyShaderEditor.LerpOp;47;2092.168,-787.3137;Inherit;True;3;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT;0;False;1;FLOAT3;0
Node;AmplifyShaderEditor.RangedFloatNode;46;2541.13,-381.3563;Inherit;False;Constant;_Float1;Float 1;2;0;Create;True;0;0;0;False;0;False;1;0;0;0;0;1;FLOAT;0
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;43;2381.404,-627.7864;Inherit;False;3;3;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT;0;False;1;FLOAT3;0
Node;AmplifyShaderEditor.StaticSwitch;44;2721.695,-364.8661;Inherit;False;Property;_UseDarkedge;Use Darkedge;6;0;Create;True;0;0;0;False;0;False;0;1;1;True;;Toggle;2;Key0;Key1;Create;True;True;All;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;39;3069.008,-485.5995;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;1;FLOAT3;0
Node;AmplifyShaderEditor.StandardSurfaceOutputNode;66;3281.844,-509.7446;Float;False;True;-1;2;ASEMaterialInspector;0;0;Unlit;Custom/Trailing;False;False;False;False;True;True;True;True;True;True;True;True;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;False;0;False;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;False;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;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;15;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;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;3;0
WireConnection;5;0;4;0
WireConnection;2;0;1;0
WireConnection;6;0;2;0
WireConnection;6;1;5;0
WireConnection;18;0;1;1
WireConnection;8;0;9;0
WireConnection;8;1;6;0
WireConnection;33;0;31;0
WireConnection;10;0;8;0
WireConnection;12;3;10;0
WireConnection;16;0;15;0
WireConnection;16;1;17;0
WireConnection;20;0;1;2
WireConnection;19;0;18;0
WireConnection;34;3;33;0
WireConnection;13;0;9;0
WireConnection;13;1;16;0
WireConnection;21;0;1;2
WireConnection;21;1;20;0
WireConnection;21;2;19;0
WireConnection;21;3;22;0
WireConnection;26;0;12;0
WireConnection;26;1;27;0
WireConnection;26;2;28;0
WireConnection;35;0;34;0
WireConnection;62;0;64;0
WireConnection;62;1;26;0
WireConnection;23;0;21;0
WireConnection;32;0;31;0
WireConnection;36;0;13;2
WireConnection;36;1;35;0
WireConnection;37;0;36;0
WireConnection;37;1;32;0
WireConnection;60;0;62;0
WireConnection;60;1;61;0
WireConnection;25;0;23;0
WireConnection;38;0;37;0
WireConnection;51;0;49;0
WireConnection;30;0;9;0
WireConnection;30;1;60;0
WireConnection;50;0;48;0
WireConnection;57;0;54;4
WireConnection;57;1;58;0
WireConnection;57;2;30;3
WireConnection;57;3;38;0
WireConnection;55;0;54;0
WireConnection;47;0;50;0
WireConnection;47;1;51;0
WireConnection;47;2;53;0
WireConnection;43;0;47;0
WireConnection;43;1;55;0
WireConnection;43;2;56;0
WireConnection;44;1;46;0
WireConnection;44;0;57;0
WireConnection;39;0;43;0
WireConnection;39;1;44;0
WireConnection;66;2;39;0
WireConnection;66;9;57;0
ASEEND*/
//CHKSM=465C85C8B748928128661624459ECF6740B49C17