diff options
Diffstat (limited to 'Assets/Bundle/Shaders')
17 files changed, 423 insertions, 136 deletions
diff --git a/Assets/Bundle/Shaders/Unit/Effect.meta b/Assets/Bundle/Shaders/Common.meta index 7df9a033..bb87a51a 100644 --- a/Assets/Bundle/Shaders/Unit/Effect.meta +++ b/Assets/Bundle/Shaders/Common.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 9cc4684b9f432f149b16a51f148c9490 +guid: 174b504a5d32cf84daeee290b8470ff1 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/Bundle/Shaders/Common/Image.meta b/Assets/Bundle/Shaders/Common/Image.meta new file mode 100644 index 00000000..abeda856 --- /dev/null +++ b/Assets/Bundle/Shaders/Common/Image.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c4f83cfe782b4d6408644387c887b5f9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Bundle/Shaders/Common/Image/common_img_bloom.cs b/Assets/Bundle/Shaders/Common/Image/common_img_bloom.cs new file mode 100644 index 00000000..a5603324 --- /dev/null +++ b/Assets/Bundle/Shaders/Common/Image/common_img_bloom.cs @@ -0,0 +1,18 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class common_img_bloom : MonoBehaviour +{ + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + + } +} diff --git a/Assets/Bundle/Shaders/Common/Image/common_img_bloom.cs.meta b/Assets/Bundle/Shaders/Common/Image/common_img_bloom.cs.meta new file mode 100644 index 00000000..a94e86e5 --- /dev/null +++ b/Assets/Bundle/Shaders/Common/Image/common_img_bloom.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 31492de5533444b49bab8c503b8c6d0f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Bundle/Shaders/Common/Image/common_img_blur.shader b/Assets/Bundle/Shaders/Common/Image/common_img_blur.shader new file mode 100644 index 00000000..2cebb028 --- /dev/null +++ b/Assets/Bundle/Shaders/Common/Image/common_img_blur.shader @@ -0,0 +1,79 @@ +Shader "Erika/Common/Image/Blur" +{ + Properties + { + _MainTex("Texture", 2D) = "white" {} + _Angle("Angle", float) = 0 + _Distance("Distance", float) = 0 + } + + SubShader + { + Tags { "RenderType" = "Opaque" "Queue" = "Transparent-1"} + LOD 100 + + ZWrite Off + ZTest LEqual + + Blend SrcAlpha OneMinusSrcAlpha + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + + #include "UnityCG.cginc" + + struct appdata + { + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + }; + + struct v2f + { + float2 uv : TEXCOORD0; + float4 vertex : SV_POSITION; + }; + + sampler2D _MainTex; + float4 _MainTex_ST; + + float _Angle; + + fixed _Distance; + + v2f vert(appdata v) + { + v2f o; + o.vertex = UnityObjectToClipPos(v.vertex); + o.uv = TRANSFORM_TEX(v.uv, _MainTex); + return o; + } + + fixed4 frag(v2f i) : SV_Target + { + _Angle = 0; + _Distance = 0.02f; + + fixed2 uv = i.uv; + fixed2 offset = fixed2(0.05, 0.05); + const float sampleCount = 30; + fixed4 color = fixed4(0,0,0,0); + float radian = radians(_Angle); + float distance = _Distance; + for (int i = 0; i < sampleCount; i++) + { + float dx = distance * cos(radian) / sampleCount * i; + float dy = distance * sin(radian) / sampleCount * i; + color += tex2D(_MainTex,float2(uv.x + dx,uv.y + dy)) * (1 / sampleCount); + } + //color = tex2D(_MainTex, uv); + return color; + } + ENDCG + } + } + +} // shader diff --git a/Assets/Bundle/Shaders/Common/Image/common_img_blur.shader.meta b/Assets/Bundle/Shaders/Common/Image/common_img_blur.shader.meta new file mode 100644 index 00000000..8053135d --- /dev/null +++ b/Assets/Bundle/Shaders/Common/Image/common_img_blur.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 582d2065809e3814c98b6f0806996415 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Bundle/Shaders/Common/common_solid_color.shader b/Assets/Bundle/Shaders/Common/common_solid_color.shader new file mode 100644 index 00000000..031d4b69 --- /dev/null +++ b/Assets/Bundle/Shaders/Common/common_solid_color.shader @@ -0,0 +1,81 @@ +Shader "Erika/Common/SolidColor" +{ + Properties + { + _MainTex("Texture", 2D) = "white" {} + _Color("Color", Color) = (1,1,1,1) + } + SubShader + { + Tags { "RenderType"="Opaque" } + LOD 100 + + ZTest LEqual + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + + #include "UnityCG.cginc" + + struct appdata + { + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + }; + + struct v2f + { + float2 uv : TEXCOORD0; + float4 vertex : SV_POSITION; + float4 screenPos : TEXCOORD2; + }; + + fixed4 _Color; + + sampler2D_float _CameraDepthTexture; + + float4x4 _ObjectToWorld; + + sampler2D _MainTex; + float4 _MainTex_ST; + + v2f vert (appdata v) + { + v2f o; + o.vertex = UnityWorldToClipPos(mul(_ObjectToWorld, v.vertex)); + //o.vertex = UnityWorldToClipPos(mul(unity_ObjectToWorld, v.vertex)); + o.screenPos = ComputeScreenPos(o.vertex); + o.uv = TRANSFORM_TEX(v.uv, _MainTex); + return o; + } + + fixed4 frag (v2f i) : SV_Target + { + float4 c = float4(0, 0, 0, 0); + + float2 uv = i.screenPos.xy / i.screenPos.w; // normalized screen-space pos + float camDepth = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); + camDepth = Linear01Depth(camDepth); // converts z buffer value to depth value from 0..1 + + float depth = i.screenPos.z / i.screenPos.w; +#if !UNITY_UV_STARTS_AT_TOP//OpenGL平台需要手动将[-1,1]映射到[0,1]模拟glDepthRange(0,1) + depth = (depth + 1) / 2; +#endif + depth = Linear01Depth(depth); + + float diff = saturate(depth - camDepth); + if (diff < 0.0001) + { + // c = _Color; + c = tex2D(_MainTex, i.uv); + } + + return c; + } + ENDCG + } + } +} diff --git a/Assets/Bundle/Shaders/Common/common_solid_color.shader.meta b/Assets/Bundle/Shaders/Common/common_solid_color.shader.meta new file mode 100644 index 00000000..c0777cb0 --- /dev/null +++ b/Assets/Bundle/Shaders/Common/common_solid_color.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: e7ee93f26e570c24cbdef0b6ad1f461d +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Bundle/Shaders/Unit/ImageEffect/unit_img_colorDrift.shader b/Assets/Bundle/Shaders/Unit/ImageEffect/unit_img_color_drift.shader index 63e98344..f76b0a91 100644 --- a/Assets/Bundle/Shaders/Unit/ImageEffect/unit_img_colorDrift.shader +++ b/Assets/Bundle/Shaders/Unit/ImageEffect/unit_img_color_drift.shader @@ -1,58 +1,58 @@ -Shader "Unlit/unit_effect_colorDrift"
-{
- Properties
- {
- _MainTex ("Texture", 2D) = "white" {}
- }
- SubShader
- {
- Tags { "RenderType"="Opaque" }
- LOD 100
-
- Pass
- {
- CGPROGRAM
- #pragma vertex vert
- #pragma fragment frag
- // make fog work
- #pragma multi_compile_fog
-
- #include "UnityCG.cginc"
-
- struct appdata
- {
- float4 vertex : POSITION;
- float2 uv : TEXCOORD0;
- };
-
- struct v2f
- {
- float2 uv : TEXCOORD0;
- UNITY_FOG_COORDS(1)
- float4 vertex : SV_POSITION;
- };
-
- sampler2D _MainTex;
- float4 _MainTex_ST;
-
- v2f vert (appdata v)
- {
- v2f o;
- o.vertex = UnityObjectToClipPos(v.vertex);
- o.uv = TRANSFORM_TEX(v.uv, _MainTex);
- UNITY_TRANSFER_FOG(o,o.vertex);
- return o;
- }
-
- fixed4 frag (v2f i) : SV_Target
- {
- // sample the texture
- fixed4 col = tex2D(_MainTex, i.uv);
- // apply fog
- UNITY_APPLY_FOG(i.fogCoord, col);
- return col;
- }
- ENDCG
- }
- }
-}
+Shader "Unlit/unit_effect_colorDrift" +{ + Properties + { + _MainTex ("Texture", 2D) = "white" {} + } + SubShader + { + Tags { "RenderType"="Opaque" } + LOD 100 + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + // make fog work + #pragma multi_compile_fog + + #include "UnityCG.cginc" + + struct appdata + { + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + }; + + struct v2f + { + float2 uv : TEXCOORD0; + UNITY_FOG_COORDS(1) + float4 vertex : SV_POSITION; + }; + + sampler2D _MainTex; + float4 _MainTex_ST; + + v2f vert (appdata v) + { + v2f o; + o.vertex = UnityObjectToClipPos(v.vertex); + o.uv = TRANSFORM_TEX(v.uv, _MainTex); + UNITY_TRANSFER_FOG(o,o.vertex); + return o; + } + + fixed4 frag (v2f i) : SV_Target + { + // sample the texture + fixed4 col = tex2D(_MainTex, i.uv); + // apply fog + UNITY_APPLY_FOG(i.fogCoord, col); + return col; + } + ENDCG + } + } +} diff --git a/Assets/Bundle/Shaders/Unit/ImageEffect/unit_img_colorDrift.shader.meta b/Assets/Bundle/Shaders/Unit/ImageEffect/unit_img_color_drift.shader.meta index d42d528f..d42d528f 100644 --- a/Assets/Bundle/Shaders/Unit/ImageEffect/unit_img_colorDrift.shader.meta +++ b/Assets/Bundle/Shaders/Unit/ImageEffect/unit_img_color_drift.shader.meta diff --git a/Assets/Bundle/Shaders/Unit/ImageEffect/unit_img_motionBlur.shader b/Assets/Bundle/Shaders/Unit/ImageEffect/unit_img_motion_blur.shader index c5cfcf26..3111369a 100644 --- a/Assets/Bundle/Shaders/Unit/ImageEffect/unit_img_motionBlur.shader +++ b/Assets/Bundle/Shaders/Unit/ImageEffect/unit_img_motion_blur.shader @@ -4,8 +4,6 @@ Shader "Erika/Unit/ImageEffect/unit_img_motionBlur" Properties { _MainTex("Texture", 2D) = "white" {} - _BlurTex("Texture", 2D) = "black" {} - _MaskColor ("Mask Color", Color) = (1,1,1,1) _Angle("Angle", float) = 0 _Distance("Distance", float) = 0 } @@ -42,11 +40,6 @@ Shader "Erika/Unit/ImageEffect/unit_img_motionBlur" sampler2D _MainTex; float4 _MainTex_ST; - sampler2D _BlurTex; - float4 _BlurTex_ST; - - fixed4 _MaskColor; - float _Angle; fixed _Distance; @@ -62,18 +55,18 @@ Shader "Erika/Unit/ImageEffect/unit_img_motionBlur" fixed4 frag (v2f i) : SV_Target { fixed2 uv = i.uv; - fixed2 offset = fixed2(0.05, 0.05);
- const float sampleCount = 30;
- fixed4 color = fixed4(0,0,0,0);
- float radian = radians(_Angle);
- float distance = _Distance;
- for(int i = 0; i < sampleCount; i++)
- {
- float dx = distance * cos(radian) / sampleCount * i;
- float dy = distance * sin(radian) / sampleCount * i;
- color += tex2D(_MainTex,float2(uv.x + dx,uv.y + dy)) * (1 / sampleCount);
- }
- //color.rgb *= 0.5f;
+ fixed2 offset = fixed2(0.05, 0.05); + const float sampleCount = 30; + fixed4 color = fixed4(0,0,0,0); + float radian = radians(_Angle); + float distance = _Distance; + for(int i = 0; i < sampleCount; i++) + { + float dx = distance * cos(radian) / sampleCount * i; + float dy = distance * sin(radian) / sampleCount * i; + color += tex2D(_MainTex,float2(uv.x + dx,uv.y + dy)) * (1 / sampleCount); + } + //color.rgb *= 0.5f; return color; } ENDCG diff --git a/Assets/Bundle/Shaders/Unit/ImageEffect/unit_img_motionBlur.shader.meta b/Assets/Bundle/Shaders/Unit/ImageEffect/unit_img_motion_blur.shader.meta index 4afe3c18..4afe3c18 100644 --- a/Assets/Bundle/Shaders/Unit/ImageEffect/unit_img_motionBlur.shader.meta +++ b/Assets/Bundle/Shaders/Unit/ImageEffect/unit_img_motion_blur.shader.meta diff --git a/Assets/Bundle/Shaders/Unit/ImageEffect/unit_img_speedLine.shader b/Assets/Bundle/Shaders/Unit/ImageEffect/unit_img_speed_line.shader index fbc32eb5..b00673eb 100644 --- a/Assets/Bundle/Shaders/Unit/ImageEffect/unit_img_speedLine.shader +++ b/Assets/Bundle/Shaders/Unit/ImageEffect/unit_img_speed_line.shader @@ -1,58 +1,58 @@ -Shader "Unlit/unit_effect_speedLine"
-{
- Properties
- {
- _MainTex ("Texture", 2D) = "white" {}
- }
- SubShader
- {
- Tags { "RenderType"="Opaque" }
- LOD 100
-
- Pass
- {
- CGPROGRAM
- #pragma vertex vert
- #pragma fragment frag
- // make fog work
- #pragma multi_compile_fog
-
- #include "UnityCG.cginc"
-
- struct appdata
- {
- float4 vertex : POSITION;
- float2 uv : TEXCOORD0;
- };
-
- struct v2f
- {
- float2 uv : TEXCOORD0;
- UNITY_FOG_COORDS(1)
- float4 vertex : SV_POSITION;
- };
-
- sampler2D _MainTex;
- float4 _MainTex_ST;
-
- v2f vert (appdata v)
- {
- v2f o;
- o.vertex = UnityObjectToClipPos(v.vertex);
- o.uv = TRANSFORM_TEX(v.uv, _MainTex);
- UNITY_TRANSFER_FOG(o,o.vertex);
- return o;
- }
-
- fixed4 frag (v2f i) : SV_Target
- {
- // sample the texture
- fixed4 col = tex2D(_MainTex, i.uv);
- // apply fog
- UNITY_APPLY_FOG(i.fogCoord, col);
- return col;
- }
- ENDCG
- }
- }
-}
+Shader "Unlit/unit_effect_speedLine" +{ + Properties + { + _MainTex ("Texture", 2D) = "white" {} + } + SubShader + { + Tags { "RenderType"="Opaque" } + LOD 100 + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + // make fog work + #pragma multi_compile_fog + + #include "UnityCG.cginc" + + struct appdata + { + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + }; + + struct v2f + { + float2 uv : TEXCOORD0; + UNITY_FOG_COORDS(1) + float4 vertex : SV_POSITION; + }; + + sampler2D _MainTex; + float4 _MainTex_ST; + + v2f vert (appdata v) + { + v2f o; + o.vertex = UnityObjectToClipPos(v.vertex); + o.uv = TRANSFORM_TEX(v.uv, _MainTex); + UNITY_TRANSFER_FOG(o,o.vertex); + return o; + } + + fixed4 frag (v2f i) : SV_Target + { + // sample the texture + fixed4 col = tex2D(_MainTex, i.uv); + // apply fog + UNITY_APPLY_FOG(i.fogCoord, col); + return col; + } + ENDCG + } + } +} diff --git a/Assets/Bundle/Shaders/Unit/ImageEffect/unit_img_speedLine.shader.meta b/Assets/Bundle/Shaders/Unit/ImageEffect/unit_img_speed_line.shader.meta index 37726c12..37726c12 100644 --- a/Assets/Bundle/Shaders/Unit/ImageEffect/unit_img_speedLine.shader.meta +++ b/Assets/Bundle/Shaders/Unit/ImageEffect/unit_img_speed_line.shader.meta diff --git a/Assets/Bundle/Shaders/Unit/LensEffect.meta b/Assets/Bundle/Shaders/Unit/LensEffect.meta new file mode 100644 index 00000000..8870549b --- /dev/null +++ b/Assets/Bundle/Shaders/Unit/LensEffect.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8ea8530ead06b5646968d268799393e0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Bundle/Shaders/Unit/LensEffect/unit_lens_motion_blur.shader b/Assets/Bundle/Shaders/Unit/LensEffect/unit_lens_motion_blur.shader new file mode 100644 index 00000000..9b8bec4c --- /dev/null +++ b/Assets/Bundle/Shaders/Unit/LensEffect/unit_lens_motion_blur.shader @@ -0,0 +1,62 @@ +//给RT做运动模糊 + +Shader "Unlit/unit_lens_motion_blur" +{ + Properties + { + _MainTex ("Texture", 2D) = "white" {} + } + SubShader + { + Tags { "RenderType"="Opaque" } + LOD 100 + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + // make fog work + #pragma multi_compile_fog + + #include "UnityCG.cginc" + + struct appdata + { + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + }; + + struct v2f + { + float2 uv : TEXCOORD0; + UNITY_FOG_COORDS(1) + float4 vertex : SV_POSITION; + }; + + sampler2D _MainTex; + float4 _MainTex_ST; + + float4 _ScaleOffset; // 角色在RT中的位置 + + v2f vert (appdata v) + { + v2f o; + o.vertex = UnityObjectToClipPos(v.vertex); + o.uv = TRANSFORM_TEX(v.uv, _MainTex); + UNITY_TRANSFER_FOG(o,o.vertex); + return o; + } + + fixed4 frag (v2f i) : SV_Target + { + // sample the texture + fixed4 col = tex2D(_MainTex, i.uv); + // apply fog + UNITY_APPLY_FOG(i.fogCoord, col); + return col; + } + ENDCG + } + } +} diff --git a/Assets/Bundle/Shaders/Unit/LensEffect/unit_lens_motion_blur.shader.meta b/Assets/Bundle/Shaders/Unit/LensEffect/unit_lens_motion_blur.shader.meta new file mode 100644 index 00000000..896045f9 --- /dev/null +++ b/Assets/Bundle/Shaders/Unit/LensEffect/unit_lens_motion_blur.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 7e03081c3480da045a4e3fd8050068ea +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: |