// Made with Amplify Shader Editor v1.9.5.1
// Available at the Unity Asset Store - http://u3d.as/y3X 
Shader "Nebula Animations/Portal/Portal Edge Glow"
{
	Properties
	{
		_Opacity("Opacity", Range( 0 , 1)) = 1
		[HDR]_Color("Color", Color) = (0,0.3111758,1,0)
		[HideInInspector] _texcoord3( "", 2D ) = "white" {}
		[HideInInspector] __dirty( "", Int ) = 1
	}

	SubShader
	{
		Tags{ "RenderType" = "Transparent"  "Queue" = "Transparent+0" "IgnoreProjector" = "True" }
		Cull Off
		CGPROGRAM
		#include "UnityPBSLighting.cginc"
		#include "UnityShaderVariables.cginc"
		#pragma target 3.0
		#pragma surface surf StandardCustomLighting alpha:premul keepalpha noshadow vertex:vertexDataFunc 
		struct Input
		{
			float2 uv3_texcoord3;
		};

		struct SurfaceOutputCustomLightingCustom
		{
			half3 Albedo;
			half3 Normal;
			half3 Emission;
			half Metallic;
			half Smoothness;
			half Occlusion;
			half Alpha;
			Input SurfInput;
			UnityGIInput GIData;
		};

		uniform float _Opacity;
		uniform float4 _Color;


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) / ( 0.00001 + (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) / ( 0.00001 + (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);
}


		void vertexDataFunc( inout appdata_full v, out Input o )
		{
			UNITY_INITIALIZE_OUTPUT( Input, o );
			Gradient gradient2 = NewGradient( 0, 5, 2, float4( 0, 0, 0, 0 ), float4( 1, 1, 1, 0.2303502 ), float4( 0, 0, 0, 0.4771496 ), float4( 1, 1, 1, 0.7714809 ), float4( 0, 0, 0, 1 ), 0, 0, 0, float2( 1, 0 ), float2( 1, 1 ), 0, 0, 0, 0, 0, 0 );
			float cos12 = cos( 0.75 * _Time.y );
			float sin12 = sin( 0.75 * _Time.y );
			float2 rotator12 = mul( v.texcoord2.xy - float2( 0.5,0.5 ) , float2x2( cos12 , -sin12 , sin12 , cos12 )) + float2( 0.5,0.5 );
			float2 temp_cast_0 = (0.5).xx;
			float2 temp_output_2_0_g4 = ( rotator12 - temp_cast_0 );
			float2 temp_cast_1 = (0.5).xx;
			float2 break8_g4 = temp_output_2_0_g4;
			float2 appendResult25_g4 = (float2(( length( temp_output_2_0_g4 ) * 2.0 * 0.0 ) , ( atan2( break8_g4.x , break8_g4.y ) * ( 1.0 / 6.28 ) * 2.0 )));
			float2 temp_cast_2 = (0.5).xx;
			float2 temp_output_2_0_g27 = ( v.texcoord2.xy - temp_cast_2 );
			float2 temp_cast_3 = (0.5).xx;
			float2 break8_g27 = temp_output_2_0_g27;
			float2 appendResult25_g27 = (float2(( length( temp_output_2_0_g27 ) * 2.0 * 1.1 ) , ( atan2( break8_g27.x , break8_g27.y ) * ( 1.0 / 6.28 ) * 1.0 )));
			float saferPower49 = abs( appendResult25_g27.x );
			float temp_output_51_0 = saturate( ( pow( saferPower49 , 32.1 ) * ( 1.0 - pow( appendResult25_g27.x , 50.0 ) ) ) );
			float3 ase_vertexNormal = v.normal.xyz;
			v.vertex.xyz += ( SampleGradient( gradient2, (appendResult25_g4*0.5 + 0.5).y ).r * temp_output_51_0 * ase_vertexNormal * 0.5 * _Opacity );
			v.vertex.w = 1;
		}

		inline half4 LightingStandardCustomLighting( inout SurfaceOutputCustomLightingCustom s, half3 viewDir, UnityGI gi )
		{
			UnityGIInput data = s.GIData;
			Input i = s.SurfInput;
			half4 c = 0;
			Gradient gradient2 = NewGradient( 0, 5, 2, float4( 0, 0, 0, 0 ), float4( 1, 1, 1, 0.2303502 ), float4( 0, 0, 0, 0.4771496 ), float4( 1, 1, 1, 0.7714809 ), float4( 0, 0, 0, 1 ), 0, 0, 0, float2( 1, 0 ), float2( 1, 1 ), 0, 0, 0, 0, 0, 0 );
			float cos12 = cos( 0.75 * _Time.y );
			float sin12 = sin( 0.75 * _Time.y );
			float2 rotator12 = mul( i.uv3_texcoord3 - float2( 0.5,0.5 ) , float2x2( cos12 , -sin12 , sin12 , cos12 )) + float2( 0.5,0.5 );
			float2 temp_cast_0 = (0.5).xx;
			float2 temp_output_2_0_g4 = ( rotator12 - temp_cast_0 );
			float2 temp_cast_1 = (0.5).xx;
			float2 break8_g4 = temp_output_2_0_g4;
			float2 appendResult25_g4 = (float2(( length( temp_output_2_0_g4 ) * 2.0 * 0.0 ) , ( atan2( break8_g4.x , break8_g4.y ) * ( 1.0 / 6.28 ) * 2.0 )));
			float2 temp_cast_2 = (0.5).xx;
			float2 temp_output_2_0_g27 = ( i.uv3_texcoord3 - temp_cast_2 );
			float2 temp_cast_3 = (0.5).xx;
			float2 break8_g27 = temp_output_2_0_g27;
			float2 appendResult25_g27 = (float2(( length( temp_output_2_0_g27 ) * 2.0 * 1.1 ) , ( atan2( break8_g27.x , break8_g27.y ) * ( 1.0 / 6.28 ) * 1.0 )));
			float saferPower49 = abs( appendResult25_g27.x );
			float temp_output_51_0 = saturate( ( pow( saferPower49 , 32.1 ) * ( 1.0 - pow( appendResult25_g27.x , 50.0 ) ) ) );
			c.rgb = _Color.rgb;
			c.a = saturate( ( SampleGradient( gradient2, (appendResult25_g4*0.5 + 0.5).y ).r * temp_output_51_0 * _Opacity ) );
			c.rgb *= c.a;
			return c;
		}

		inline void LightingStandardCustomLighting_GI( inout SurfaceOutputCustomLightingCustom s, UnityGIInput data, inout UnityGI gi )
		{
			s.GIData = data;
		}

		void surf( Input i , inout SurfaceOutputCustomLightingCustom o )
		{
			o.SurfInput = i;
		}

		ENDCG
	}
	CustomEditor "ASEMaterialInspector"
}
/*ASEBEGIN
Version=19501
Node;AmplifyShaderEditor.TextureCoordinatesNode;52;-1664,688;Inherit;False;2;-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.TextureCoordinatesNode;8;-1616,352;Inherit;False;2;-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.FunctionNode;45;-1456,688;Inherit;True;PolarCoordinates;-1;;27;d4cffec22897b1749b81b0aafe578606;0;3;29;FLOAT2;0,0;False;27;FLOAT;1;False;24;FLOAT;1.1;False;1;FLOAT2;0
Node;AmplifyShaderEditor.BreakToComponentsNode;46;-1184,688;Inherit;True;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15
Node;AmplifyShaderEditor.RotatorNode;12;-1408,352;Inherit;True;3;0;FLOAT2;0,0;False;1;FLOAT2;0.5,0.5;False;2;FLOAT;0.75;False;1;FLOAT2;0
Node;AmplifyShaderEditor.FunctionNode;11;-1152,352;Inherit;False;PolarCoordinates;-1;;4;d4cffec22897b1749b81b0aafe578606;0;3;29;FLOAT2;0,0;False;27;FLOAT;2;False;24;FLOAT;0;False;1;FLOAT2;0
Node;AmplifyShaderEditor.PowerNode;50;-944,912;Inherit;True;False;2;0;FLOAT;0;False;1;FLOAT;50;False;1;FLOAT;0
Node;AmplifyShaderEditor.ScaleAndOffsetNode;13;-880,352;Inherit;False;3;0;FLOAT2;0,0;False;1;FLOAT;0.5;False;2;FLOAT;0.5;False;1;FLOAT2;0
Node;AmplifyShaderEditor.OneMinusNode;48;-688,752;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.PowerNode;49;-944,688;Inherit;True;True;2;0;FLOAT;0;False;1;FLOAT;32.1;False;1;FLOAT;0
Node;AmplifyShaderEditor.BreakToComponentsNode;4;-592,352;Inherit;False;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15
Node;AmplifyShaderEditor.GradientNode;2;-736,224;Inherit;False;0;5;2;0,0,0,0;1,1,1,0.2303502;0,0,0,0.4771496;1,1,1,0.7714809;0,0,0,1;1,0;1,1;0;1;OBJECT;0
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;47;-528,688;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.GradientSampleNode;5;-418.5,295.5;Inherit;True;2;0;OBJECT;;False;1;FLOAT;0;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
Node;AmplifyShaderEditor.SaturateNode;51;-320,688;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.RangedFloatNode;54;-352,512;Inherit;False;Property;_Opacity;Opacity;0;0;Create;True;0;0;0;False;0;False;1;0;0;1;0;1;FLOAT;0
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;42;16,304;Inherit;False;3;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.NormalVertexDataNode;14;-112,736;Inherit;False;0;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
Node;AmplifyShaderEditor.RangedFloatNode;16;-80,880;Inherit;False;Constant;_Float4;Float 4;0;0;Create;True;0;0;0;False;0;False;0.5;0;0;0;0;1;FLOAT;0
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;15;172.2888,529.0516;Inherit;False;5;5;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT3;0,0,0;False;3;FLOAT;0;False;4;FLOAT;0;False;1;FLOAT3;0
Node;AmplifyShaderEditor.SaturateNode;43;160,304;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.ColorNode;17;-80,48;Inherit;False;Property;_Color;Color;1;1;[HDR];Create;True;0;0;0;False;0;False;0,0.3111758,1,0;0,0.3111758,1,0;True;True;0;6;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT3;5
Node;AmplifyShaderEditor.StandardSurfaceOutputNode;0;448,64;Float;False;True;-1;2;ASEMaterialInspector;0;0;CustomLighting;Nebula Animations/Portal/Portal Edge Glow;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;False;False;False;False;False;False;Off;0;False;;0;False;;False;0;False;;0;False;;False;0;Premultiply;0.5;True;False;0;False;Transparent;;Transparent;All;12;all;True;True;True;True;0;False;;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;2;15;10;25;False;0.5;False;3;1;False;;10;False;;0;0;False;;0;False;;0;False;;0;False;;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;0;False;;0;0;0;False;0.1;False;;0;False;;False;16;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT3;0,0,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;16;FLOAT4;0,0,0,0;False;14;FLOAT4;0,0,0,0;False;15;FLOAT3;0,0,0;False;0
WireConnection;45;29;52;0
WireConnection;46;0;45;0
WireConnection;12;0;8;0
WireConnection;11;29;12;0
WireConnection;50;0;46;0
WireConnection;13;0;11;0
WireConnection;48;0;50;0
WireConnection;49;0;46;0
WireConnection;4;0;13;0
WireConnection;47;0;49;0
WireConnection;47;1;48;0
WireConnection;5;0;2;0
WireConnection;5;1;4;1
WireConnection;51;0;47;0
WireConnection;42;0;5;1
WireConnection;42;1;51;0
WireConnection;42;2;54;0
WireConnection;15;0;5;1
WireConnection;15;1;51;0
WireConnection;15;2;14;0
WireConnection;15;3;16;0
WireConnection;15;4;54;0
WireConnection;43;0;42;0
WireConnection;0;9;43;0
WireConnection;0;13;17;5
WireConnection;0;11;15;0
ASEEND*/
//CHKSM=36265B4B4668047E674C3ACB765DBCCF4E8FFB7F