summaryrefslogtreecommitdiff
path: root/Assets/Bundle/Shaders/Common/Image
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/Bundle/Shaders/Common/Image')
-rw-r--r--Assets/Bundle/Shaders/Common/Image/ImageEffect.cginc17
-rw-r--r--Assets/Bundle/Shaders/Common/Image/common_img_motionblur.shader4
2 files changed, 18 insertions, 3 deletions
diff --git a/Assets/Bundle/Shaders/Common/Image/ImageEffect.cginc b/Assets/Bundle/Shaders/Common/Image/ImageEffect.cginc
index 04334ee4..7f657e59 100644
--- a/Assets/Bundle/Shaders/Common/Image/ImageEffect.cginc
+++ b/Assets/Bundle/Shaders/Common/Image/ImageEffect.cginc
@@ -1,4 +1,4 @@
-// UnitLensEffect效果
+// UnitLensEffect效果相关
sampler2D _MainTex;
float4 _MainTex_ST;
@@ -16,3 +16,18 @@ sampler2D _UnitMotionVectorTexture;
float4 _UnitMotionVectorTexture_ST;
float4 _UnitTileOffset;
+
+// functions
+
+// 只对一小部分进行后处理
+float4 CalculateUnitTillOfssetVertex(float4 vert)
+{
+ float4 v = float4(vert.xy * _UnitTileOffset.xy + _UnitTileOffset.zw, 0, 1);
+ v.xy = v.xy * 2 - float2(1,1);
+ return v;
+}
+
+fixed2 CalculateUnitTillOfssetUV(fixed2 uv0)
+{
+ return uv0 * _UnitTileOffset.xy + _UnitTileOffset.zw;
+}
diff --git a/Assets/Bundle/Shaders/Common/Image/common_img_motionblur.shader b/Assets/Bundle/Shaders/Common/Image/common_img_motionblur.shader
index 2246fda2..16ec6fe7 100644
--- a/Assets/Bundle/Shaders/Common/Image/common_img_motionblur.shader
+++ b/Assets/Bundle/Shaders/Common/Image/common_img_motionblur.shader
@@ -48,8 +48,8 @@ Shader "Erika/Common/Image/MotionBlur"
v2f vert(appdata_img v)
{
v2f o;
- o.vertex = UnityObjectToClipPos(v.vertex);
- o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
+ o.vertex = CalculateUnitTillOfssetVertex(v.vertex);
+ o.uv = CalculateUnitTillOfssetUV(TRANSFORM_TEX(v.texcoord, _MainTex));
return o;
}