summaryrefslogtreecommitdiff
path: root/Assets/Bundle/Shaders/Common
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/Bundle/Shaders/Common')
-rw-r--r--Assets/Bundle/Shaders/Common/Image.meta8
-rw-r--r--Assets/Bundle/Shaders/Common/Image/common_img_bloom.cs18
-rw-r--r--Assets/Bundle/Shaders/Common/Image/common_img_bloom.cs.meta11
-rw-r--r--Assets/Bundle/Shaders/Common/Image/common_img_blur.shader79
-rw-r--r--Assets/Bundle/Shaders/Common/Image/common_img_blur.shader.meta9
-rw-r--r--Assets/Bundle/Shaders/Common/common_solid_color.shader81
-rw-r--r--Assets/Bundle/Shaders/Common/common_solid_color.shader.meta9
7 files changed, 215 insertions, 0 deletions
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: