From 1e9cea00cbbeabd5a965fe7a5fbfd5689b4311b3 Mon Sep 17 00:00:00 2001 From: Takashi Sakai Date: Sat, 7 Apr 2018 02:16:34 +0900 Subject: [PATCH 1/9] Feature: UIEffectCapturedImage supports `Quality Type` to easy setup. #53 --- .../Editor/UIEffectCapturedImageEditor.cs | 95 +++++++++++++++++-- 1 file changed, 85 insertions(+), 10 deletions(-) diff --git a/Assets/UIEffect/Editor/UIEffectCapturedImageEditor.cs b/Assets/UIEffect/Editor/UIEffectCapturedImageEditor.cs index bb8b412..d8d5a98 100644 --- a/Assets/UIEffect/Editor/UIEffectCapturedImageEditor.cs +++ b/Assets/UIEffect/Editor/UIEffectCapturedImageEditor.cs @@ -1,6 +1,7 @@ using UnityEditor; using UnityEditor.UI; using UnityEngine; +using DesamplingRate = Coffee.UIExtensions.UIEffectCapturedImage.DesamplingRate; namespace Coffee.UIExtensions { @@ -11,6 +12,36 @@ namespace Coffee.UIExtensions [CanEditMultipleObjects] public class UIEffectCapturedImageEditor : RawImageEditor { + //################################ + // Constant or Static Members. + //################################ + + public enum QualityMode : int + { + Fast = (DesamplingRate.x2 << 0) + (DesamplingRate.x2 << 4) + (FilterMode.Bilinear << 8) + (1 << 10), + Medium = (DesamplingRate.x1 << 0) + (DesamplingRate.x1 << 4) + (FilterMode.Bilinear << 8) + (1 << 10), + Detail = (DesamplingRate.None << 0) + (DesamplingRate.x1 << 4) + (FilterMode.Bilinear << 8) + (1 << 10), + Custom = -1, + } + + + //################################ + // Public/Protected Members. + //################################ + /// + /// This function is called when the object becomes enabled and active. + /// + protected override void OnEnable() + { + base.OnEnable(); + _spDesamplingRate = serializedObject.FindProperty("m_DesamplingRate"); + _spReductionRate = serializedObject.FindProperty("m_ReductionRate"); + _spFilterMode = serializedObject.FindProperty("m_FilterMode"); + _spIterations = serializedObject.FindProperty("m_Iterations"); + + _customAdvancedOption = (qualityMode == QualityMode.Custom); + } + /// /// Implement this function to make a custom inspector. /// @@ -38,17 +69,23 @@ namespace Coffee.UIExtensions GUILayout.Space(10); EditorGUILayout.LabelField("Advanced Option", EditorStyles.boldLabel); - // Desampling rate. - DrawDesamplingRate(serializedObject.FindProperty("m_DesamplingRate")); + EditorGUI.BeginChangeCheck(); + QualityMode quality = qualityMode; + quality = (QualityMode)EditorGUILayout.EnumPopup("Quality Mode", quality); + if(EditorGUI.EndChangeCheck()) + { + _customAdvancedOption = (quality == QualityMode.Custom); + qualityMode = quality; + } - // Reduction rate. - DrawDesamplingRate(serializedObject.FindProperty("m_ReductionRate")); - - // Filter Mode. - EditorGUILayout.PropertyField(serializedObject.FindProperty("m_FilterMode")); - - // Iterations. - EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Iterations")); + // When qualityMode is `Custom`, show advanced option. + if (_customAdvancedOption) + { + DrawDesamplingRate(_spDesamplingRate);// Desampling rate. + DrawDesamplingRate(_spReductionRate);// Reduction rate. + EditorGUILayout.PropertyField(_spFilterMode);// Filter Mode. + EditorGUILayout.PropertyField(_spIterations);// Iterations. + } serializedObject.ApplyModifiedProperties(); @@ -67,6 +104,44 @@ namespace Coffee.UIExtensions } } + //################################ + // Private Members. + //################################ + const int Bits4 = (1 << 4) - 1; + const int Bits2 = (1 << 2) - 1; + bool _customAdvancedOption = false; + SerializedProperty _spDesamplingRate; + SerializedProperty _spReductionRate; + SerializedProperty _spFilterMode; + SerializedProperty _spIterations; + + QualityMode qualityMode + { + get + { + if (_customAdvancedOption) + return QualityMode.Custom; + + int qualityValue = (_spDesamplingRate.intValue << 0) + + (_spReductionRate.intValue << 4) + + (_spFilterMode.intValue << 8) + + (_spIterations.intValue << 10); + + return System.Enum.IsDefined(typeof(QualityMode), qualityValue) ? (QualityMode)qualityValue : QualityMode.Custom; + } + set + { + if (value != QualityMode.Custom) + { + int qualityValue = (int)value; + _spDesamplingRate.intValue = (qualityValue >> 0) & Bits4; + _spReductionRate.intValue = (qualityValue >> 4) & Bits4; + _spFilterMode.intValue = (qualityValue >> 8) & Bits2; + _spIterations.intValue = (qualityValue >> 10) & Bits4; + } + } + } + /// /// Draws the desampling rate. /// From efefad1a7302ef609ecb6882e958ff085449cde5 Mon Sep 17 00:00:00 2001 From: Takashi Sakai Date: Sat, 7 Apr 2018 03:21:41 +0900 Subject: [PATCH 2/9] Feature: UIEffectCapturedImage supports keep canvas size. #54 --- .../Editor/UIEffectCapturedImageEditor.cs | 16 ++++++++++++--- Assets/UIEffect/UIEffectCapturedImage.cs | 20 ++++++++++++++----- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/Assets/UIEffect/Editor/UIEffectCapturedImageEditor.cs b/Assets/UIEffect/Editor/UIEffectCapturedImageEditor.cs index d8d5a98..eb40e5b 100644 --- a/Assets/UIEffect/Editor/UIEffectCapturedImageEditor.cs +++ b/Assets/UIEffect/Editor/UIEffectCapturedImageEditor.cs @@ -34,10 +34,15 @@ namespace Coffee.UIExtensions protected override void OnEnable() { base.OnEnable(); + _spTexture = serializedObject.FindProperty("m_Texture"); + _spColor = serializedObject.FindProperty("m_Color"); + _spRaycastTarget = serializedObject.FindProperty("m_RaycastTarget"); _spDesamplingRate = serializedObject.FindProperty("m_DesamplingRate"); _spReductionRate = serializedObject.FindProperty("m_ReductionRate"); _spFilterMode = serializedObject.FindProperty("m_FilterMode"); _spIterations = serializedObject.FindProperty("m_Iterations"); + _spKeepSizeToRootCanvas = serializedObject.FindProperty("m_KeepCanvasSize"); + _customAdvancedOption = (qualityMode == QualityMode.Custom); } @@ -52,9 +57,9 @@ namespace Coffee.UIExtensions //================ // Basic properties. //================ - EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Texture")); - EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Color")); - EditorGUILayout.PropertyField(serializedObject.FindProperty("m_RaycastTarget")); + EditorGUILayout.PropertyField(_spTexture); + EditorGUILayout.PropertyField(_spColor); + EditorGUILayout.PropertyField(_spRaycastTarget); //================ // Capture effect. @@ -86,6 +91,7 @@ namespace Coffee.UIExtensions EditorGUILayout.PropertyField(_spFilterMode);// Filter Mode. EditorGUILayout.PropertyField(_spIterations);// Iterations. } + EditorGUILayout.PropertyField(_spKeepSizeToRootCanvas);// Iterations. serializedObject.ApplyModifiedProperties(); @@ -110,10 +116,14 @@ namespace Coffee.UIExtensions const int Bits4 = (1 << 4) - 1; const int Bits2 = (1 << 2) - 1; bool _customAdvancedOption = false; + SerializedProperty _spTexture; + SerializedProperty _spColor; + SerializedProperty _spRaycastTarget; SerializedProperty _spDesamplingRate; SerializedProperty _spReductionRate; SerializedProperty _spFilterMode; SerializedProperty _spIterations; + SerializedProperty _spKeepSizeToRootCanvas; QualityMode qualityMode { diff --git a/Assets/UIEffect/UIEffectCapturedImage.cs b/Assets/UIEffect/UIEffectCapturedImage.cs index eae815f..d20425c 100644 --- a/Assets/UIEffect/UIEffectCapturedImage.cs +++ b/Assets/UIEffect/UIEffectCapturedImage.cs @@ -54,6 +54,7 @@ namespace Coffee.UIExtensions [SerializeField] FilterMode m_FilterMode = FilterMode.Bilinear; [SerializeField] Material m_EffectMaterial; [SerializeField][Range(1, 8)] int m_Iterations = 1; + [SerializeField] bool m_KeepCanvasSize = true; //################################ @@ -119,6 +120,11 @@ namespace Coffee.UIExtensions /// public int iterations { get { return m_Iterations; } set { m_Iterations = value; } } + /// + /// Fits graphic size to the root canvas. + /// + public bool keepCanvasSize { get { return m_KeepCanvasSize; } set { m_KeepCanvasSize = value; } } + /// /// This function is called when the MonoBehaviour will be destroyed. /// @@ -276,11 +282,15 @@ namespace Coffee.UIExtensions _camera.AddCommandBuffer(kCameraEvent, _buffer); // StartCoroutine by CanvasScaler. -#if UNITY_5_4_OR_NEWER - canvas.rootCanvas.GetComponent().StartCoroutine(_CoUpdateTextureOnNextFrame()); -#else - canvas.GetComponentInParent().StartCoroutine(_CoUpdateTextureOnNextFrame()); -#endif + var rootCanvas = canvas.rootCanvas; + var scaler = rootCanvas.GetComponent(); + scaler.StartCoroutine(_CoUpdateTextureOnNextFrame()); + if (m_KeepCanvasSize) + { + var size = (rootCanvas.transform as RectTransform).rect.size; + rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, size.x); + rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, size.y); + } } /// From 3fda891b359cf2d45e580bb4f29741a9a67ac7c9 Mon Sep 17 00:00:00 2001 From: Takashi Sakai Date: Sat, 7 Apr 2018 12:18:36 +0900 Subject: [PATCH 3/9] Feature: Customize shader/material. #46 --- Assets/UIEffect/Editor/UIEffectEditor.cs | 82 ++++++++++++++++++------ Assets/UIEffect/UIEffect.cs | 22 ++++++- 2 files changed, 82 insertions(+), 22 deletions(-) diff --git a/Assets/UIEffect/Editor/UIEffectEditor.cs b/Assets/UIEffect/Editor/UIEffectEditor.cs index 8e62919..f014e7d 100644 --- a/Assets/UIEffect/Editor/UIEffectEditor.cs +++ b/Assets/UIEffect/Editor/UIEffectEditor.cs @@ -11,12 +11,11 @@ namespace Coffee.UIExtensions [CanEditMultipleObjects] public class UIEffectEditor : Editor { - ReorderableList roAdditionalShadows; - SerializedProperty spAdditionalShadows; - SerializedProperty spBlurMode; - + //################################ + // Constant or Static Members. + //################################ /// - /// Implement this function to make a custom inspector. + /// Draw effect properties. /// public static void DrawEffectProperties(string shaderName, SerializedObject serializedObject) { @@ -93,23 +92,46 @@ namespace Coffee.UIExtensions } } + //################################ + // Private Members. + //################################ + ReorderableList _roAdditionalShadows; + SerializedProperty _spAdditionalShadows; + SerializedProperty _spBlurMode; + SerializedProperty _spCustomEffect; + SerializedProperty _spEffectMaterial; + SerializedProperty _spEffectColor; + SerializedProperty _spCustomFactorX; + SerializedProperty _spCustomFactorY; + SerializedProperty _spCustomFactorZ; + SerializedProperty _spCustomFactorW; + void OnEnable() { - spAdditionalShadows = serializedObject.FindProperty("m_AdditionalShadows"); - spBlurMode = serializedObject.FindProperty("m_BlurMode"); + _spAdditionalShadows = serializedObject.FindProperty("m_AdditionalShadows"); + _spBlurMode = serializedObject.FindProperty("m_BlurMode"); + _spEffectColor = serializedObject.FindProperty("m_EffectColor"); - roAdditionalShadows = new ReorderableList(serializedObject, spAdditionalShadows, true, true, true, true); - roAdditionalShadows.drawElementCallback = DrawElementCallback; - roAdditionalShadows.drawHeaderCallback = (rect) => EditorGUI.LabelField(rect, "Additional Shadows"); - roAdditionalShadows.onAddCallback = OnAddCallback; - roAdditionalShadows.elementHeightCallback = ElementHeightCallback; + _spCustomEffect = serializedObject.FindProperty("m_CustomEffect"); + _spEffectMaterial = serializedObject.FindProperty("m_EffectMaterial"); + var spFactor = serializedObject.FindProperty("m_CustomFactor"); + _spCustomFactorX = spFactor.FindPropertyRelative("x"); + _spCustomFactorY = spFactor.FindPropertyRelative("y"); + _spCustomFactorZ = spFactor.FindPropertyRelative("z"); + _spCustomFactorW = spFactor.FindPropertyRelative("w"); + + _roAdditionalShadows = new ReorderableList(serializedObject, _spAdditionalShadows, true, true, true, true); + _roAdditionalShadows.drawElementCallback = DrawElementCallback; + _roAdditionalShadows.drawHeaderCallback = (rect) => EditorGUI.LabelField(rect, "Additional Shadows"); + _roAdditionalShadows.onAddCallback = OnAddCallback; + _roAdditionalShadows.elementHeightCallback = ElementHeightCallback; } void OnAddCallback(ReorderableList ro) { - spAdditionalShadows.InsertArrayElementAtIndex(ro.count); - var element = spAdditionalShadows.GetArrayElementAtIndex(ro.count - 1); + _spAdditionalShadows.InsertArrayElementAtIndex(ro.count); + var element = _spAdditionalShadows.GetArrayElementAtIndex(ro.count - 1); element.FindPropertyRelative("shadowMode").intValue = (int)UIEffect.ShadowStyle.Shadow; element.FindPropertyRelative("shadowColor").colorValue = Color.black; element.FindPropertyRelative("effectDistance").vector2Value = new Vector2(1f, -1f); @@ -119,11 +141,11 @@ namespace Coffee.UIExtensions float ElementHeightCallback(int index) { - var element = spAdditionalShadows.GetArrayElementAtIndex(index); + var element = _spAdditionalShadows.GetArrayElementAtIndex(index); if (element.FindPropertyRelative("shadowMode").intValue == (int)UIEffect.ShadowStyle.None) return 16; - return (spBlurMode.intValue == (int)UIEffect.BlurMode.None ? 66 : 84) + (EditorGUIUtility.wideMode ? 0 : 18); + return (_spBlurMode.intValue == (int)UIEffect.BlurMode.None ? 66 : 84) + (EditorGUIUtility.wideMode ? 0 : 18); } /// @@ -131,7 +153,7 @@ namespace Coffee.UIExtensions /// void DrawElementCallback(Rect rect, int index, bool isActive, bool isFocused) { - var sp = roAdditionalShadows.serializedProperty.GetArrayElementAtIndex(index); + var sp = _roAdditionalShadows.serializedProperty.GetArrayElementAtIndex(index); Rect r = new Rect(rect); r.height = EditorGUIUtility.singleLineHeight; @@ -147,7 +169,7 @@ namespace Coffee.UIExtensions r.y += EditorGUIUtility.wideMode ? r.height : r.height * 2; EditorGUI.PropertyField(r, sp.FindPropertyRelative("useGraphicAlpha")); - if (spBlurMode.intValue != (int)UIEffect.BlurMode.None) + if (_spBlurMode.intValue != (int)UIEffect.BlurMode.None) { r.y += r.height; EditorGUI.PropertyField(r, sp.FindPropertyRelative("shadowBlur")); @@ -160,7 +182,25 @@ namespace Coffee.UIExtensions public override void OnInspectorGUI() { serializedObject.Update(); - DrawEffectProperties(UIEffect.shaderName, serializedObject); + + // Custom effect. + EditorGUILayout.PropertyField(_spCustomEffect); + if(_spCustomEffect.boolValue) + { + EditorGUILayout.PropertyField(_spEffectMaterial); + + EditorGUI.indentLevel++; + EditorGUILayout.Slider(_spCustomFactorX, 0, 1, new GUIContent("Effect Factor X")); + EditorGUILayout.Slider(_spCustomFactorY, 0, 1, new GUIContent("Effect Factor Y")); + EditorGUILayout.Slider(_spCustomFactorZ, 0, 1, new GUIContent("Effect Factor Z")); + EditorGUILayout.Slider(_spCustomFactorW, 0, 1, new GUIContent("Effect Factor W")); + EditorGUILayout.PropertyField(_spEffectColor); + EditorGUI.indentLevel--; + } + else + { + DrawEffectProperties(UIEffect.shaderName, serializedObject); + } //================ // Shadow setting. @@ -176,7 +216,7 @@ namespace Coffee.UIExtensions EditorGUILayout.PropertyField(serializedObject.FindProperty("m_ShadowColor")); EditorGUILayout.PropertyField(serializedObject.FindProperty("m_UseGraphicAlpha")); - if (spBlurMode.intValue != (int)UIEffect.BlurMode.None) + if (_spBlurMode.intValue != (int)UIEffect.BlurMode.None) { EditorGUILayout.PropertyField(serializedObject.FindProperty("m_ShadowBlur")); } @@ -186,7 +226,7 @@ namespace Coffee.UIExtensions //================ // Additional shadow setting. //================ - roAdditionalShadows.DoLayoutList(); + _roAdditionalShadows.DoLayoutList(); serializedObject.ApplyModifiedProperties(); diff --git a/Assets/UIEffect/UIEffect.cs b/Assets/UIEffect/UIEffect.cs index 68f4f2f..bf68985 100644 --- a/Assets/UIEffect/UIEffect.cs +++ b/Assets/UIEffect/UIEffect.cs @@ -127,6 +127,9 @@ namespace Coffee.UIExtensions [SerializeField] List m_AdditionalShadows = new List(); + [SerializeField] bool m_CustomEffect = false; + [SerializeField] Vector4 m_CustomFactor = new Vector4(); + //################################ // Public Members. //################################ @@ -200,6 +203,11 @@ namespace Coffee.UIExtensions /// public List additionalShadows { get { return m_AdditionalShadows; } } + /// + /// Custom effect factor. + /// + public Vector4 customFactor { get { return m_CustomFactor; } set { m_CustomFactor = value; _SetDirty(); } } + /// /// This function is called when the object becomes enabled and active. /// @@ -237,7 +245,7 @@ namespace Coffee.UIExtensions { // Pack some effect factors to 1 float. Vector2 factor = new Vector2( - _PackToFloat(toneLevel, 0, blur, 0), + m_CustomEffect ? _PackToFloat(m_CustomFactor) : _PackToFloat(toneLevel, 0, blur, 0), _PackToFloat(effectColor.r, effectColor.g, effectColor.b, effectColor.a) ); @@ -284,6 +292,9 @@ namespace Coffee.UIExtensions public void OnAfterDeserialize() { + if (m_CustomEffect) + return; + var obj = this; EditorApplication.delayCall += () => { @@ -490,5 +501,14 @@ namespace Coffee.UIExtensions + (Mathf.FloorToInt(y * PRECISION) << 6) + Mathf.FloorToInt(x * PRECISION); } + + /// + /// Pack 4 low-precision [0-1] floats values to a float. + /// Each value [0-1] has 64 steps(6 bits). + /// + static float _PackToFloat(Vector4 factor) + { + return _PackToFloat(Mathf.Clamp01(factor.x), Mathf.Clamp01(factor.y), Mathf.Clamp01(factor.z), Mathf.Clamp01(factor.w)); + } } } From 0ad6bd76939bdd3d1e08f56f8399d4028d7325d1 Mon Sep 17 00:00:00 2001 From: Takashi Sakai Date: Thu, 12 Apr 2018 00:15:30 +0900 Subject: [PATCH 4/9] Fixed: Color effect on shadow is incorrect. #55 --- Assets/UIEffect/UIEffect.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Assets/UIEffect/UIEffect.cs b/Assets/UIEffect/UIEffect.cs index bf68985..965e489 100644 --- a/Assets/UIEffect/UIEffect.cs +++ b/Assets/UIEffect/UIEffect.cs @@ -403,7 +403,7 @@ namespace Coffee.UIExtensions /// Append shadow vertices. /// * It is similar to Shadow component implementation. /// - static void _ApplyShadow(List verts, ref int start, ref int end, ShadowStyle mode, float toneLevel, float blur, Vector2 effectDistance, Color color, bool useGraphicAlpha) + void _ApplyShadow(List verts, ref int start, ref int end, ShadowStyle mode, float toneLevel, float blur, Vector2 effectDistance, Color color, bool useGraphicAlpha) { if (ShadowStyle.None == mode) return; @@ -448,7 +448,7 @@ namespace Coffee.UIExtensions /// Append shadow vertices. /// * It is similar to Shadow component implementation. /// - static void _ApplyShadowZeroAlloc(List verts, ref int start, ref int end, float x, float y, Vector2 factor, Color color, bool useGraphicAlpha) + void _ApplyShadowZeroAlloc(List verts, ref int start, ref int end, float x, float y, Vector2 factor, Color color, bool useGraphicAlpha) { // Check list capacity. var neededCapacity = verts.Count + end - start; @@ -467,6 +467,12 @@ namespace Coffee.UIExtensions vt.position.Set(v.x + x, v.y + y, v.z); Color vertColor = color; + + if(colorMode != ColorMode.None) + { + vertColor.r = vertColor.g = vertColor.b = 1; + } + vertColor.a = useGraphicAlpha ? color.a * vt.color.a / 255 : color.a; vt.color = vertColor; From c78bc86cf1318ed711edd47cfdb05771f4634fc1 Mon Sep 17 00:00:00 2001 From: Takashi Sakai Date: Sat, 7 Apr 2018 12:35:47 +0900 Subject: [PATCH 5/9] Refactor: Add shader struct --- Assets/UIEffect/UI-Effect.shader | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Assets/UIEffect/UI-Effect.shader b/Assets/UIEffect/UI-Effect.shader index bb6b47f..d0ac8c7 100644 --- a/Assets/UIEffect/UI-Effect.shader +++ b/Assets/UIEffect/UI-Effect.shader @@ -85,7 +85,10 @@ Shader "UI/Hidden/UI-Effect" #endif #if defined (UI_TONE) || defined (UI_BLUR) - half3 effectFactor : TEXCOORD2; + half4 effectFactor : TEXCOORD2; + #endif + #if UI_TONE_HUE || UI_TONE_PIXEL + half4 extraFactor : TEXCOORD3; #endif }; @@ -112,10 +115,10 @@ Shader "UI/Hidden/UI-Effect" #endif #if UI_TONE_HUE - OUT.effectFactor.y = sin(OUT.effectFactor.x*3.14159265359*2); - OUT.effectFactor.x = cos(OUT.effectFactor.x*3.14159265359*2); + OUT.extraFactor.x = cos(OUT.effectFactor.x*3.14159265359 * 2); + OUT.extraFactor.y = sin(OUT.effectFactor.x*3.14159265359 * 2); #elif UI_TONE_PIXEL - OUT.effectFactor.xy = max(2, (1-OUT.effectFactor.x) * _MainTex_TexelSize.zw); + OUT.extraFactor.xy = max(2, (1-OUT.effectFactor.x) * _MainTex_TexelSize.zw); #endif #if defined (UI_COLOR) @@ -129,7 +132,7 @@ Shader "UI/Hidden/UI-Effect" fixed4 frag(v2f IN) : SV_Target { #if UI_TONE_PIXEL - IN.texcoord = round(IN.texcoord * IN.effectFactor.xy) / IN.effectFactor.xy; + IN.texcoord = round(IN.texcoord * IN.extraFactor.xy) / IN.extraFactor.xy; #endif #if defined (UI_BLUR) @@ -149,7 +152,7 @@ Shader "UI/Hidden/UI-Effect" color.rgb = IN.color.rgb; color.a = color.a * tex2D(_MainTex, IN.texcoord).a + IN.effectFactor.x * 2 - 1; #elif UI_TONE_HUE - color.rgb = shift_hue(color.rgb, IN.effectFactor.x, IN.effectFactor.y); + color.rgb = shift_hue(color.rgb, IN.extraFactor.x, IN.extraFactor.y); #elif defined (UI_TONE) & !UI_TONE_CUTOFF color = ApplyToneEffect(color, IN.effectFactor.x); #endif From bf8b4833fd07a53d56230f523677046125584f46 Mon Sep 17 00:00:00 2001 From: Takashi Sakai Date: Sat, 7 Apr 2018 12:35:08 +0900 Subject: [PATCH 6/9] Update README --- README.md | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 28cb927..5a0f029 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,16 @@ UIEffect === -UIEffect is an effect component for uGUI. -Controls and manipulate visual effect is very easy! +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-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) -[![](https://img.shields.io/github/last-commit/mob-sakai/UIEffect/develop.svg?label=last%20commit)](https://github.com/mob-sakai/UIEffect/commits/develop) +[![](https://img.shields.io/github/last-commit/mob-sakai/UIEffect/develop.svg?label=last%20commit%20to%20develop)](https://github.com/mob-sakai/UIEffect/commits/develop) [![](https://img.shields.io/github/issues/mob-sakai/UIEffect.svg)](https://github.com/mob-sakai/UIEffect/issues) -[![](https://img.shields.io/github/commits-since/mob-sakai/UIEffect/latest.svg)](https://github.com/mob-sakai/UIEffect/compare/master...develop) + << [Description](#Description) | [WebGL Demo](#demo) | [Download](https://github.com/mob-sakai/UIEffect/releases) | [Usage](#usage) | [Development Note](#development-note) | [Change log](https://github.com/mob-sakai/UIEffect/blob/develop/CHANGELOG.md) >> @@ -48,22 +48,26 @@ Controls and manipulate visual effect is very easy! * Diagonal +### Easy to control effect parameters! + +![image](https://user-images.githubusercontent.com/12690315/38594668-636dd3ac-3d82-11e8-9951-820964a6a95f.gif) + + ### And, more features! * Control the effect parameters without instantiating the material -* Control the effect parameter with AnimationClip +* Control the effect parameters with AnimationClip ![image](https://user-images.githubusercontent.com/12690315/34617750-cf2c9464-f27f-11e7-8ee9-e6be3b209943.gif) * Use for screen transition ![image](https://user-images.githubusercontent.com/12690315/34618554-71a32e40-f282-11e7-8b78-6948c50c6b58.gif) * Multiple shadow effect to reduce rendering vertices ![image](https://user-images.githubusercontent.com/12690315/34552373-600fdab2-f164-11e7-8565-21c15af92a93.png) -* The captured image with effect, like post effect +* UICapturedEffectImage: The captured image with effect, like post effect ![image](https://user-images.githubusercontent.com/12690315/34619147-868cb36a-f284-11e7-8122-b924ff09077f.gif) -* Dialog window with the captured image effect +* UICapturedEffectImage: Dialog window with the captured image effect ![image](https://user-images.githubusercontent.com/12690315/34619468-97e3c134-f285-11e7-90b2-3a75bde13911.gif) -* Change vertex color as gradient, with rotation, offset, color correction -![image](https://user-images.githubusercontent.com/12690315/34931353-b1824df2-fa11-11e7-9dda-18aba10a8607.gif) -![image](https://user-images.githubusercontent.com/12690315/34930676-000c41d4-fa0e-11e7-825b-d5a1e757fea8.png) +* UIGradient: Change vertex color as gradient, with rotation, offset, color correction +![image](https://user-images.githubusercontent.com/12690315/38594997-2a39f03c-3d84-11e8-865d-9ce12a8bb3db.gif) From 537784c0f3e16f66272d89413851477079a03967 Mon Sep 17 00:00:00 2001 From: Takashi Sakai Date: Wed, 11 Apr 2018 12:36:28 +0900 Subject: [PATCH 7/9] Update release script --- release.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/release.sh b/release.sh index 83533f8..4c3eff9 100755 --- a/release.sh +++ b/release.sh @@ -1,8 +1,8 @@ -#!/bin/bash -xe +#!/bin/bash -e # Release the project with the following steps: # 1. Update the release version in package.json. -# 2. Update "CHANGELOG.md" using "github_changelog_generator-1.15.0.pre.beta". +# 2. Update "CHANGELOG.md" using "github_changelog_generator-1.15.0.pre.rc". # 3. Commit package.json and CHANGELOG.md. # 4. Merge into master branch. # 5. Export unitypackage. @@ -26,11 +26,16 @@ sed -i -e "s/\"version\": \(.*\)/\"version\": \"${RELEASE_VERSION}\",/g" package TAG=v$RELEASE_VERSION git tag $TAG git push --tags -github_changelog_generator +github_changelog_generator -t $GITHUB_TOKEN git tag -d $TAG git push --delete origin $TAG +git diff -- CHANGELOG.md +read -p "[? continue? (y/N):" yn +case "$yn" in [yY]*) ;; *) exit ;; esac + + # commit files git add CHANGELOG.md -f git add package.json -f From 49c3855c4919ea593177d9d9499158ae98f932aa Mon Sep 17 00:00:00 2001 From: Takashi Sakai Date: Thu, 12 Apr 2018 01:46:43 +0900 Subject: [PATCH 8/9] Change: Reduce the pixelation effect when tone level = 1. #57 --- Assets/UIEffect/UI-Effect.shader | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/UIEffect/UI-Effect.shader b/Assets/UIEffect/UI-Effect.shader index d0ac8c7..d79b06f 100644 --- a/Assets/UIEffect/UI-Effect.shader +++ b/Assets/UIEffect/UI-Effect.shader @@ -118,7 +118,7 @@ Shader "UI/Hidden/UI-Effect" OUT.extraFactor.x = cos(OUT.effectFactor.x*3.14159265359 * 2); OUT.extraFactor.y = sin(OUT.effectFactor.x*3.14159265359 * 2); #elif UI_TONE_PIXEL - OUT.extraFactor.xy = max(2, (1-OUT.effectFactor.x) * _MainTex_TexelSize.zw); + OUT.extraFactor.xy = max(2, (1-OUT.effectFactor.x*0.98) * _MainTex_TexelSize.zw); #endif #if defined (UI_COLOR) From 2c8b994aa013d754f3254e1053961eddecc67af5 Mon Sep 17 00:00:00 2001 From: Takashi Sakai Date: Thu, 12 Apr 2018 09:12:59 +0900 Subject: [PATCH 9/9] update change log --- CHANGELOG.md | 22 ++++++++++++++++++++-- package.json | 2 +- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c53c19..f4dfea1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,22 @@ -# Change Log +# Changelog + +## [v2.2.0](https://github.com/mob-sakai/UIEffect/tree/v2.2.0) (2018-04-12) + +[Full Changelog](https://github.com/mob-sakai/UIEffect/compare/v2.1.0...v2.2.0) + +**Implemented enhancements:** + +- Feature: Customize shader/material. You can create a custom ui shader and control it with UIEffct. [\#46](https://github.com/mob-sakai/UIEffect/issues/46) +- Feature: UIEffectCapturedImage supports keep canvas size. [\#54](https://github.com/mob-sakai/UIEffect/issues/54) +- Feature: UIEffectCapturedImage supports `Quality Type` to easy setup. [\#53](https://github.com/mob-sakai/UIEffect/issues/53) + +**Fixed bugs:** + +- Bug: Color effect on shadow is incorrect. [\#55](https://github.com/mob-sakai/UIEffect/issues/55) + +**Closed issues:** + +- Change: Reduce the pixelation effect when tone level = 1. [\#57](https://github.com/mob-sakai/UIEffect/issues/57) ## [v2.1.0](https://github.com/mob-sakai/UIEffect/tree/v2.1.0) (2018-04-04) @@ -134,4 +152,4 @@ -\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file +\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file diff --git a/package.json b/package.json index 861a5cb..b961da0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "UIEffect", - "version": "2.1.0", + "version": "2.2.0", "repository": { "type": "git", "url": "git+https://github.com/mob-sakai/UIEffect.git"