
commit 26aff356971bdc2c2a6a3bd444eeb50c4bf7ec14 Author: SAIPO <grasste0403@hotmail.com> Date: Sun Dec 19 02:20:44 2021 +0800 导入近期制作的一些Shader 1.合并分支 2.完成了人物描边的流动shader制作,并且可以对Bloom屏幕后处理产生反应。 3.完成了基督教boss关卡,彩色窗户辉光的shader制作,可以对Bloom产生反应。 4.完成了伊斯兰教弹反的炸弹拖尾粒子shader的制作。 5.完成了火焰粒子shader的制作(可以用在基督教的以撒鬼魂上)。 6.完成了灰尘粒子像素化的shader制作。 7.完成了边缘扭曲的shader制作,可以用在一些树木上,让画面产生动感。 明天制作敲钟的声波Shader
229 lines
9.7 KiB
GLSL
229 lines
9.7 KiB
GLSL
// Made with Amplify Shader Editor
|
|
// Available at the Unity Asset Store - http://u3d.as/y3X
|
|
Shader "Unlit/GlassShader"
|
|
{
|
|
Properties
|
|
{
|
|
_Color ("Tint", Color) = (1,1,1,1)
|
|
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
|
|
[PerRendererData] _AlphaTex ("External Alpha", 2D) = "white" {}
|
|
_TextureSample1("Texture Sample 1", 2D) = "white" {}
|
|
_Float0("Float 0", Float) = 8.38
|
|
[HDR]_Color0("Color 0", Color) = (1,0.2216981,0.2216981,0)
|
|
_In("In", Float) = 1.59
|
|
_TimeScale("TimeScale", Float) = 0.67
|
|
_MainTex("Texture 0", 2D) = "white" {}
|
|
[HideInInspector] _texcoord( "", 2D ) = "white" {}
|
|
|
|
}
|
|
|
|
SubShader
|
|
{
|
|
LOD 0
|
|
|
|
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" "CanUseSpriteAtlas"="True" }
|
|
|
|
Cull Off
|
|
Lighting Off
|
|
ZWrite Off
|
|
Blend One OneMinusSrcAlpha
|
|
|
|
|
|
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 3.0
|
|
#pragma multi_compile _ PIXELSNAP_ON
|
|
#pragma multi_compile _ ETC1_EXTERNAL_ALPHA
|
|
#include "UnityCG.cginc"
|
|
#include "UnityShaderVariables.cginc"
|
|
|
|
|
|
struct appdata_t
|
|
{
|
|
float4 vertex : POSITION;
|
|
float4 color : COLOR;
|
|
float2 texcoord : TEXCOORD0;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
|
|
};
|
|
|
|
struct v2f
|
|
{
|
|
float4 vertex : SV_POSITION;
|
|
fixed4 color : COLOR;
|
|
float2 texcoord : TEXCOORD0;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
UNITY_VERTEX_OUTPUT_STEREO
|
|
|
|
};
|
|
|
|
uniform fixed4 _Color;
|
|
uniform float _EnableExternalAlpha;
|
|
uniform sampler2D _MainTex;
|
|
uniform sampler2D _AlphaTex;
|
|
uniform float4 _MainTex_ST;
|
|
uniform sampler2D _TextureSample1;
|
|
uniform float4 _TextureSample1_ST;
|
|
uniform float _Float0;
|
|
uniform float4 _Color0;
|
|
uniform float _In;
|
|
uniform float _TimeScale;
|
|
float2 voronoihash5( 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 voronoi5( 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 = -3; j <= 3; j++ )
|
|
{
|
|
for ( int i = -3; i <= 3; i++ )
|
|
{
|
|
float2 g = float2( i, j );
|
|
float2 o = voronoihash5( 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<F1 ) {
|
|
F2 = F1;
|
|
F1 = d; mg = g; mr = r; id = o;
|
|
} else if( d<F2 ) {
|
|
F2 = d;
|
|
|
|
}
|
|
}
|
|
}
|
|
return F1;
|
|
}
|
|
|
|
|
|
|
|
v2f vert( appdata_t IN )
|
|
{
|
|
v2f OUT;
|
|
UNITY_SETUP_INSTANCE_ID(IN);
|
|
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
|
|
UNITY_TRANSFER_INSTANCE_ID(IN, OUT);
|
|
|
|
|
|
IN.vertex.xyz += float3(0,0,0) ;
|
|
OUT.vertex = UnityObjectToClipPos(IN.vertex);
|
|
OUT.texcoord = IN.texcoord;
|
|
OUT.color = IN.color * _Color;
|
|
#ifdef PIXELSNAP_ON
|
|
OUT.vertex = UnityPixelSnap (OUT.vertex);
|
|
#endif
|
|
|
|
return OUT;
|
|
}
|
|
|
|
fixed4 SampleSpriteTexture (float2 uv)
|
|
{
|
|
fixed4 color = tex2D (_MainTex, uv);
|
|
|
|
#if ETC1_EXTERNAL_ALPHA
|
|
// get the color from an external texture (usecase: Alpha support for ETC1 on android)
|
|
fixed4 alpha = tex2D (_AlphaTex, uv);
|
|
color.a = lerp (color.a, alpha.r, _EnableExternalAlpha);
|
|
#endif //ETC1_EXTERNAL_ALPHA
|
|
|
|
return color;
|
|
}
|
|
|
|
fixed4 frag(v2f IN ) : SV_Target
|
|
{
|
|
UNITY_SETUP_INSTANCE_ID( IN );
|
|
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN );
|
|
|
|
float2 uv_MainTex = IN.texcoord.xy * _MainTex_ST.xy + _MainTex_ST.zw;
|
|
float4 tex2DNode38 = tex2D( _MainTex, uv_MainTex );
|
|
float2 uv_TextureSample1 = IN.texcoord.xy * _TextureSample1_ST.xy + _TextureSample1_ST.zw;
|
|
float mulTime7 = _Time.y * _Float0;
|
|
float time5 = mulTime7;
|
|
float2 voronoiSmoothId0 = 0;
|
|
float2 coords5 = IN.texcoord.xy * 18.7;
|
|
float2 id5 = 0;
|
|
float2 uv5 = 0;
|
|
float fade5 = 0.5;
|
|
float voroi5 = 0;
|
|
float rest5 = 0;
|
|
for( int it5 = 0; it5 <6; it5++ ){
|
|
voroi5 += fade5 * voronoi5( coords5, time5, id5, uv5, 0,voronoiSmoothId0 );
|
|
rest5 += fade5;
|
|
coords5 *= 2;
|
|
fade5 *= 0.5;
|
|
}//Voronoi5
|
|
voroi5 /= rest5;
|
|
float mulTime34 = _Time.y * _TimeScale;
|
|
|
|
fixed4 c = ( tex2DNode38 + ( ( ( tex2DNode38.a - tex2D( _TextureSample1, uv_TextureSample1 ).a ) * ( voroi5 * _Color0 ) ) * ( _In * ( ( pow( sin( mulTime34 ) , 2.0 ) + 0.2 ) * 0.8 ) ) ) );
|
|
c.rgb *= c.a;
|
|
return c;
|
|
}
|
|
ENDCG
|
|
}
|
|
}
|
|
CustomEditor "ASEMaterialInspector"
|
|
|
|
|
|
}
|
|
/*ASEBEGIN
|
|
Version=18912
|
|
295;67;1535;874;2754.995;404.2208;1.090325;True;True
|
|
Node;AmplifyShaderEditor.RangedFloatNode;36;-1638.823,725.3821;Inherit;False;Property;_TimeScale;TimeScale;4;0;Create;True;0;0;0;False;0;False;0.67;0;0;0;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleTimeNode;34;-1450.857,703.9905;Inherit;False;1;0;FLOAT;0.26;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SinOpNode;35;-1234.856,670.9905;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;8;-2162.806,392.5762;Inherit;False;Property;_Float0;Float 0;1;0;Create;True;0;0;0;False;0;False;8.38;8.38;0;0;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleTimeNode;7;-1980.705,395.0766;Inherit;False;1;0;FLOAT;1;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.TexturePropertyNode;37;-2346.125,-166.9503;Inherit;True;Property;_MainTex;Texture 0;5;0;Create;False;0;0;0;False;0;False;None;None;False;white;Auto;Texture2D;-1;0;2;SAMPLER2D;0;SAMPLERSTATE;1
|
|
Node;AmplifyShaderEditor.PowerNode;31;-1027.012,587.3082;Inherit;True;False;2;0;FLOAT;0;False;1;FLOAT;2;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.ColorNode;15;-1574.272,453.6033;Inherit;False;Property;_Color0;Color 0;2;1;[HDR];Create;True;0;0;0;False;0;False;1,0.2216981,0.2216981,0;1,0.2216981,0.2216981,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.VoronoiNode;5;-1761.606,354.7764;Inherit;True;2;0;1;0;6;False;1;False;False;False;4;0;FLOAT2;0,0;False;1;FLOAT;58.19;False;2;FLOAT;18.7;False;3;FLOAT;0;False;3;FLOAT;0;FLOAT2;1;FLOAT2;2
|
|
Node;AmplifyShaderEditor.SimpleAddOpNode;32;-884.012,459.3082;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;0.2;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SamplerNode;3;-2113.726,140.666;Inherit;True;Property;_TextureSample1;Texture Sample 1;0;0;Create;True;0;0;0;False;0;False;-1;None;d5e0256f5edc34249834c572d63f3625;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.SamplerNode;38;-1942.991,-157.4031;Inherit;True;Property;_TextureSample0;Texture Sample 0;6;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;33;-619.012,456.3082;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;0.8;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleSubtractOpNode;4;-1659.22,94.07367;Inherit;True;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;27;-1169.455,294.297;Inherit;False;Property;_In;In;3;0;Create;True;0;0;0;False;0;False;1.59;0;0;0;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;11;-1378.272,322.6033;Inherit;True;2;2;0;FLOAT;0;False;1;COLOR;0,0,0,0;False;1;COLOR;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;16;-1441.712,111.2179;Inherit;True;2;2;0;FLOAT;0;False;1;COLOR;0,0,0,0;False;1;COLOR;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;29;-912.0116,290.3082;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;26;-700.925,209.1192;Inherit;True;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;23;-214.824,88.37387;Inherit;False;Constant;_Float1;Float 1;3;0;Create;True;0;0;0;False;0;False;1;0;0;0;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleAddOpNode;17;-874.1989,-58.26542;Inherit;True;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0
|
|
Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;25;0,0;Float;False;True;-1;2;ASEMaterialInspector;0;8;Unlit/GlassShader;0f8ba0101102bb14ebf021ddadce9b49;True;SubShader 0 Pass 0;0;0;SubShader 0 Pass 0;2;False;True;3;1;False;-1;10;False;-1;0;1;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;-1;False;False;False;False;False;False;False;False;False;False;False;True;2;False;-1;False;False;True;5;Queue=Transparent=Queue=0;IgnoreProjector=True;RenderType=Transparent=RenderType;PreviewType=Plane;CanUseSpriteAtlas=True;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;2;False;0;;0;0;Standard;0;0;1;True;False;;False;0
|
|
WireConnection;34;0;36;0
|
|
WireConnection;35;0;34;0
|
|
WireConnection;7;0;8;0
|
|
WireConnection;31;0;35;0
|
|
WireConnection;5;1;7;0
|
|
WireConnection;32;0;31;0
|
|
WireConnection;38;0;37;0
|
|
WireConnection;33;0;32;0
|
|
WireConnection;4;0;38;4
|
|
WireConnection;4;1;3;4
|
|
WireConnection;11;0;5;0
|
|
WireConnection;11;1;15;0
|
|
WireConnection;16;0;4;0
|
|
WireConnection;16;1;11;0
|
|
WireConnection;29;0;27;0
|
|
WireConnection;29;1;33;0
|
|
WireConnection;26;0;16;0
|
|
WireConnection;26;1;29;0
|
|
WireConnection;17;0;38;0
|
|
WireConnection;17;1;26;0
|
|
WireConnection;25;0;17;0
|
|
ASEEND*/
|
|
//CHKSM=E4A632DC4D2BC47460C6FB57713A973F2FC40EFA |