projectEli/Assets/NeoFPS/Samples/Shared/Effects/Shaders/NeoFPS_FireballSheetCh0_Additive.shader
2022-11-06 20:28:33 -05:00

207 lines
7.3 KiB
GLSL

// Made with Amplify Shader Editor
// Available at the Unity Asset Store - http://u3d.as/y3X
Shader "NeoFPS/Standard/FireballSheet Additive (Channel 0)"
{
Properties
{
_TintColor ("Tint Color", Color) = (0.5,0.5,0.5,0.5)
_MainTex ("Particle Texture", 2D) = "white" {}
_InvFade ("Soft Particles Factor", Range(0.01,3.0)) = 1.0
}
Category
{
SubShader
{
LOD 0
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
Blend One One
ColorMask RGB
Cull Off
Lighting Off
ZWrite Off
ZTest LEqual
Pass {
CGPROGRAM
#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 target 2.0
#pragma multi_compile_instancing
#pragma multi_compile_particles
#pragma multi_compile_fog
#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
};
#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 sampler2D _MainTex;
uniform fixed4 _TintColor;
uniform float4 _MainTex_ST;
uniform float _InvFade;
struct Gradient
{
int type;
int colorsLength;
int alphasLength;
float4 colors[8];
float2 alphas[8];
};
Gradient NewGradient(int type, int colorsLength, int alphasLength,
float4 colors0, float4 colors1, float4 colors2, float4 colors3, float4 colors4, float4 colors5, float4 colors6, float4 colors7,
float2 alphas0, float2 alphas1, float2 alphas2, float2 alphas3, float2 alphas4, float2 alphas5, float2 alphas6, float2 alphas7)
{
Gradient g;
g.type = type;
g.colorsLength = colorsLength;
g.alphasLength = alphasLength;
g.colors[ 0 ] = colors0;
g.colors[ 1 ] = colors1;
g.colors[ 2 ] = colors2;
g.colors[ 3 ] = colors3;
g.colors[ 4 ] = colors4;
g.colors[ 5 ] = colors5;
g.colors[ 6 ] = colors6;
g.colors[ 7 ] = colors7;
g.alphas[ 0 ] = alphas0;
g.alphas[ 1 ] = alphas1;
g.alphas[ 2 ] = alphas2;
g.alphas[ 3 ] = alphas3;
g.alphas[ 4 ] = alphas4;
g.alphas[ 5 ] = alphas5;
g.alphas[ 6 ] = alphas6;
g.alphas[ 7 ] = alphas7;
return g;
}
float4 SampleGradient( Gradient gradient, float time )
{
float3 color = gradient.colors[0].rgb;
UNITY_UNROLL
for (int c = 1; c < 8; c++)
{
float colorPos = saturate((time - gradient.colors[c-1].w) / (gradient.colors[c].w - gradient.colors[c-1].w)) * step(c, (float)gradient.colorsLength-1);
color = lerp(color, gradient.colors[c].rgb, lerp(colorPos, step(0.01, colorPos), gradient.type));
}
#ifndef UNITY_COLORSPACE_GAMMA
color = half3(GammaToLinearSpaceExact(color.r), GammaToLinearSpaceExact(color.g), GammaToLinearSpaceExact(color.b));
#endif
float alpha = gradient.alphas[0].x;
UNITY_UNROLL
for (int a = 1; a < 8; a++)
{
float alphaPos = saturate((time - gradient.alphas[a-1].y) / (gradient.alphas[a].y - gradient.alphas[a-1].y)) * step(a, (float)gradient.alphasLength-1);
alpha = lerp(alpha, gradient.alphas[a].x, lerp(alphaPos, step(0.01, alphaPos), gradient.type));
}
return float4(color, alpha);
}
v2f vert ( appdata_t v )
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
UNITY_TRANSFER_INSTANCE_ID(v, o);
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
Gradient gradient9 = NewGradient( 0, 4, 2, float4( 0, 0, 0, 0 ), float4( 1, 0.7606527, 0.2877358, 0.5088273 ), float4( 1, 0.9679601, 0.2971698, 0.9000076 ), float4( 1, 1, 1, 1 ), 0, 0, 0, 0, float2( 1, 0 ), float2( 1, 1 ), 0, 0, 0, 0, 0, 0 );
float2 uv0_MainTex = i.texcoord.xy * _MainTex_ST.xy + _MainTex_ST.zw;
fixed4 col = SampleGradient( gradient9, tex2D( _MainTex, uv0_MainTex ).r );
UNITY_APPLY_FOG(i.fogCoord, col);
return col;
}
ENDCG
}
}
}
//CustomEditor "ASEMaterialInspector"
}
/*ASEBEGIN
Version=18200
0;3;1920;1015;1861.273;629.5657;1;True;True
Node;AmplifyShaderEditor.TemplateShaderPropertyNode;3;-1854.595,-193.1606;Inherit;False;0;0;_MainTex;Shader;0;5;SAMPLER2D;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
Node;AmplifyShaderEditor.TextureCoordinatesNode;6;-1537.001,-121.8279;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.SamplerNode;4;-1231.407,-201.2726;Inherit;True;Property;_TextureSample0;Texture Sample 0;1;0;Create;True;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;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;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
Node;AmplifyShaderEditor.GradientNode;9;-1247.273,-421.5657;Inherit;False;0;4;2;0,0,0,0;1,0.7606527,0.2877358,0.5088273;1,0.9679601,0.2971698,0.9000076;1,1,1,1;1,0;1,1;0;1;OBJECT;0
Node;AmplifyShaderEditor.GradientSampleNode;8;-908.2734,-423.5657;Inherit;True;2;0;OBJECT;;False;1;FLOAT;0;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;0;-546.3451,-168.2097;Float;False;True;-1;2;ASEMaterialInspector;0;7;NeoFPS/Standard/FireballSheet Additive (Channel 0);0b6a9f8b4f707c74ca64c0be8e590de0;True;SubShader 0 Pass 0;0;0;SubShader 0 Pass 0;2;True;4;1;False;-1;1;False;-1;0;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;True;2;False;-1;True;True;True;True;False;0;False;-1;False;False;False;False;True;2;False;-1;True;3;False;-1;False;True;4;Queue=Transparent=Queue=0;IgnoreProjector=True;RenderType=Transparent=RenderType;PreviewType=Plane;False;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;0;0;;0;0;Standard;0;0;1;True;False;;0
WireConnection;6;2;3;0
WireConnection;4;0;3;0
WireConnection;4;1;6;0
WireConnection;8;0;9;0
WireConnection;8;1;4;1
WireConnection;0;0;8;0
ASEEND*/
//CHKSM=E5B0C8764D4D2F9E12421EF748281EB52AA4CB33