From 8490d11762bc09884263771f04cea34d4607127e Mon Sep 17 00:00:00 2001 From: Takashi Sakai Date: Fri, 11 May 2018 20:39:13 +0900 Subject: [PATCH 1/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fa6b6725..dbe2460c 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ UIEffect UIEffect is an effect component for uGUI in Unity. Let's decorate your UI with effects! -[![](https://img.shields.io/github/release/mob-sakai/UIEffect.svg?label=latest%20version)](https://github.com/mob-sakai/UIEffect/release) +[![](https://img.shields.io/github/release/mob-sakai/UIEffect.svg?label=latest%20version)](https://github.com/mob-sakai/UIEffect/releases) [![](https://img.shields.io/github/release-date/mob-sakai/UIEffect.svg)](https://github.com/mob-sakai/UIEffect/releases) ![](https://img.shields.io/badge/requirement-Unity%205.5%2B-green.svg) [![](https://img.shields.io/github/license/mob-sakai/UIEffect.svg)](https://github.com/mob-sakai/UIEffect/blob/master/LICENSE.txt) From 72e2149f70255100b4c2276773468ff6ca9627c4 Mon Sep 17 00:00:00 2001 From: Takashi Sakai Date: Sat, 19 May 2018 12:12:43 +0900 Subject: [PATCH 2/6] Revert "Fixed: UIEffectCapturedImage: When iteration count is even. the result image is flipped vertically (on Windows) #62" This reverts commit 9d911eb58187a9afa20a1f84b78e2c3124d73e23. --- Assets/UIEffect/UI-EffectCapture.shader | 15 ++++++++++----- Assets/UIEffect/UIEffectCapturedImage.cs | 3 +-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Assets/UIEffect/UI-EffectCapture.shader b/Assets/UIEffect/UI-EffectCapture.shader index 98f77351..ddbdbb41 100644 --- a/Assets/UIEffect/UI-EffectCapture.shader +++ b/Assets/UIEffect/UI-EffectCapture.shader @@ -37,7 +37,9 @@ Shader "UI/Hidden/UI-EffectCapture" fixed4 colorFactor : COLOR1; #endif + #if defined (UI_TONE) || defined (UI_BLUR) half4 effectFactor : TEXCOORD2; + #endif }; sampler2D _MainTex; @@ -49,9 +51,16 @@ Shader "UI/Hidden/UI-EffectCapture" { v2f OUT; OUT.vertex = UnityObjectToClipPos(v.vertex); - + + #if UNITY_UV_STARTS_AT_TOP + OUT.texcoord = half2(v.texcoord.x, 1 - v.texcoord.y); + #else OUT.texcoord = v.texcoord; + #endif + + #if defined (UI_TONE) || defined (UI_BLUR) OUT.effectFactor = _EffectFactor; + #endif #if UI_TONE_HUE OUT.effectFactor.y = sin(OUT.effectFactor.x*3.14159265359*2); @@ -64,10 +73,6 @@ Shader "UI/Hidden/UI-EffectCapture" OUT.colorFactor = _ColorFactor; #endif - #if UNITY_UV_STARTS_AT_TOP - OUT.texcoord.y = lerp(OUT.texcoord.y, 1 - OUT.texcoord.y, OUT.effectFactor.w); - #endif - return OUT; } diff --git a/Assets/UIEffect/UIEffectCapturedImage.cs b/Assets/UIEffect/UIEffectCapturedImage.cs index 44964c3f..d20425c6 100644 --- a/Assets/UIEffect/UIEffectCapturedImage.cs +++ b/Assets/UIEffect/UIEffectCapturedImage.cs @@ -241,7 +241,7 @@ public void Capture() _buffer.Blit(BuiltinRenderTextureType.CurrentActive, s_CopyId); // Set properties. - _buffer.SetGlobalVector("_EffectFactor", new Vector4(toneLevel, 0, blur, 1)); + _buffer.SetGlobalVector("_EffectFactor", new Vector4(toneLevel, 0, blur, 0)); _buffer.SetGlobalVector("_ColorFactor", new Vector4(effectColor.r, effectColor.g, effectColor.b, effectColor.a)); // Blit without effect. @@ -261,7 +261,6 @@ public void Capture() // Iterate the operation. if(1 < m_Iterations) { - _buffer.SetGlobalVector("_EffectFactor", new Vector4(toneLevel, 0, blur, 0)); _buffer.GetTemporaryRT(s_EffectId2, w, h, 0, m_FilterMode); for (int i = 1; i < m_Iterations; i++) { From e6027fbec2548189236dcb3f3d4e8f86e8ef9482 Mon Sep 17 00:00:00 2001 From: Takashi Sakai Date: Sat, 19 May 2018 13:17:52 +0900 Subject: [PATCH 3/6] Fixed #65 : UIEffectCapturedImage: When iteration count is even. the result image is flipped vertically (other method) --- Assets/UIEffect/UIEffectCapturedImage.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Assets/UIEffect/UIEffectCapturedImage.cs b/Assets/UIEffect/UIEffectCapturedImage.cs index d20425c6..813715a0 100644 --- a/Assets/UIEffect/UIEffectCapturedImage.cs +++ b/Assets/UIEffect/UIEffectCapturedImage.cs @@ -142,6 +142,20 @@ protected override void OnPopulateMesh(VertexHelper vh) // When not displaying, clear vertex. if (texture == null || effectColor.a < 1 / 255f || canvasRenderer.GetAlpha() < 1 / 255f) vh.Clear(); + else if(_capturedIterations % 2 == 0) + { + Debug.Log(iterations); + base.OnPopulateMesh(vh); + int count = vh.currentVertCount; + UIVertex vt = UIVertex.simpleVert; + Vector2 one = Vector2.one; + for (int i = 0; i < count; i++) + { + vh.PopulateUIVertex(ref vt, i); + vt.uv0 = new Vector2(vt.uv0.x, 1-vt.uv0.y); + vh.SetUIVertex(vt, i); + } + } else base.OnPopulateMesh(vh); } @@ -249,6 +263,7 @@ public void Capture() { _buffer.Blit(s_CopyId, rtId); _buffer.ReleaseTemporaryRT(s_CopyId); + _capturedIterations = 1; } // Blit with effect. else @@ -275,6 +290,7 @@ public void Capture() { _buffer.ReleaseTemporaryRT(s_EffectId2); } + _capturedIterations = m_Iterations; } } @@ -311,6 +327,7 @@ public void Release() RenderTexture _rt; RenderTexture _rtToRelease; CommandBuffer _buffer; + int _capturedIterations = 1; static int s_CopyId; static int s_EffectId1; From be90296be753e59081e7cc4a6a930ee3e1b0e24b Mon Sep 17 00:00:00 2001 From: Takashi Sakai Date: Sat, 19 May 2018 13:48:31 +0900 Subject: [PATCH 4/6] Add UNITY_STANDALONE_WIN symbol --- Assets/UIEffect/UIEffectCapturedImage.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Assets/UIEffect/UIEffectCapturedImage.cs b/Assets/UIEffect/UIEffectCapturedImage.cs index 813715a0..b3463434 100644 --- a/Assets/UIEffect/UIEffectCapturedImage.cs +++ b/Assets/UIEffect/UIEffectCapturedImage.cs @@ -142,6 +142,7 @@ protected override void OnPopulateMesh(VertexHelper vh) // When not displaying, clear vertex. if (texture == null || effectColor.a < 1 / 255f || canvasRenderer.GetAlpha() < 1 / 255f) vh.Clear(); +#if UNITY_STANDALONE_WIN else if(_capturedIterations % 2 == 0) { Debug.Log(iterations); @@ -156,6 +157,7 @@ protected override void OnPopulateMesh(VertexHelper vh) vh.SetUIVertex(vt, i); } } +#endif else base.OnPopulateMesh(vh); } From 923f74d0477c2807db1ba69176acbe01b702222d Mon Sep 17 00:00:00 2001 From: Takashi Sakai Date: Mon, 21 May 2018 15:09:56 +0900 Subject: [PATCH 5/6] Update release script (use 5.5.0p4 to export package) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dffee832..b38448a1 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,6 @@ "url": "git+https://github.com/mob-sakai/UIEffect.git" }, "src": "Assets/UIEffect", - "unity": "/Applications/Unity2017.1.0p5/Unity2017.1.0p5.app/Contents/MacOS/Unity", + "unity": "/Applications/Unity/Hub/Editor/5.5.0p4/Unity.app/Contents/MacOS/Unity", "license": "MIT" } From b4cb57e097cede93552c048d0e10f648f29d40dd Mon Sep 17 00:00:00 2001 From: Takashi Sakai Date: Mon, 21 May 2018 15:13:19 +0900 Subject: [PATCH 6/6] update change log --- CHANGELOG.md | 8 ++++++++ package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 698af936..cd1652b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [v2.3.2](https://github.com/mob-sakai/UIEffect/tree/v2.3.2) (2018-05-21) + +[Full Changelog](https://github.com/mob-sakai/UIEffect/compare/v2.3.1...v2.3.2) + +**Closed issues:** + +- Fixed: UIEffectCapturedImage: When iteration count is even. the result image is flipped vertically \(other method\) [\#65](https://github.com/mob-sakai/UIEffect/issues/65) + ## [v2.3.1](https://github.com/mob-sakai/UIEffect/tree/v2.3.1) (2018-05-10) [Full Changelog](https://github.com/mob-sakai/UIEffect/compare/v2.3.0...v2.3.1) diff --git a/package.json b/package.json index b38448a1..f3d78243 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "UIEffect", - "version": "2.3.1", + "version": "2.3.2", "repository": { "type": "git", "url": "git+https://github.com/mob-sakai/UIEffect.git"