diff options
Diffstat (limited to 'Assets/Bundle/Shaders/Common')
-rw-r--r-- | Assets/Bundle/Shaders/Common/Image/common_img_blur.shader | 36 | ||||
-rw-r--r-- | Assets/Bundle/Shaders/Common/common_solid_color.shader | 6 |
2 files changed, 15 insertions, 27 deletions
diff --git a/Assets/Bundle/Shaders/Common/Image/common_img_blur.shader b/Assets/Bundle/Shaders/Common/Image/common_img_blur.shader index f6c016b3..d1e00953 100644 --- a/Assets/Bundle/Shaders/Common/Image/common_img_blur.shader +++ b/Assets/Bundle/Shaders/Common/Image/common_img_blur.shader @@ -1,10 +1,14 @@ -Shader "Erika/Common/Image/Blur" +// 高斯模糊 + +Shader "Erika/Common/Image/Blur" { Properties { _MainTex("Texture", 2D) = "white" {} _Angle("Angle", float) = 0 _Distance("Distance", float) = 0 + _TileOffset("TileOffset", Vector) = (1,1,0,0) + _Iterate("Iterate Count", float) = 1 } SubShader @@ -25,11 +29,7 @@ #include "UnityCG.cginc" - struct appdata - { - float4 vertex : POSITION; - float2 uv : TEXCOORD0; - }; + #include "Assets/Bundle/Shaders/Include/ImageEffect.cginc" struct v2f { @@ -46,11 +46,13 @@ fixed _Distance; - v2f vert(appdata v) + float _Iterate; // 迭代次数 + + v2f vert(appdata_img v) { v2f o; o.vertex = UnityObjectToClipPos(v.vertex); - o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.uv = TRANSFORM_TEX(v.texcoord, _MainTex); return o; } @@ -60,22 +62,8 @@ _Distance = 0; 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); - if(uv.x > _TileOffset.z && uv.x < _TileOffset.x + _TileOffset.z - && uv.y > _TileOffset.w && uv.y < _TileOffset.w + _TileOffset.y) { - color = fixed4(1,0,0,0); - } + + fixed4 color = blur(_MainTex, _ScreenParams.xy, uv); return color; } diff --git a/Assets/Bundle/Shaders/Common/common_solid_color.shader b/Assets/Bundle/Shaders/Common/common_solid_color.shader index 798924d3..92daaa30 100644 --- a/Assets/Bundle/Shaders/Common/common_solid_color.shader +++ b/Assets/Bundle/Shaders/Common/common_solid_color.shader @@ -11,7 +11,7 @@ LOD 100 ZTest LEqual - ZWrite Off + ZWrite On Pass { @@ -70,8 +70,8 @@ float diff = saturate(depth - camDepth); if (diff < 0.0001) { - // c = _Color; - c = tex2D(_MainTex, i.uv); + c = _Color; + // c = tex2D(_MainTex, i.uv); } return c; |