From 8e66c3335ec76795cbdeb9c821f017925ba43601 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Guerrero=20Mart=C3=ADnez?= Date: Mon, 30 Aug 2021 11:50:03 +0200 Subject: [PATCH 1/8] Fixes URP depth testing with MSAA and using OutlineLayers (#39) --- .../UnityFx.Outline.URP/Runtime/Scripts/OutlinePass.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Outline.URP/Packages/UnityFx.Outline.URP/Runtime/Scripts/OutlinePass.cs b/Outline.URP/Packages/UnityFx.Outline.URP/Runtime/Scripts/OutlinePass.cs index 14f4d6f..81de878 100644 --- a/Outline.URP/Packages/UnityFx.Outline.URP/Runtime/Scripts/OutlinePass.cs +++ b/Outline.URP/Packages/UnityFx.Outline.URP/Runtime/Scripts/OutlinePass.cs @@ -94,8 +94,9 @@ public override void Execute(ScriptableRenderContext context, ref RenderingData if (_feature.OutlineLayers) { var cmd = CommandBufferPool.Get(OutlineResources.EffectName); + var depthTexture = new RenderTargetIdentifier("_CameraDepthTexture"); - using (var renderer = new OutlineRenderer(cmd, outlineResources, _renderer.cameraColorTarget, _renderer.cameraDepth, camData.cameraTargetDescriptor)) + using (var renderer = new OutlineRenderer(cmd, outlineResources, _renderer.cameraColorTarget, depthTexture /*_renderer.cameraDepth*/, camData.cameraTargetDescriptor)) { _renderObjects.Clear(); _feature.OutlineLayers.GetRenderObjects(_renderObjects); From ebfa7fed68bccece38dfbebed4700d0ad59145bf Mon Sep 17 00:00:00 2001 From: Alexander Bogarsukov Date: Sun, 14 Nov 2021 17:45:49 +0200 Subject: [PATCH 2/8] Enable HDR color pickers for outline settings (fixes #42) --- .../Editor/Scripts/OutlineEditorUtility.cs | 9 ++++ .../Scripts/OutlineLayerCollectionEditor.cs | 10 ++--- .../Editor/Scripts/OutlineSettingsEditor.cs | 41 ++++++++----------- 3 files changed, 32 insertions(+), 28 deletions(-) diff --git a/Outline.Core/Packages/UnityFx.Outline/Editor/Scripts/OutlineEditorUtility.cs b/Outline.Core/Packages/UnityFx.Outline/Editor/Scripts/OutlineEditorUtility.cs index dcb2756..df53c31 100644 --- a/Outline.Core/Packages/UnityFx.Outline/Editor/Scripts/OutlineEditorUtility.cs +++ b/Outline.Core/Packages/UnityFx.Outline/Editor/Scripts/OutlineEditorUtility.cs @@ -11,6 +11,15 @@ namespace UnityFx.Outline { public static class OutlineEditorUtility { + public static readonly GUIContent FilterSettingsContent = new GUIContent("Outline Filter Settings", ""); + public static readonly GUIContent LayerMaskContent = new GUIContent("Layer Mask", OutlineResources.OutlineLayerMaskTooltip); + public static readonly GUIContent RenderingLayerMaskContent = new GUIContent("Rendering Layer Mask", OutlineResources.OutlineRenderingLayerMaskTooltip); + public static readonly GUIContent ColorContent = new GUIContent("Color", "Outline color."); + public static readonly GUIContent WidthContent = new GUIContent("Width", "Outline width in pixels."); + public static readonly GUIContent RenderFlagsContent = new GUIContent("Render Flags", "Outline render flags. Multiple values can be selected at the same time."); + public static readonly GUIContent BlurIntensityContent = new GUIContent("Blur Intensity", "Outline intensity value. It is only usable for blurred outlines."); + public static readonly GUIContent AlphaCutoffContent = new GUIContent("Alpha Cutoff", "Outline alpha cutoff value. It is only usable when alpha testing is enabled and the material doesn't have _Cutoff property."); + public static void RenderPreview(OutlineLayer layer, int layerIndex, bool showObjects) { if (layer != null) diff --git a/Outline.Core/Packages/UnityFx.Outline/Editor/Scripts/OutlineLayerCollectionEditor.cs b/Outline.Core/Packages/UnityFx.Outline/Editor/Scripts/OutlineLayerCollectionEditor.cs index 9a7b838..94e799d 100644 --- a/Outline.Core/Packages/UnityFx.Outline/Editor/Scripts/OutlineLayerCollectionEditor.cs +++ b/Outline.Core/Packages/UnityFx.Outline/Editor/Scripts/OutlineLayerCollectionEditor.cs @@ -128,24 +128,24 @@ private void OnDrawLayer(Rect rect, int index, bool isActive, bool isFocused) { EditorGUI.BeginDisabledGroup(obj != null); - color = EditorGUI.ColorField(new Rect(rect.x, y, rect.width, lineHeight), "Color", color); + color = EditorGUI.ColorField(new Rect(rect.x, y, rect.width, lineHeight), OutlineEditorUtility.ColorContent, color, true, true, true); y += lineOffset; - width = EditorGUI.IntSlider(new Rect(rect.x, y, rect.width, lineHeight), "Width", width, OutlineResources.MinWidth, OutlineResources.MaxWidth); + width = EditorGUI.IntSlider(new Rect(rect.x, y, rect.width, lineHeight), OutlineEditorUtility.WidthContent, width, OutlineResources.MinWidth, OutlineResources.MaxWidth); y += lineOffset; - renderMode = (OutlineRenderFlags)EditorGUI.EnumFlagsField(new Rect(rect.x, y, rect.width, lineHeight), "Render Flags", renderMode); + renderMode = (OutlineRenderFlags)EditorGUI.EnumFlagsField(new Rect(rect.x, y, rect.width, lineHeight), OutlineEditorUtility.RenderFlagsContent, renderMode); y += lineOffset; if ((renderMode & OutlineRenderFlags.Blurred) != 0) { - blurIntensity = EditorGUI.Slider(new Rect(rect.x, y, rect.width, lineHeight), "Blur Intensity", blurIntensity, OutlineResources.MinIntensity, OutlineResources.MaxIntensity); + blurIntensity = EditorGUI.Slider(new Rect(rect.x, y, rect.width, lineHeight), OutlineEditorUtility.BlurIntensityContent, blurIntensity, OutlineResources.MinIntensity, OutlineResources.MaxIntensity); y += lineOffset; } if ((renderMode & OutlineRenderFlags.EnableAlphaTesting) != 0) { - alphaCutoff = EditorGUI.Slider(new Rect(rect.x, y, rect.width, lineHeight), "Alpha Cutoff", alphaCutoff, OutlineResources.MinAlphaCutoff, OutlineResources.MaxAlphaCutoff); + alphaCutoff = EditorGUI.Slider(new Rect(rect.x, y, rect.width, lineHeight), OutlineEditorUtility.AlphaCutoffContent, alphaCutoff, OutlineResources.MinAlphaCutoff, OutlineResources.MaxAlphaCutoff); } EditorGUI.EndDisabledGroup(); diff --git a/Outline.Core/Packages/UnityFx.Outline/Editor/Scripts/OutlineSettingsEditor.cs b/Outline.Core/Packages/UnityFx.Outline/Editor/Scripts/OutlineSettingsEditor.cs index f9a382a..116c7dc 100644 --- a/Outline.Core/Packages/UnityFx.Outline/Editor/Scripts/OutlineSettingsEditor.cs +++ b/Outline.Core/Packages/UnityFx.Outline/Editor/Scripts/OutlineSettingsEditor.cs @@ -22,15 +22,6 @@ public class OutlineSettingsEditor : Editor private const string _cutoffPropName = "_outlineAlphaCutoff"; private const string _renderModePropName = "_outlineMode"; - private static readonly GUIContent _filterModeContent = new GUIContent("Outline Filter Settings", ""); - private static readonly GUIContent _layerMaskContent = new GUIContent("Layer Mask", OutlineResources.OutlineLayerMaskTooltip); - private static readonly GUIContent _renderingLayerMaskContent = new GUIContent("Rendering Layer Mask", OutlineResources.OutlineRenderingLayerMaskTooltip); - private static readonly GUIContent _colorContent = new GUIContent("Color", "Outline color."); - private static readonly GUIContent _widthContent = new GUIContent("Width", "Outline width in pixels."); - private static readonly GUIContent _renderModeContent = new GUIContent("Render Flags", "Outline render flags. Multiple values can be selected at the same time."); - private static readonly GUIContent _intensityContent = new GUIContent("Blur Intensity", "Outline intensity value. It is only usable for blurred outlines."); - private static readonly GUIContent _cutoffContent = new GUIContent("Alpha Cutoff", "Outline alpha cutoff value. It is only usable when alpha testing is enabled and the material doesn't have _Cutoff property."); - public override void OnInspectorGUI() { base.OnInspectorGUI(); @@ -42,20 +33,22 @@ public override void OnInspectorGUI() var renderModeProp = serializedObject.FindProperty(_renderModePropName); var renderMode = (OutlineRenderFlags)renderModeProp.intValue; - EditorGUILayout.PropertyField(colorProp, _colorContent); - EditorGUILayout.PropertyField(widthProp, _widthContent); + //EditorGUILayout.PropertyField(colorProp, _colorContent); + colorProp.colorValue = EditorGUILayout.ColorField(OutlineEditorUtility.ColorContent, colorProp.colorValue, true, true, true); + + EditorGUILayout.PropertyField(widthProp, OutlineEditorUtility.WidthContent); //EditorGUILayout.PropertyField(renderModeProp, _renderModeContent); - renderModeProp.intValue = (int)(OutlineRenderFlags)EditorGUILayout.EnumFlagsField(_renderModeContent, renderMode); + renderModeProp.intValue = (int)(OutlineRenderFlags)EditorGUILayout.EnumFlagsField(OutlineEditorUtility.RenderFlagsContent, renderMode); if ((renderMode & OutlineRenderFlags.Blurred) != 0) { - EditorGUILayout.PropertyField(intensityProp, _intensityContent); + EditorGUILayout.PropertyField(intensityProp, OutlineEditorUtility.BlurIntensityContent); } if ((renderMode & OutlineRenderFlags.EnableAlphaTesting) != 0) { - EditorGUILayout.PropertyField(cutoffProp, _cutoffContent); + EditorGUILayout.PropertyField(cutoffProp, OutlineEditorUtility.AlphaCutoffContent); } serializedObject.ApplyModifiedProperties(); @@ -159,14 +152,14 @@ internal static void DrawSettingsWithMask(Rect rc, SerializedProperty property) var lineCy = EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; var filterModeProp = property.FindPropertyRelative(_filterModePropName); - EditorGUI.PropertyField(new Rect(rc.x, rc.y, rc.width, EditorGUIUtility.singleLineHeight), filterModeProp, _filterModeContent); + EditorGUI.PropertyField(new Rect(rc.x, rc.y, rc.width, EditorGUIUtility.singleLineHeight), filterModeProp, OutlineEditorUtility.FilterSettingsContent); if (filterModeProp.intValue == (int)OutlineFilterMode.UseLayerMask) { var layerMaskProp = property.FindPropertyRelative(_layerMaskPropName); EditorGUI.indentLevel += 1; - EditorGUI.PropertyField(new Rect(rc.x, rc.y + lineCy, rc.width, EditorGUIUtility.singleLineHeight), layerMaskProp, _layerMaskContent); + EditorGUI.PropertyField(new Rect(rc.x, rc.y + lineCy, rc.width, EditorGUIUtility.singleLineHeight), layerMaskProp, OutlineEditorUtility.LayerMaskContent); EditorGUI.indentLevel -= 1; DrawSettingsInstance(new Rect(rc.x, rc.y + lineCy * 2, rc.width, rc.height - lineCy), property); @@ -176,10 +169,10 @@ internal static void DrawSettingsWithMask(Rect rc, SerializedProperty property) var renderingLayerMaskProp = property.FindPropertyRelative(_renderingLayerMaskPropName); EditorGUI.indentLevel += 1; - EditorGUI.PropertyField(new Rect(rc.x, rc.y + lineCy, rc.width, EditorGUIUtility.singleLineHeight), renderingLayerMaskProp, _renderingLayerMaskContent); + EditorGUI.PropertyField(new Rect(rc.x, rc.y + lineCy, rc.width, EditorGUIUtility.singleLineHeight), renderingLayerMaskProp, OutlineEditorUtility.RenderingLayerMaskContent); EditorGUI.indentLevel -= 1; - DrawSettingsInstance(new Rect(rc.x, rc.y + lineCy * 2, rc.width, rc.height - lineCy), property); + DrawSettingsInstance(new Rect(rc.x, rc.y + lineCy * 2, rc.width, rc.height - lineCy), property); } } @@ -189,20 +182,22 @@ private static void DrawSettingsInternal(Rect rc, SerializedProperty colorProp, var lineCy = EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; var n = 4; - EditorGUI.PropertyField(new Rect(rc.x, rc.y + 1 * lineCy, rc.width, EditorGUIUtility.singleLineHeight), colorProp, _colorContent); - EditorGUI.PropertyField(new Rect(rc.x, rc.y + 2 * lineCy, rc.width, EditorGUIUtility.singleLineHeight), widthProp, _widthContent); + //EditorGUI.PropertyField(new Rect(rc.x, rc.y + 1 * lineCy, rc.width, EditorGUIUtility.singleLineHeight), colorProp, _colorContent); + colorProp.colorValue = EditorGUI.ColorField(new Rect(rc.x, rc.y + 1 * lineCy, rc.width, EditorGUIUtility.singleLineHeight), OutlineEditorUtility.ColorContent, colorProp.colorValue, true, true, true); + + EditorGUI.PropertyField(new Rect(rc.x, rc.y + 2 * lineCy, rc.width, EditorGUIUtility.singleLineHeight), widthProp, OutlineEditorUtility.WidthContent); // NOTE: EditorGUI.PropertyField doesn't allow multi-selection, have to use EnumFlagsField explixitly. - renderModeProp.intValue = (int)(OutlineRenderFlags)EditorGUI.EnumFlagsField(new Rect(rc.x, rc.y + 3 * lineCy, rc.width, EditorGUIUtility.singleLineHeight), _renderModeContent, renderMode); + renderModeProp.intValue = (int)(OutlineRenderFlags)EditorGUI.EnumFlagsField(new Rect(rc.x, rc.y + 3 * lineCy, rc.width, EditorGUIUtility.singleLineHeight), OutlineEditorUtility.RenderFlagsContent, renderMode); if ((renderMode & OutlineRenderFlags.Blurred) != 0) { - EditorGUI.PropertyField(new Rect(rc.x, rc.y + n++ * lineCy, rc.width, EditorGUIUtility.singleLineHeight), intensityProp, _intensityContent); + EditorGUI.PropertyField(new Rect(rc.x, rc.y + n++ * lineCy, rc.width, EditorGUIUtility.singleLineHeight), intensityProp, OutlineEditorUtility.BlurIntensityContent); } if ((renderMode & OutlineRenderFlags.EnableAlphaTesting) != 0) { - EditorGUI.PropertyField(new Rect(rc.x, rc.y + n * lineCy, rc.width, EditorGUIUtility.singleLineHeight), cutoffProp, _cutoffContent); + EditorGUI.PropertyField(new Rect(rc.x, rc.y + n * lineCy, rc.width, EditorGUIUtility.singleLineHeight), cutoffProp, OutlineEditorUtility.AlphaCutoffContent); } } } From 0f47d8dfee2f125626661d31021f4d8d4c813f39 Mon Sep 17 00:00:00 2001 From: Alexander Bogarsukov Date: Sun, 14 Nov 2021 17:55:36 +0200 Subject: [PATCH 3/8] Comment BeginSample/EndSample calls to avoid editor errors (#44) --- .../Scripts/Rendering/OutlineRenderer.cs | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/Outline.Core/Packages/UnityFx.Outline/Runtime/Scripts/Rendering/OutlineRenderer.cs b/Outline.Core/Packages/UnityFx.Outline/Runtime/Scripts/Rendering/OutlineRenderer.cs index 54cd213..3a351ed 100644 --- a/Outline.Core/Packages/UnityFx.Outline/Runtime/Scripts/Rendering/OutlineRenderer.cs +++ b/Outline.Core/Packages/UnityFx.Outline/Runtime/Scripts/Rendering/OutlineRenderer.cs @@ -263,12 +263,13 @@ public void Render(IReadOnlyList renderers, IOutlineSettings settings, if (renderers.Count > 0) { - if (string.IsNullOrEmpty(sampleName)) - { - sampleName = renderers[0].name; - } + // NOTE: Remove BeginSample/EndSample for now (https://github.com/Arvtesh/UnityFx.Outline/issues/44). + //if (string.IsNullOrEmpty(sampleName)) + //{ + // sampleName = renderers[0].name; + //} - _commandBuffer.BeginSample(sampleName); + //_commandBuffer.BeginSample(sampleName); { RenderObjectClear(settings.OutlineRenderMode); @@ -279,7 +280,7 @@ public void Render(IReadOnlyList renderers, IOutlineSettings settings, RenderOutline(settings); } - _commandBuffer.EndSample(sampleName); + //_commandBuffer.EndSample(sampleName); } } @@ -303,18 +304,20 @@ public void Render(Renderer renderer, IOutlineSettings settings, string sampleNa throw new ArgumentNullException(nameof(settings)); } - if (string.IsNullOrEmpty(sampleName)) - { - sampleName = renderer.name; - } + // NOTE: Remove BeginSample/EndSample for now (https://github.com/Arvtesh/UnityFx.Outline/issues/44). + //if (string.IsNullOrEmpty(sampleName)) + //{ + // sampleName = renderer.name; + //} - _commandBuffer.BeginSample(sampleName); + // NOTE: Remove this for now (https://github.com/Arvtesh/UnityFx.Outline/issues/44). + //_commandBuffer.BeginSample(sampleName); { RenderObjectClear(settings.OutlineRenderMode); DrawRenderer(renderer, settings); RenderOutline(settings); } - _commandBuffer.EndSample(sampleName); + //_commandBuffer.EndSample(sampleName); } /// From 97793c8de78171931690aeca67a19a72e0171bf6 Mon Sep 17 00:00:00 2001 From: Alexander Bogarsukov Date: Sun, 14 Nov 2021 19:24:54 +0200 Subject: [PATCH 4/8] Outline shader optimization, add loop unroll statement (fixes #45) --- .../Runtime/Scripts/OutlineResources.cs | 3 +++ .../Runtime/Shaders/Outline.shader | 21 +++++++++++++++++-- .../Runtime/Shaders/Outline.URP.shader | 21 +++++++++++++++++-- 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/Outline.Core/Packages/UnityFx.Outline/Runtime/Scripts/OutlineResources.cs b/Outline.Core/Packages/UnityFx.Outline/Runtime/Scripts/OutlineResources.cs index f721ccc..d425b37 100644 --- a/Outline.Core/Packages/UnityFx.Outline/Runtime/Scripts/OutlineResources.cs +++ b/Outline.Core/Packages/UnityFx.Outline/Runtime/Scripts/OutlineResources.cs @@ -44,6 +44,9 @@ public sealed class OutlineResources : ScriptableObject /// /// Maximum value of outline width parameter. /// + /// + /// If the value is changed here, it should be adjusted in Outline.shader as well. + /// /// public const int MaxWidth = 32; diff --git a/Outline.Core/Packages/UnityFx.Outline/Runtime/Shaders/Outline.shader b/Outline.Core/Packages/UnityFx.Outline/Runtime/Shaders/Outline.shader index 63cbdcc..a66592a 100644 --- a/Outline.Core/Packages/UnityFx.Outline/Runtime/Shaders/Outline.shader +++ b/Outline.Core/Packages/UnityFx.Outline/Runtime/Shaders/Outline.shader @@ -64,17 +64,34 @@ Shader "Hidden/UnityFx/Outline" #endif + float CalcIntensityN0(float2 uv, float2 offset, int k) + { + return SAMPLE_TEXTURE2D_X(_MainTex, sampler_MainTex, uv + k * offset).r * _GaussSamples[k]; + } + + float CalcIntensityN1(float2 uv, float2 offset, int k) + { + return SAMPLE_TEXTURE2D_X(_MainTex, sampler_MainTex, uv - k * offset).r * _GaussSamples[k]; + } + float CalcIntensity(float2 uv, float2 offset) { float intensity = 0; // Accumulates horizontal or vertical blur intensity for the specified texture position. // Set offset = (tx, 0) for horizontal sampling and offset = (0, ty) for vertical. - for (int k = -_Width; k <= _Width; ++k) + // + // NOTE: Unroll directive is needed to make the method function on platforms like WebGL 1.0 where loops are not supported. + // If maximum outline width is changed here, it should be changed in OutlineResources.MaxWidth as well. + // + [unroll(32)] + for (int k = 1; k <= _Width; ++k) { - intensity += UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv + k * offset).r * _GaussSamples[abs(k)]; + intensity += CalcIntensityN0(uv, offset, k); + intensity += CalcIntensityN1(uv, offset, k); } + intensity += CalcIntensityN0(uv, offset, 0); return intensity; } diff --git a/Outline.URP/Packages/UnityFx.Outline.URP/Runtime/Shaders/Outline.URP.shader b/Outline.URP/Packages/UnityFx.Outline.URP/Runtime/Shaders/Outline.URP.shader index 7840e26..ff05f0e 100644 --- a/Outline.URP/Packages/UnityFx.Outline.URP/Runtime/Shaders/Outline.URP.shader +++ b/Outline.URP/Packages/UnityFx.Outline.URP/Runtime/Shaders/Outline.URP.shader @@ -75,17 +75,34 @@ Shader "Hidden/UnityFx/Outline.URP" #endif + float CalcIntensityN0(float2 uv, float2 offset, int k) + { + return SAMPLE_TEXTURE2D_X(_MainTex, sampler_MainTex, uv + k * offset).r * _GaussSamples[k]; + } + + float CalcIntensityN1(float2 uv, float2 offset, int k) + { + return SAMPLE_TEXTURE2D_X(_MainTex, sampler_MainTex, uv - k * offset).r * _GaussSamples[k]; + } + float CalcIntensity(float2 uv, float2 offset) { float intensity = 0; // Accumulates horizontal or vertical blur intensity for the specified texture position. // Set offset = (tx, 0) for horizontal sampling and offset = (0, ty) for vertical. - for (int k = -_Width; k <= _Width; ++k) + // + // NOTE: Unroll directive is needed to make the method function on platforms like WebGL 1.0 where loops are not supported. + // If maximum outline width is changed here, it should be changed in OutlineResources.MaxWidth as well. + // + [unroll(32)] + for (int k = 1; k <= _Width; ++k) { - intensity += SAMPLE_TEXTURE2D_X(_MainTex, sampler_MainTex, uv + k * offset).r * _GaussSamples[abs(k)]; + intensity += CalcIntensityN0(uv, offset, k); + intensity += CalcIntensityN1(uv, offset, k); } + intensity += CalcIntensityN0(uv, offset, 0); return intensity; } From 987281c6bf5a87cf92daaaa027dfebe0dc135ac5 Mon Sep 17 00:00:00 2001 From: Alexander Bogarsukov Date: Sun, 14 Nov 2021 20:05:38 +0200 Subject: [PATCH 5/8] CHANGELOG/README updates --- CHANGELOG.md | 13 +++++++++++++ Outline.Core/Packages/UnityFx.Outline/CHANGELOG.md | 10 ++++++++++ Outline.Core/Packages/UnityFx.Outline/package.json | 2 +- .../Packages/UnityFx.Outline.URP/CHANGELOG.md | 12 ++++++++++++ .../Packages/UnityFx.Outline.URP/package.json | 4 ++-- README.md | 5 +++-- 6 files changed, 41 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f6152f4..c101a54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,20 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/); this project adheres to [Semantic Versioning](http://semver.org/). +## [0.8.5] - pending + +Bugfixes and improvements. + +### Added +- Added support for HDR color pickers ([#42](https://github.com/Arvtesh/UnityFx.Outline/issues/42)). + +### Fixed +- Fixed URP depth testing with MSAA enabled when using `OutlineLayerCollection`, thanks @AGM-GR for the help ([#39](https://github.com/Arvtesh/UnityFx.Outline/issues/39)). +- Added loop unroll statement to make shaders compatible with some platforms (WebGL 1.0) ([#45](https://github.com/Arvtesh/UnityFx.Outline/issues/45)). +- Removed `BeginSample`/`EndSample` profiler calls when rendering outlines to get rid of the editor errors ([#44](https://github.com/Arvtesh/UnityFx.Outline/issues/44)). + ## [0.8.4] - 2021.08.17 + Misc improvements. ### Added diff --git a/Outline.Core/Packages/UnityFx.Outline/CHANGELOG.md b/Outline.Core/Packages/UnityFx.Outline/CHANGELOG.md index 59b696d..5326675 100644 --- a/Outline.Core/Packages/UnityFx.Outline/CHANGELOG.md +++ b/Outline.Core/Packages/UnityFx.Outline/CHANGELOG.md @@ -3,6 +3,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/); this project adheres to [Semantic Versioning](http://semver.org/). +## [0.8.5] - pending + +Bugfixes and improvements. + +### Added +- Added support for HDR color pickers ([#42](https://github.com/Arvtesh/UnityFx.Outline/issues/42)). + +### Fixed +- Added loop unroll statement to make shaders compatible with some platforms (WebGL 1.0) ([#45](https://github.com/Arvtesh/UnityFx.Outline/issues/45)). + ## [0.8.4] - 2021.08.17 Misc improvements. diff --git a/Outline.Core/Packages/UnityFx.Outline/package.json b/Outline.Core/Packages/UnityFx.Outline/package.json index 8984b03..99bc8c6 100644 --- a/Outline.Core/Packages/UnityFx.Outline/package.json +++ b/Outline.Core/Packages/UnityFx.Outline/package.json @@ -1,6 +1,6 @@ { "name": "com.unityfx.outline", - "version": "0.8.4", + "version": "0.8.5", "displayName": "Outline toolkit", "description": "This package contains configurable per-object and per-camera outline effect implementation for built-in render pipeline. Both solid and blurred outline modes are supported (Gauss blur), as well as depth testing. Reusable and extensible API.", "unity": "2018.4", diff --git a/Outline.URP/Packages/UnityFx.Outline.URP/CHANGELOG.md b/Outline.URP/Packages/UnityFx.Outline.URP/CHANGELOG.md index 3b54861..1fe133f 100644 --- a/Outline.URP/Packages/UnityFx.Outline.URP/CHANGELOG.md +++ b/Outline.URP/Packages/UnityFx.Outline.URP/CHANGELOG.md @@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/); this project adheres to [Semantic Versioning](http://semver.org/). +## [0.5.0] - pending + +Bugfixes and improvements. + +### Added +- Added support for HDR color pickers ([#42](https://github.com/Arvtesh/UnityFx.Outline/issues/42)). + +### Fixed +- Fixed URP depth testing with MSAA enabled when using `OutlineLayerCollection`, thanks @AGM-GR for the help ([#39](https://github.com/Arvtesh/UnityFx.Outline/issues/39)). +- Added loop unroll statement to make shaders compatible with some platforms (WebGL 1.0) ([#45](https://github.com/Arvtesh/UnityFx.Outline/issues/45)). +- Removed `BeginSample`/`EndSample` profiler calls when rendering outlines to get rid of the editor errors ([#44](https://github.com/Arvtesh/UnityFx.Outline/issues/44)). + ## [0.4.0] - 2021.08.17 Misc improvements. diff --git a/Outline.URP/Packages/UnityFx.Outline.URP/package.json b/Outline.URP/Packages/UnityFx.Outline.URP/package.json index c32398b..8cf173e 100644 --- a/Outline.URP/Packages/UnityFx.Outline.URP/package.json +++ b/Outline.URP/Packages/UnityFx.Outline.URP/package.json @@ -1,11 +1,11 @@ { "name": "com.unityfx.outline.urp", - "version": "0.4.0", + "version": "0.5.0", "displayName": "Outline toolkit (URP)", "description": "This package contains configurable outline implementation for Universal Render Pipeline.", "unity": "2019.4", "dependencies": { - "com.unityfx.outline": "0.8.4", + "com.unityfx.outline": "0.8.5", "com.unity.render-pipelines.universal": "7.0.0" }, "keywords": [ diff --git a/README.md b/README.md index bcb45b4..cd4e3f5 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ Supported platforms: - Windows/Mac standalone; - Android; - iOS; +- WebGL; - Other platforms (untested). Please see [CHANGELOG](CHANGELOG.md) for information on recent changes. @@ -68,8 +69,8 @@ Npm core package is available at [npmjs.com](https://www.npmjs.com/package/com.u } ], "dependencies": { - "com.unityfx.outline": "0.8.4", - "com.unityfx.outline.urp": "0.4.0", + "com.unityfx.outline": "0.8.5", + "com.unityfx.outline.urp": "0.5.0", } } ``` From 25a8cb18a273f34d31f0aafcf9816e63002cf79d Mon Sep 17 00:00:00 2001 From: Alexander Bogarsukov Date: Wed, 17 Nov 2021 22:55:15 +0200 Subject: [PATCH 6/8] Fix typo in shader --- .../Packages/UnityFx.Outline/Runtime/Shaders/Outline.shader | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Outline.Core/Packages/UnityFx.Outline/Runtime/Shaders/Outline.shader b/Outline.Core/Packages/UnityFx.Outline/Runtime/Shaders/Outline.shader index a66592a..41f6332 100644 --- a/Outline.Core/Packages/UnityFx.Outline/Runtime/Shaders/Outline.shader +++ b/Outline.Core/Packages/UnityFx.Outline/Runtime/Shaders/Outline.shader @@ -66,12 +66,12 @@ Shader "Hidden/UnityFx/Outline" float CalcIntensityN0(float2 uv, float2 offset, int k) { - return SAMPLE_TEXTURE2D_X(_MainTex, sampler_MainTex, uv + k * offset).r * _GaussSamples[k]; + return UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv + k * offset).r * _GaussSamples[k]; } float CalcIntensityN1(float2 uv, float2 offset, int k) { - return SAMPLE_TEXTURE2D_X(_MainTex, sampler_MainTex, uv - k * offset).r * _GaussSamples[k]; + return UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, uv - k * offset).r * _GaussSamples[k]; } float CalcIntensity(float2 uv, float2 offset) From 501e2714cd4c88376aca7cdb58b2a9590f5b30b2 Mon Sep 17 00:00:00 2001 From: Alexander Bogarsukov Date: Thu, 18 Nov 2021 21:31:00 +0200 Subject: [PATCH 7/8] CHANGELOG updates --- CHANGELOG.md | 2 +- Outline.Core/Packages/UnityFx.Outline/CHANGELOG.md | 2 +- Outline.URP/Packages/UnityFx.Outline.URP/CHANGELOG.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c101a54..5b3256b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/); this project adheres to [Semantic Versioning](http://semver.org/). -## [0.8.5] - pending +## [0.8.5] - 2021.11.18 Bugfixes and improvements. diff --git a/Outline.Core/Packages/UnityFx.Outline/CHANGELOG.md b/Outline.Core/Packages/UnityFx.Outline/CHANGELOG.md index 5326675..c3599af 100644 --- a/Outline.Core/Packages/UnityFx.Outline/CHANGELOG.md +++ b/Outline.Core/Packages/UnityFx.Outline/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/); this project adheres to [Semantic Versioning](http://semver.org/). -## [0.8.5] - pending +## [0.8.5] - 2021.11.18 Bugfixes and improvements. diff --git a/Outline.URP/Packages/UnityFx.Outline.URP/CHANGELOG.md b/Outline.URP/Packages/UnityFx.Outline.URP/CHANGELOG.md index 1fe133f..77008a1 100644 --- a/Outline.URP/Packages/UnityFx.Outline.URP/CHANGELOG.md +++ b/Outline.URP/Packages/UnityFx.Outline.URP/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/); this project adheres to [Semantic Versioning](http://semver.org/). -## [0.5.0] - pending +## [0.5.0] - 2021.11.18 Bugfixes and improvements. From e585221e544b46cc16c46d647b68f57612128f44 Mon Sep 17 00:00:00 2001 From: Alexander Bogarsukov Date: Thu, 18 Nov 2021 21:31:12 +0200 Subject: [PATCH 8/8] Fix package reference --- Outline.URP/Packages/packages-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Outline.URP/Packages/packages-lock.json b/Outline.URP/Packages/packages-lock.json index 51ddcf9..62446e5 100644 --- a/Outline.URP/Packages/packages-lock.json +++ b/Outline.URP/Packages/packages-lock.json @@ -84,7 +84,7 @@ "depth": 0, "source": "embedded", "dependencies": { - "com.unityfx.outline": "0.8.3", + "com.unityfx.outline": "0.8.5", "com.unity.render-pipelines.universal": "7.0.0" } },