diff --git a/Packages/com.unity.render-pipelines.core/CHANGELOG.md b/Packages/com.unity.render-pipelines.core/CHANGELOG.md index d8f904c7a13..bc9c177054a 100644 --- a/Packages/com.unity.render-pipelines.core/CHANGELOG.md +++ b/Packages/com.unity.render-pipelines.core/CHANGELOG.md @@ -10,6 +10,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. Version Updated The version number for this package has increased due to a version update of a related graphics package. +## [17.4.0] - 2025-10-22 + +This version is compatible with Unity 6000.4.0a4. +For the release notes, refer to the [Unity download archive](https://unity.com/releases/editor/archive). + ## [17.3.0] - 2025-08-27 This version is compatible with Unity 6000.3.0b1. diff --git a/Packages/com.unity.render-pipelines.core/Documentation~/Images/Preferences/PopUpAdvanced.png b/Packages/com.unity.render-pipelines.core/Documentation~/Images/Preferences/PopUpAdvanced.png index b26b2626580..afa3fface6b 100644 Binary files a/Packages/com.unity.render-pipelines.core/Documentation~/Images/Preferences/PopUpAdvanced.png and b/Packages/com.unity.render-pipelines.core/Documentation~/Images/Preferences/PopUpAdvanced.png differ diff --git a/Packages/com.unity.render-pipelines.core/Documentation~/TableOfContents.md b/Packages/com.unity.render-pipelines.core/Documentation~/TableOfContents.md index 97e576f1ccf..a027111c0af 100644 --- a/Packages/com.unity.render-pipelines.core/Documentation~/TableOfContents.md +++ b/Packages/com.unity.render-pipelines.core/Documentation~/TableOfContents.md @@ -36,6 +36,7 @@ * [Customize the UI of a setting](customize-ui-for-a-setting.md) * [Get custom graphics settings](get-custom-graphics-settings.md) * [Include or exclude a setting in your build](choose-whether-unity-includes-a-graphics-setting-in-your-build.md) + * [Advanced Properties](advanced-properties.md) * [Shaders](shaders.md) * [Use shader methods from the SRP Core shader library](built-in-shader-methods.md) * [Synchronizing shader code and C#](generating-shader-includes.md) diff --git a/Packages/com.unity.render-pipelines.core/Documentation~/advanced-properties.md b/Packages/com.unity.render-pipelines.core/Documentation~/advanced-properties.md index 7796caa848f..79fa09eb1b4 100644 --- a/Packages/com.unity.render-pipelines.core/Documentation~/advanced-properties.md +++ b/Packages/com.unity.render-pipelines.core/Documentation~/advanced-properties.md @@ -12,7 +12,7 @@ There is a global state per user that stores if Unity displays **advanced proper ## Exposing advanced properties within the inspector Not every component or Volume Override includes advanced properties. -If one does, it has a contextual menu to the right of each property section header that includes additional properties. To expose advanced properties for that section, open the contextual menu and click **Advanced Properties**. +If one does, it has a contextual menu to the right of each property section header that includes additional properties. To expose advanced properties for that section, open the contextual menu and click **Show All Advanced Properties**. For an example, refer to the **Water Surface** component in [High Definition Render Pipeline (HDRP)](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest?subfolder=/manual/settings-and-properties-related-to-the-water-system.html). @@ -20,7 +20,7 @@ By default only standard properties are shown. ![](Images/Preferences/HDRP_WaterSurface_General.png) -When you select **Advanced Properties**: +When you select **Show All Advanced Properties**: ![](Images/Preferences/PopUpAdvanced.png) @@ -28,13 +28,13 @@ When you select **Advanced Properties**: ![](Images/Preferences/HDRP_WaterSurface_General_Visible.png) -For Volume Overrides, the already existing contextual menu has a **Advanced Properties** toggle as well. +For Volume Overrides, the already existing contextual menu has a **Show All Advanced Properties** toggle as well. ## Exposing advanced properties on preferences You can also access to this global preference by: -1. Open the **Graphics** tab in the **Preferences** window (menu: **Edit > Preferences > Graphics**). -2. Under **Properties**. Set **Advanced Properties** to **All Visible**. +1. Open the **Graphics** tab in the **Preferences** window (menu: **Edit > Preferences**, macOS: **Unity > Settings**). +2. Under **Graphics**, select **Properties**. Set **Advanced Properties** to **All Visible**. ![](Images/Preferences/AdvancedProperties_Settings.png) diff --git a/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/ConverterItemState.cs b/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/ConverterItemState.cs new file mode 100644 index 00000000000..20ccab79b56 --- /dev/null +++ b/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/ConverterItemState.cs @@ -0,0 +1,38 @@ +using System; +using UnityEngine.UIElements; + +namespace UnityEditor.Rendering.Converter +{ + // This is the serialized class that stores the state of each item in the list of items to convert + [Serializable] + class ConverterItemState + { + public Action onIsSelectedChanged; + private bool m_IsSelected; + public bool isSelected + { + get => m_IsSelected; + set + { + if (m_IsSelected != value) + { + m_IsSelected = value; + onIsSelectedChanged?.Invoke(m_IsSelected); + } + } + } + public IRenderPipelineConverterItem item; + public (Status Status, string Message) conversionResult = (Status.Pending, string.Empty); + internal bool hasConverted => conversionResult.Status != Status.Pending; + + public void OnSelectionChanged(ClickEvent _) + { + isSelected = !isSelected; + } + + public void OnClicked(ClickEvent _) + { + item.OnClicked(); + } + } +} diff --git a/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/ConverterItemState.cs.meta b/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/ConverterItemState.cs.meta new file mode 100644 index 00000000000..bc304d26bef --- /dev/null +++ b/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/ConverterItemState.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 5ed807b57ecd84149ae57fbff12fd1b6 \ No newline at end of file diff --git a/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/ConverterState.cs b/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/ConverterState.cs new file mode 100644 index 00000000000..ef31c5175ae --- /dev/null +++ b/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/ConverterState.cs @@ -0,0 +1,118 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UIElements; + +namespace UnityEditor.Rendering.Converter +{ + [Flags] + internal enum DisplayFilter + { + None = 0, + Pending = (1 << Status.Pending), + Warnings = (1 << Status.Warning), + Errors = (1 << Status.Error), + Success = (1 << Status.Success), + All = Pending | Warnings | Errors | Success + } + + // Each converter uses the active bool + // Each converter has a list of active items/assets + // We do this so that we can use the binding system of the UI Elements + [Serializable] + class ConverterState + { + public bool isExpanded; + public bool isSelected; + public bool isLoading; // to name + public bool isInitialized; + public List items = new List(); + [SerializeReference] + public IRenderPipelineConverter converter; + + public DisplayFilter currentFilter = DisplayFilter.All; + public IList> filteredItems = new List>(); + + private int CountItemWithFlag(Status status) + { + int count = 0; + foreach (ConverterItemState itemState in items) + { + if (itemState.conversionResult.Status == status) + { + count++; + } + } + return count; + } + public int pending => CountItemWithFlag(Status.Pending); + public int warnings => CountItemWithFlag(Status.Warning); + public int errors => CountItemWithFlag(Status.Error); + public int success => CountItemWithFlag(Status.Success); + + public override string ToString() + { + return $"Warnings: {warnings} - Errors: {errors} - Ok: {success} - Total: {items?.Count ?? 0}"; + } + + public void Clear() + { + isInitialized = false; + items.Clear(); + filteredItems.Clear(); + } + + private bool IsVisible(DisplayFilter filter) + { + return (currentFilter & filter) == filter; + } + + internal bool ShouldInclude(ConverterItemState converterItemState) + { + return converterItemState.conversionResult.Status switch + { + Status.Pending => IsVisible(DisplayFilter.Pending), + Status.Warning => IsVisible(DisplayFilter.Warnings), + Status.Error => IsVisible(DisplayFilter.Errors), + Status.Success => IsVisible(DisplayFilter.Success), + _ => false + }; + } + + internal void AddItem(ConverterItemState converterItemState) + { + items.Add(converterItemState); + if (ShouldInclude(converterItemState)) + { + filteredItems.Add(new TreeViewItemData(filteredItems.Count, converterItemState)); + } + } + + internal void ApplyFilter() + { + filteredItems.Clear(); + + foreach (var item in items) + { + if (IsVisible((DisplayFilter)(1 << (int)item.conversionResult.Status))) + filteredItems.Add(new TreeViewItemData(filteredItems.Count, item)); + } + } + + public int selectedItemsCount + { + get + { + int count = 0; + foreach (ConverterItemState itemState in items) + { + if (itemState.isSelected) + { + count++; + } + } + return count; + } + } + } +} diff --git a/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/ConverterState.cs.meta b/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/ConverterState.cs.meta new file mode 100644 index 00000000000..5d4abb3f003 --- /dev/null +++ b/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/ConverterState.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 19f4bae4c0e03c94288f7f2bed653a8c \ No newline at end of file diff --git a/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/IRenderPipelineConverter.cs b/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/IRenderPipelineConverter.cs index 622a8c6a819..6a8694f9fc2 100644 --- a/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/IRenderPipelineConverter.cs +++ b/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/IRenderPipelineConverter.cs @@ -11,12 +11,12 @@ interface IRenderPipelineConverter /// /// Gets a value indicating whether the converter is enabled and can be used. /// - bool isEnabled { get; } + bool isEnabled => true; /// /// Gets or sets the reason message shown when the converter item is disabled. /// - string isDisabledMessage { get; } + string isDisabledMessage => string.Empty; /// /// Scans for available render pipeline converter items. diff --git a/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/IRenderPipelineConverterItem.cs b/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/IRenderPipelineConverterItem.cs index a38252ec220..67dabc0a8e6 100644 --- a/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/IRenderPipelineConverterItem.cs +++ b/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/IRenderPipelineConverterItem.cs @@ -1,3 +1,5 @@ +using UnityEngine; + namespace UnityEditor.Rendering.Converter { /// @@ -25,6 +27,8 @@ interface IRenderPipelineConverterItem /// string isDisabledMessage { get; set; } + Texture2D icon => null; + /// /// Invoked when the converter item is clicked or activated. /// diff --git a/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/RenderPipelineConverterAssetItem.cs b/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/RenderPipelineConverterAssetItem.cs index d6e8bd0d2df..81b07d5208f 100644 --- a/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/RenderPipelineConverterAssetItem.cs +++ b/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/RenderPipelineConverterAssetItem.cs @@ -10,12 +10,42 @@ internal class RenderPipelineConverterAssetItem : IRenderPipelineConverterItem public string assetPath { get; } public string guid { get; } - public string name => assetPath; + public string name + { + get + { + var obj = LoadObject(); + if (obj != null) + return obj.name; + + // Fallback to asset path name + return System.IO.Path.GetFileNameWithoutExtension(assetPath); + } + } + + public string info => assetPath; - public string info => guid; + public bool isEnabled { get; set; } = true; + public string isDisabledMessage { get; set; } = string.Empty; - public bool isEnabled { get; set; } - public string isDisabledMessage { get; set; } + public Texture2D icon + { + get + { + var obj = LoadObject(); + if (obj == null) + return null; + + // Try the object's thumbnail/icon + var icon = AssetPreview.GetMiniThumbnail(obj); + if (icon != null) return icon; + + // Fallback to type icon + var type = obj.GetType(); + icon = EditorGUIUtility.ObjectContent(null, type).image as Texture2D; + return icon; + } + } public RenderPipelineConverterAssetItem(string id) { @@ -79,7 +109,9 @@ public UnityEngine.Object LoadObject() public void OnClicked() { - EditorGUIUtility.PingObject(AssetDatabase.LoadAssetAtPath(assetPath)); + var obj = LoadObject(); + if (obj != null) + EditorGUIUtility.PingObject(obj); } } } diff --git a/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/RenderPipelineConverterMaterialUpgrader.cs b/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/RenderPipelineConverterMaterialUpgrader.cs index f2b987ba6e1..7029e50ddc8 100644 --- a/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/RenderPipelineConverterMaterialUpgrader.cs +++ b/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/RenderPipelineConverterMaterialUpgrader.cs @@ -1,43 +1,90 @@ using System; using System.Collections.Generic; -using System.Text; using UnityEngine; +using UnityEngine.Pool; +using static UnityEditor.Rendering.MaterialUpgrader; namespace UnityEditor.Rendering.Converter { [Serializable] - internal abstract class RenderPipelineConverterMaterialUpgrader : AssetsConverter + internal class RenderPipelineConverterMaterialUpgraderItem : IRenderPipelineConverterItem { - public override bool isEnabled => m_UpgradersCache.Count > 0; - public override string isDisabledMessage => "No upgraders specified for this converter."; + public string assetPath { get; } + public List variantsPaths { get; } - /// - /// List of material upgraders to use for this converter. - /// - protected abstract List upgraders { get; } + public string name { get; } - protected override List<(string query, string description)> contextSearchQueriesAndIds + public string info => assetPath; + + public bool isEnabled { get; set; } = true; + public string isDisabledMessage { get; set; } = string.Empty; + + public Texture2D icon { get { - List<(string materialName, string searchQuery)> list = new(); - foreach (var upgrader in m_UpgradersCache) + var obj = material; + if (obj == null) + return null; + + // Try the object's thumbnail/icon + var icon = AssetPreview.GetMiniThumbnail(obj); + if (icon != null) return icon; + + // Fallback to type icon + var type = obj.GetType(); + icon = EditorGUIUtility.ObjectContent(null, type).image as Texture2D; + return icon; + } + } + + public RenderPipelineConverterMaterialUpgraderItem(string shaderPath, string materialPath, List variantsPaths) + { + if (string.IsNullOrEmpty(materialPath)) + throw new ArgumentException(nameof(materialPath)); + + assetPath = materialPath; + this.variantsPaths = variantsPaths; + + if (material == null) + throw new ArgumentException($"Unable to load material at path {materialPath}"); + + name = material.name + " - " + shaderPath; + } + + public Material material => AssetDatabase.LoadAssetAtPath(assetPath); + + public IEnumerable variantMaterials + { + get + { + foreach (var path in variantsPaths) { - var shader = Shader.Find(upgrader.OldShaderPath); - if (shader == null) - { - Debug.LogWarning($"Shader '{upgrader.OldShaderPath}' not found for upgrader {upgrader.GetType().Name}. This may indicate that the shader has been removed or renamed."); - continue; - } - string formattedId = $"<$object:{GlobalObjectId.GetGlobalObjectIdSlow(shader)},UnityEngine.Object$>"; - list.Add(($"p: t:Material ref={formattedId}", $"{upgrader.OldShaderPath} -> {upgrader.NewShaderPath}")); + var mat = AssetDatabase.LoadAssetAtPath(path); + if (mat != null) + yield return mat; } - return list; } } + public void OnClicked() + { + EditorGUIUtility.PingObject(AssetDatabase.LoadAssetAtPath(assetPath)); + } + } + + [Serializable] + internal abstract class RenderPipelineConverterMaterialUpgrader : IRenderPipelineConverter + { + /// + /// List of material upgraders to use for this converter. + /// + protected abstract List upgraders { get; } + private List m_UpgradersCache; + internal List assets = new(); + public RenderPipelineConverterMaterialUpgrader() { m_UpgradersCache = upgraders; @@ -49,23 +96,72 @@ public RenderPipelineConverterMaterialUpgrader() } } - protected override Status ConvertObject(UnityEngine.Object obj, StringBuilder message) + public void Scan(Action> onScanFinish) + { + var materialsGroupByShader = MaterialFinder.GroupAllMaterialsInProject(); + using (HashSetPool.Get(out var destinationShaders)) + { + foreach (var upgrader in m_UpgradersCache) + { + destinationShaders.Add(upgrader.NewShaderPath); + } + + assets.Clear(); + foreach (var kvp in materialsGroupByShader) + { + // This material shader is already on the target pipeline, skip it. + if (destinationShaders.Contains(kvp.Key)) + continue; + + foreach (var (parent, variants) in kvp.Value) + { + List variantsPaths = new(); + foreach (var variant in variants) + { + variantsPaths.Add(AssetDatabase.GetAssetPath(variant)); + } + + assets.Add(new RenderPipelineConverterMaterialUpgraderItem(kvp.Key, + AssetDatabase.GetAssetPath(parent), + variantsPaths)); + } + } + onScanFinish?.Invoke(assets); + } + } + + public Status Convert(IRenderPipelineConverterItem item, out string message) { - if (obj is not Material mat) + if (item is not RenderPipelineConverterMaterialUpgraderItem materialUpgraderItem) { - message.AppendLine("Object is not a Material."); + message = $"Item is not a {nameof(RenderPipelineConverterMaterialUpgraderItem)}."; return Status.Error; } - string upgradingMessage = string.Empty; - if(!MaterialUpgrader.Upgrade(mat, upgraders, MaterialUpgrader.UpgradeFlags.LogMessageWhenNoUpgraderFound, ref upgradingMessage)) + if (materialUpgraderItem.material == null) { - message.AppendLine($"Material upgrade failed: {upgradingMessage}"); + message = $"Failed to load material at path {materialUpgraderItem.assetPath}."; return Status.Error; } + var upgrader = MaterialUpgrader.GetUpgrader(m_UpgradersCache, materialUpgraderItem.material); + if (upgrader == null) + { + message = $"No upgrader found for shader {materialUpgraderItem.material.shader.name}."; + return Status.Warning; + } + + upgrader.Upgrade(materialUpgraderItem.material, UpgradeFlags.None); + foreach (var variant in materialUpgraderItem.variantMaterials) + { + if (variant == null) + continue; + + upgrader.Upgrade(variant, UpgradeFlags.None); + } + + message = string.Empty; return Status.Success; } - } } diff --git a/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/Status.cs b/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/Status.cs index eca30445ad3..f19e011a668 100644 --- a/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/Status.cs +++ b/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/Status.cs @@ -11,21 +11,21 @@ enum Status /// /// The item is waiting to be processed. /// - Pending, + Pending = 0, /// /// The item has a potential issue that may require attention. /// - Warning, + Warning = 1, /// /// The item encountered an error during processing. /// - Error, + Error = 2, /// /// The item was successfully processed without issues. /// - Success, + Success = 3, } } diff --git a/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/Window/RenderPipelineConverterItemVisualElement.cs b/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/Window/RenderPipelineConverterItemVisualElement.cs deleted file mode 100644 index 82a8cdf3bc9..00000000000 --- a/Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/Window/RenderPipelineConverterItemVisualElement.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System; -using UnityEngine; -using UnityEngine.UIElements; - -namespace UnityEditor.Rendering.Converter -{ - internal class RenderPipelineConverterItemVisualElement : VisualElement - { - const string k_Uxml = "Packages/com.unity.render-pipelines.core/Editor-PrivateShared/Tools/Converter/Window/RenderPipelineConverterItemVisualElement.uxml"; - - static Lazy s_VisualTreeAsset = new Lazy(() => AssetDatabase.LoadAssetAtPath(k_Uxml)); - - VisualElement m_RootVisualElement; - Toggle m_ItemSelectedToggle; - ConverterItemState m_ConverterItemState; - - public Action itemSelectionChanged; - - public RenderPipelineConverterItemVisualElement() - { - m_RootVisualElement = new VisualElement(); - s_VisualTreeAsset.Value.CloneTree(m_RootVisualElement); - - m_ItemSelectedToggle = m_RootVisualElement.Q("converterItemActive"); - m_ItemSelectedToggle.RegisterCallback(evt => - { - if (m_ConverterItemState != null) - { - m_ConverterItemState.isSelected = !m_ConverterItemState.isSelected; - itemSelectionChanged?.Invoke(); - } - }); - - Add(m_RootVisualElement); - } - - public void Bind(ConverterItemState itemState) - { - m_ConverterItemState = itemState; - - m_ItemSelectedToggle.SetValueWithoutNotify(m_ConverterItemState.isSelected); - - var item = m_ConverterItemState.item; - m_RootVisualElement.Q /// Handles to update. /// Handles of the new data. - protected void CheckAndSetTextureHandle(ref TextureHandle[] handle, TextureHandle[] newHandle) + protected void CheckAndSetTextureHandle(ref TextureHandle[] handle, in TextureHandle[] newHandle) { if (!CheckAndWarnAboutAccessibility()) return; diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/FrameData/UniversalResourceData.cs b/Packages/com.unity.render-pipelines.universal/Runtime/FrameData/UniversalResourceData.cs index 84c1fdb4605..e38caeb3e7d 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/FrameData/UniversalResourceData.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/FrameData/UniversalResourceData.cs @@ -39,7 +39,7 @@ public TextureHandle activeColorTexture /// /// Switch the active color and depth texture to the backbuffer. Once switched, isActiveTargetBackBuffer will return true. /// The activeColorTexture and activeDepthTexture will then return the backbuffer. This should be called after a render pass - /// that blits/copies the cameraColor to the backbuffer is recorded in the render graph. The following passes will then + /// that blits/copies the cameraColor to the backbuffer is recorded in the render graph. The following passes will then /// automatically use the backbuffer as active color and depth. URP will not add the final blit pass if this method is called before /// that render pass. /// @@ -241,6 +241,10 @@ public TextureHandle internalColorLut } private TextureHandle _internalColorLut; + /// + /// Bloom. A glow for very bright highlights. Written to by the Bloom pass. Additively composited in the Uber pass. + /// It does not contain bloom specific alpha information and can be considered as a premultiplied alpha texture for advanced compositing. + /// internal TextureHandle bloom { get => CheckAndGetTextureHandle(ref _bloom); @@ -334,7 +338,7 @@ internal TextureHandle stpDebugView private TextureHandle _stpDebugView; //Due to camera stacking, we sometimes need to set a specific (persistent) target texture as destination. - //We cannot create an RG managed texture for the destination in that case as output/destination. + //We cannot create an RG managed texture for the destination in that case as output/destination. //If we woulnd't have camera stacking, then the backbuffer would be the only other persistent destination. //The usage of this destination is currently limited to the Uberpost processing pass. internal TextureHandle destinationCameraColor diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/LightCookieManager.cs b/Packages/com.unity.render-pipelines.universal/Runtime/LightCookieManager.cs index 6762336f3fe..6507b71a1a1 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/LightCookieManager.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/LightCookieManager.cs @@ -86,8 +86,8 @@ private struct LightCookieMapping if (d == 0) { // Sort by texture ID if "undecided" to batch fetches to the same cookie texture. - int ai = alc.GetInstanceID(); - int bi = blc.GetInstanceID(); + int ai = alc.GetEntityId(); + int bi = blc.GetEntityId(); return ai - bi; } return d; @@ -633,7 +633,7 @@ uint ComputeCookieRequestPixelCount(ref WorkSlice validLight { var lcm = validLightMappings[i]; Texture cookie = lcm.light.cookie; - int cookieID = cookie.GetInstanceID(); + int cookieID = cookie.GetEntityId(); // Consider only unique textures as atlas request pixels // NOTE: relies on same cookies being sorted together diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/AdditionalLightsShadowCasterPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/AdditionalLightsShadowCasterPass.cs index 52b00fc619d..ae941941cfe 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/AdditionalLightsShadowCasterPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/AdditionalLightsShadowCasterPass.cs @@ -943,7 +943,7 @@ internal TextureHandle Render(RenderGraph graph, ContextContainer frameData) if (shadowTexture.IsValid()) builder.SetGlobalTextureAfterPass(shadowTexture, AdditionalShadowsConstantBuffer._AdditionalLightsShadowmapID); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { RasterCommandBuffer rasterCommandBuffer = context.cmd; if (!data.emptyShadowmap) diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/CapturePass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/CapturePass.cs index d546667f5d5..1067501a9ef 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/CapturePass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/CapturePass.cs @@ -42,7 +42,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer // Setup up the builder builder.AllowPassCulling(false); builder.UseTexture(resourceData.cameraColor); - builder.SetRenderFunc((UnsafePassData data, UnsafeGraphContext unsafeContext) => + builder.SetRenderFunc(static (UnsafePassData data, UnsafeGraphContext unsafeContext) => { var nativeCommandBuffer = CommandBufferHelpers.GetNativeCommandBuffer(unsafeContext.cmd); var captureActions = data.captureActions; diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/CopyColorPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/CopyColorPass.cs index 244d5b501f4..c23eb0d6eb6 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/CopyColorPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/CopyColorPass.cs @@ -216,7 +216,7 @@ private void AddDownsampleAndCopyColorRenderPass(RenderGraph renderGraph, in Tex builder.SetGlobalTextureAfterPass(destination, Shader.PropertyToID("_CameraOpaqueTexture")); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { ExecutePass(context.cmd, data, data.source, data.useProceduralBlit); }); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/CopyDepthPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/CopyDepthPass.cs index b2580f64bb2..6cee6184b08 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/CopyDepthPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/CopyDepthPass.cs @@ -1,4 +1,3 @@ -using System; using UnityEngine.Experimental.Rendering; using UnityEngine.Rendering.RenderGraphModule; @@ -15,19 +14,10 @@ namespace UnityEngine.Rendering.Universal.Internal /// public partial class CopyDepthPass : ScriptableRenderPass { - // TODO RENDERGRAPH: The Render method overwrites this property with -1 before doing anything else. It should only be used in Compatibility Mode! - internal int MsaaSamples { get; set; } - // In some cases (Scene view, XR and etc.) we actually want to output to depth buffer - // So this variable needs to be set to true to enable the correct copy shader semantic - internal bool CopyToDepth { get; set; } // In XR CopyDepth, we need a special workaround to handle dummy color issue in RenderGraph. internal bool CopyToDepthXR { get; set; } - // We need to know if we're copying to the backbuffer in order to handle y-flip correctly - internal bool CopyToBackbuffer { get; set; } Material m_CopyDepthMaterial; - internal bool m_CopyResolvedDepth; - /// /// Shader resource ids used to communicate with the shader implementation /// @@ -44,19 +34,16 @@ static class ShaderConstants /// The RenderPassEvent to use. /// The Shader to use for copying the depth. /// Controls whether it should do a clear before copying the depth. - /// Controls whether it should do a copy to a depth format target. - /// Set to true if the source depth is MSAA resolved. + /// Deprecated, the parameter is ignored. This is now automatically derived from the source and destination TextureHandle. + /// Deprecated, the parameter is ignored. This is now automatically derived from the source and destination TextureHandle. /// An optional custom profiling name to disambiguate multiple copy passes. /// public CopyDepthPass(RenderPassEvent evt, Shader copyDepthShader, bool shouldClear = false, bool copyToDepth = false, bool copyResolvedDepth = false, string customPassName = null) { profilingSampler = customPassName != null ? new ProfilingSampler(customPassName) : ProfilingSampler.Get(URPProfileId.CopyDepth); - CopyToDepth = copyToDepth; m_CopyDepthMaterial = copyDepthShader != null ? CoreUtils.CreateEngineMaterial(copyDepthShader) : null; renderPassEvent = evt; - m_CopyResolvedDepth = copyResolvedDepth; CopyToDepthXR = false; - CopyToBackbuffer = false; } /// @@ -66,7 +53,7 @@ public CopyDepthPass(RenderPassEvent evt, Shader copyDepthShader, bool shouldCle /// Destination Render Target public void Setup(RTHandle source, RTHandle destination) { - MsaaSamples = -1; + } /// @@ -83,83 +70,69 @@ private class PassData internal TextureHandle destination; internal UniversalCameraData cameraData; internal Material copyDepthMaterial; - internal int msaaSamples; internal bool copyResolvedDepth; internal bool copyToDepth; - internal bool isDstBackbuffer; + internal bool setViewport; } - private static void ExecutePass(RasterCommandBuffer cmd, PassData passData, RTHandle source, bool yflip) + private static void ExecutePass(RasterCommandBuffer cmd, PassData passData, RTHandle source, Vector4 scaleBias) { var copyDepthMaterial = passData.copyDepthMaterial; - var msaaSamples = passData.msaaSamples; - var copyResolvedDepth = passData.copyResolvedDepth; - var copyToDepth = passData.copyToDepth; if (copyDepthMaterial == null) { Debug.LogErrorFormat("Missing {0}. Copy Depth render pass will not execute. Check for missing reference in the renderer resources.", copyDepthMaterial); return; } - using (new ProfilingScope(cmd, ProfilingSampler.Get(URPProfileId.CopyDepth))) - { - int cameraSamples = 0; - // When depth resolve is supported and requested, or multisampled texture is not supported, force camera samples to 1 - if (copyResolvedDepth || SystemInfo.supportsMultisampledTextures == 0) - { - cameraSamples = 1; - } - else if (msaaSamples == -1) // RG path - { - cameraSamples = source.rt.antiAliasing; - } - else - { - cameraSamples = msaaSamples; - } + int cameraSamples; - switch (cameraSamples) - { - case 8: - cmd.SetKeyword(ShaderGlobalKeywords.DepthMsaa2, false); - cmd.SetKeyword(ShaderGlobalKeywords.DepthMsaa4, false); - cmd.SetKeyword(ShaderGlobalKeywords.DepthMsaa8, true); - break; - - case 4: - cmd.SetKeyword(ShaderGlobalKeywords.DepthMsaa2, false); - cmd.SetKeyword(ShaderGlobalKeywords.DepthMsaa4, true); - cmd.SetKeyword(ShaderGlobalKeywords.DepthMsaa8, false); - break; - - case 2: - cmd.SetKeyword(ShaderGlobalKeywords.DepthMsaa2, true); - cmd.SetKeyword(ShaderGlobalKeywords.DepthMsaa4, false); - cmd.SetKeyword(ShaderGlobalKeywords.DepthMsaa8, false); - break; - - // MSAA disabled, auto resolve supported, resolve texture requested, or ms textures not supported - default: - cmd.SetKeyword(ShaderGlobalKeywords.DepthMsaa2, false); - cmd.SetKeyword(ShaderGlobalKeywords.DepthMsaa4, false); - cmd.SetKeyword(ShaderGlobalKeywords.DepthMsaa8, false); - break; - } + if (passData.copyResolvedDepth) + { + cameraSamples = 1; + } + else + { + cameraSamples = source.rt.antiAliasing; + } - cmd.SetKeyword(ShaderGlobalKeywords._OUTPUT_DEPTH, copyToDepth); + switch (cameraSamples) + { + case 8: + cmd.SetKeyword(ShaderGlobalKeywords.DepthMsaa2, false); + cmd.SetKeyword(ShaderGlobalKeywords.DepthMsaa4, false); + cmd.SetKeyword(ShaderGlobalKeywords.DepthMsaa8, true); + break; - Vector2 viewportScale = source.useScaling ? new Vector2(source.rtHandleProperties.rtHandleScale.x, source.rtHandleProperties.rtHandleScale.y) : Vector2.one; - Vector4 scaleBias = yflip ? new Vector4(viewportScale.x, -viewportScale.y, 0, viewportScale.y) : new Vector4(viewportScale.x, viewportScale.y, 0, 0); + case 4: + cmd.SetKeyword(ShaderGlobalKeywords.DepthMsaa2, false); + cmd.SetKeyword(ShaderGlobalKeywords.DepthMsaa4, true); + cmd.SetKeyword(ShaderGlobalKeywords.DepthMsaa8, false); + break; - // When we render to the backbuffer, we update the viewport to cover the entire screen just in case it hasn't been updated already. - if (passData.isDstBackbuffer) - cmd.SetViewport(passData.cameraData.pixelRect); + case 2: + cmd.SetKeyword(ShaderGlobalKeywords.DepthMsaa2, true); + cmd.SetKeyword(ShaderGlobalKeywords.DepthMsaa4, false); + cmd.SetKeyword(ShaderGlobalKeywords.DepthMsaa8, false); + break; - copyDepthMaterial.SetTexture(ShaderConstants._CameraDepthAttachment, source); - copyDepthMaterial.SetFloat(ShaderConstants._ZWriteShaderHandle, copyToDepth ? 1.0f : 0.0f); - Blitter.BlitTexture(cmd, source, scaleBias, copyDepthMaterial, 0); + // MSAA disabled, auto resolve supported, resolve texture requested, or ms textures not supported + default: + cmd.SetKeyword(ShaderGlobalKeywords.DepthMsaa2, false); + cmd.SetKeyword(ShaderGlobalKeywords.DepthMsaa4, false); + cmd.SetKeyword(ShaderGlobalKeywords.DepthMsaa8, false); + break; } + + cmd.SetKeyword(ShaderGlobalKeywords._OUTPUT_DEPTH, passData.copyToDepth); + + // When we render to the backbuffer, we update the viewport to cover the entire screen just in case it hasn't been updated already. + if (passData.setViewport) + cmd.SetViewport(passData.cameraData.pixelRect); + + copyDepthMaterial.SetTexture(ShaderConstants._CameraDepthAttachment, source); + copyDepthMaterial.SetFloat(ShaderConstants._ZWriteShaderHandle, passData.copyToDepth ? 1.0f : 0.0f); + Blitter.BlitTexture(cmd, source, scaleBias, copyDepthMaterial, 0); } /// @@ -190,18 +163,31 @@ public void Render(RenderGraph renderGraph, ContextContainer frameData, TextureH /// The pass name used for debug and identifying the pass. public void Render(RenderGraph renderGraph, TextureHandle destination, TextureHandle source, UniversalResourceData resourceData, UniversalCameraData cameraData, bool bindAsCameraDepth = false, string passName = "Copy Depth") { - // TODO RENDERGRAPH: should call the equivalent of Setup() to initialise everything correctly - MsaaSamples = -1; + Debug.Assert(source.IsValid(), "CopyDepthPass source is not a valid texture."); + Debug.Assert(destination.IsValid(), "CopyDepthPass destination is not a valid texture."); + + var sourceDesc = renderGraph.GetTextureDesc(source); + var destinationDesc = renderGraph.GetRenderTargetInfo(destination); + + bool dstHasDepthFormat = GraphicsFormatUtility.IsDepthFormat(destinationDesc.format); + + bool hasMSAA = sourceDesc.msaaSamples != MSAASamples.None; + var canUseResolvedDepth = !sourceDesc.bindTextureMS && RenderingUtils.MultisampleDepthResolveSupported(); + var canSampleMSAADepth = sourceDesc.bindTextureMS && SystemInfo.supportsMultisampledTextures != 0; + + Debug.Assert(!hasMSAA || canUseResolvedDepth || canSampleMSAADepth || !dstHasDepthFormat + , "Can't copy depth to destiation with depth format due to MSAA and platform/API limitations: no resolved depth resource (bindMS), depth resolve unsupported, and MSAA depth sampling unsupported."); // Having a different pass name than profilingSampler.name is bad practice but this method was public before we cleaned up this naming using (var builder = renderGraph.AddRasterRenderPass(passName, out var passData, profilingSampler)) { passData.copyDepthMaterial = m_CopyDepthMaterial; - passData.msaaSamples = MsaaSamples; passData.cameraData = cameraData; - passData.copyResolvedDepth = m_CopyResolvedDepth; - passData.copyToDepth = CopyToDepth || CopyToDepthXR; - passData.isDstBackbuffer = CopyToBackbuffer || CopyToDepthXR; + //When we can't resolve depth and can't sample MSAA depth, we should have set the target to color. This works on GLES for example. + //Perhaps we need to check for !dstHasDepthFormat but we keep to original check to avoid any issues for now. + passData.copyResolvedDepth = canUseResolvedDepth || !canSampleMSAADepth; + passData.copyToDepth = dstHasDepthFormat; + passData.setViewport = CopyToDepthXR; if (cameraData.xr.enabled) { @@ -212,19 +198,7 @@ public void Render(RenderGraph renderGraph, TextureHandle destination, TextureHa } } - if (CopyToDepth) - { - // Writes depth using custom depth output - builder.SetRenderAttachmentDepth(destination, AccessFlags.WriteAll); -#if UNITY_EDITOR - // binding a dummy color target as a workaround to an OSX issue in Editor scene view (UUM-47698). - // Also required for preview camera rendering for grid drawn with builtin RP (UUM-55171). - // Also required for render gizmos (UUM-91335). - if (cameraData.isSceneViewCamera || cameraData.isPreviewCamera || UnityEditor.Handles.ShouldRenderGizmos()) - builder.SetRenderAttachment(resourceData.activeColorTexture, 0); -#endif - } - else if (CopyToDepthXR) + if (CopyToDepthXR) { // Writes depth using custom depth output builder.SetRenderAttachmentDepth(destination, AccessFlags.WriteAll); @@ -254,6 +228,18 @@ public void Render(RenderGraph renderGraph, TextureHandle destination, TextureHa else builder.SetRenderAttachment(resourceData.backBufferColor, 0); } +#endif + } + else if (passData.copyToDepth) + { + // Writes depth using custom depth output + builder.SetRenderAttachmentDepth(destination, AccessFlags.WriteAll); +#if UNITY_EDITOR + // binding a dummy color target as a workaround to an OSX issue in Editor scene view (UUM-47698). + // Also required for preview camera rendering for grid drawn with builtin RP (UUM-55171). + // Also required for render gizmos (UUM-91335). + if (cameraData.isSceneViewCamera || cameraData.isPreviewCamera || UnityEditor.Handles.ShouldRenderGizmos()) + builder.SetRenderAttachment(resourceData.activeColorTexture, 0); #endif } else @@ -266,15 +252,15 @@ public void Render(RenderGraph renderGraph, TextureHandle destination, TextureHa passData.destination = destination; builder.UseTexture(source, AccessFlags.Read); - if (bindAsCameraDepth && destination.IsValid()) + if (bindAsCameraDepth) builder.SetGlobalTextureAfterPass(destination, ShaderConstants._CameraDepthTexture); builder.AllowGlobalStateModification(true); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { - bool yflip = context.GetTextureUVOrigin(in data.source) != context.GetTextureUVOrigin(in data.destination); - ExecutePass(context.cmd, data, data.source, yflip); + Vector4 scaleBias = RenderingUtils.GetFinalBlitScaleBias(context, data.source, data.destination); + ExecutePass(context.cmd, data, data.source, scaleBias); }); } } diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DeferredPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DeferredPass.cs index 4df68f9df43..79ca8537d84 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DeferredPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DeferredPass.cs @@ -32,11 +32,16 @@ private class PassData internal DeferredLights deferredLights; } - internal void Render(RenderGraph renderGraph, ContextContainer frameData, TextureHandle color, TextureHandle depth, TextureHandle[] gbuffer) + public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { - UniversalCameraData cameraData = frameData.Get(); - UniversalLightData lightData = frameData.Get(); - UniversalShadowData shadowData = frameData.Get(); + var cameraData = frameData.Get(); + var resourceData = frameData.Get(); + var lightData = frameData.Get(); + var shadowData = frameData.Get(); + + var color = resourceData.activeColorTexture; + var depth = resourceData.activeDepthTexture; + var gbuffer = resourceData.gBuffer; using (var builder = renderGraph.AddRasterRenderPass(passName, out var passData, profilingSampler)) { @@ -71,9 +76,9 @@ internal void Render(RenderGraph renderGraph, ContextContainer frameData, Textur builder.AllowGlobalStateModification(true); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { - data.deferredLights.ExecuteDeferredPass(context.cmd, data.cameraData, data.lightData, data.shadowData); + data.deferredLights.ExecuteDeferredPass(context.cmd, data.cameraData, data.lightData, data.shadowData, data.gbuffer); }); } } diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DepthNormalOnlyPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DepthNormalOnlyPass.cs index 6ae6f6677f3..cefc96f514e 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DepthNormalOnlyPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DepthNormalOnlyPass.cs @@ -17,6 +17,8 @@ public partial class DepthNormalOnlyPass : ScriptableRenderPass // Statics private static readonly List k_DepthNormals = new List { new ShaderTagId("DepthNormals"), new ShaderTagId("DepthNormalsOnly") }; + private static readonly List k_DepthNormalsOnly = new List { new ShaderTagId("DepthNormalsOnly") }; + internal static readonly string k_CameraNormalsTextureName = "_CameraNormalsTexture"; private static readonly int s_CameraDepthTextureID = Shader.PropertyToID("_CameraDepthTexture"); private static readonly int s_CameraNormalsTextureID = Shader.PropertyToID(k_CameraNormalsTextureName); @@ -120,8 +122,17 @@ private RendererListParams InitRendererListParams(UniversalRenderingData renderi return new RendererListParams(renderingData.cullResults, drawSettings, m_FilteringSettings); } - internal void Render(RenderGraph renderGraph, ContextContainer frameData, TextureHandle cameraNormalsTexture, TextureHandle cameraDepthTexture, TextureHandle renderingLayersTexture, uint batchLayerMask, bool setGlobalDepth, bool setGlobalTextures) + internal void Render(RenderGraph renderGraph, ContextContainer frameData, in TextureHandle cameraNormalsTexture, in TextureHandle depthTexture, in TextureHandle renderingLayersTexture, uint batchLayerMask, bool setGlobalDepth, bool setGlobalNormalAndRenderingLayers, bool allowPartialPass) { + if (allowPartialPass) + { + this.shaderTagIds = k_DepthNormalsOnly; + } + else + { + this.shaderTagIds = k_DepthNormals; + } + UniversalRenderingData renderingData = frameData.Get(); UniversalCameraData cameraData = frameData.Get(); UniversalLightData lightData = frameData.Get(); @@ -129,7 +140,7 @@ internal void Render(RenderGraph renderGraph, ContextContainer frameData, Textur using (var builder = renderGraph.AddRasterRenderPass(passName, out var passData, profilingSampler)) { builder.SetRenderAttachment(cameraNormalsTexture, 0, AccessFlags.Write); - builder.SetRenderAttachmentDepth(cameraDepthTexture, AccessFlags.ReadWrite); + builder.SetRenderAttachmentDepth(depthTexture, AccessFlags.ReadWrite); passData.enableRenderingLayers = enableRenderingLayers; @@ -153,7 +164,7 @@ internal void Render(RenderGraph renderGraph, ContextContainer frameData, Textur } } - if (setGlobalTextures) + if (setGlobalNormalAndRenderingLayers) { builder.SetGlobalTextureAfterPass(cameraNormalsTexture, s_CameraNormalsTextureID); @@ -162,12 +173,12 @@ internal void Render(RenderGraph renderGraph, ContextContainer frameData, Textur } if (setGlobalDepth) - builder.SetGlobalTextureAfterPass(cameraDepthTexture, s_CameraDepthTextureID); + builder.SetGlobalTextureAfterPass(depthTexture, s_CameraDepthTextureID); // Required here because of RenderingLayerUtils.SetupProperties builder.AllowGlobalStateModification(true); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { RenderingLayerUtils.SetupProperties(context.cmd, data.maskSize); ExecutePass(context.cmd, data, data.rendererList); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DepthOnlyPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DepthOnlyPass.cs index ffe91a574b1..69894d85f51 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DepthOnlyPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DepthOnlyPass.cs @@ -73,7 +73,7 @@ private RendererListParams InitRendererListParams(UniversalRenderingData renderi return new RendererListParams(renderingData.cullResults, drawSettings, m_FilteringSettings); } - internal void Render(RenderGraph renderGraph, ContextContainer frameData, ref TextureHandle cameraDepthTexture, uint batchLayerMask, bool setGlobalDepth) + internal void Render(RenderGraph renderGraph, ContextContainer frameData, in TextureHandle depthTexture, uint batchLayerMask, bool setGlobalDepth) { UniversalRenderingData renderingData = frameData.Get(); UniversalCameraData cameraData = frameData.Get(); @@ -86,10 +86,10 @@ internal void Render(RenderGraph renderGraph, ContextContainer frameData, ref Te passData.rendererList = renderGraph.CreateRendererList(param); builder.UseRendererList(passData.rendererList); - builder.SetRenderAttachmentDepth(cameraDepthTexture, AccessFlags.ReadWrite); + builder.SetRenderAttachmentDepth(depthTexture, AccessFlags.ReadWrite); if (setGlobalDepth) - builder.SetGlobalTextureAfterPass(cameraDepthTexture, s_CameraDepthTextureID); + builder.SetGlobalTextureAfterPass(depthTexture, s_CameraDepthTextureID); builder.AllowGlobalStateModification(true); if (cameraData.xr.enabled) @@ -102,7 +102,7 @@ internal void Render(RenderGraph renderGraph, ContextContainer frameData, ref Te } } - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { ExecutePass(context.cmd, data.rendererList); }); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DrawObjectsPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DrawObjectsPass.cs index 9eadc1adfd9..d1a2ede212c 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DrawObjectsPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DrawObjectsPass.cs @@ -225,7 +225,7 @@ internal static bool CanDisableZWrite(UniversalCameraData cameraData, bool isOpa return cameraData.renderer.useDepthPriming && isOpaque && (cameraData.renderType == CameraRenderType.Base || cameraData.clearDepth); } - internal void Render(RenderGraph renderGraph, ContextContainer frameData, TextureHandle colorTarget, TextureHandle depthTarget, TextureHandle mainShadowsTexture, TextureHandle additionalShadowsTexture, uint batchLayerMask = uint.MaxValue, bool isMainOpaquePass = false) + internal void Render(RenderGraph renderGraph, ContextContainer frameData, in TextureHandle colorTarget, in TextureHandle depthTarget, in TextureHandle mainShadowsTexture, in TextureHandle additionalShadowsTexture, uint batchLayerMask = uint.MaxValue, bool isMainOpaquePass = false) { UniversalResourceData resourceData = frameData.Get(); UniversalRenderingData renderingData = frameData.Get(); @@ -302,7 +302,7 @@ internal void Render(RenderGraph renderGraph, ContextContainer frameData, Textur #endif } - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { // Currently we only need to call this additional pass when the user // doesn't want transparent objects to receive shadows @@ -356,8 +356,8 @@ public RenderingLayersPassData() } } - internal void Render(RenderGraph renderGraph, ContextContainer frameData, TextureHandle colorTarget, TextureHandle renderingLayersTexture, TextureHandle depthTarget, - TextureHandle mainShadowsTexture, TextureHandle additionalShadowsTexture, RenderingLayerUtils.MaskSize maskSize, uint batchLayerMask = uint.MaxValue) + internal void Render(RenderGraph renderGraph, ContextContainer frameData, in TextureHandle colorTarget, in TextureHandle renderingLayersTexture, in TextureHandle depthTarget, + in TextureHandle mainShadowsTexture, in TextureHandle additionalShadowsTexture, RenderingLayerUtils.MaskSize maskSize, uint batchLayerMask = uint.MaxValue) { using (var builder = renderGraph.AddRasterRenderPass(passName, out var passData, profilingSampler)) { @@ -421,7 +421,7 @@ internal void Render(RenderGraph renderGraph, ContextContainer frameData, Textur } } - builder.SetRenderFunc((RenderingLayersPassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (RenderingLayersPassData data, RasterGraphContext context) => { // Enable Rendering Layers context.cmd.SetKeyword(ShaderGlobalKeywords.WriteRenderingLayers, true); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DrawScreenSpaceUIPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DrawScreenSpaceUIPass.cs index 78782b7013f..013c0b37ff5 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DrawScreenSpaceUIPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DrawScreenSpaceUIPass.cs @@ -134,7 +134,7 @@ internal void RenderOffscreen(RenderGraph renderGraph, ContextContainer frameDat if (output.IsValid()) builder.SetGlobalTextureAfterPass(output, ShaderPropertyId.overlayUITexture); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { ExecutePass(context.cmd, data, data.rendererList); }); @@ -151,7 +151,7 @@ internal void RenderOffscreen(RenderGraph renderGraph, ContextContainer frameDat passData.rendererList = renderGraph.CreateUIOverlayRendererList(cameraData.camera, UISubset.LowLevel); builder.UseRendererList(passData.rendererList); - builder.SetRenderFunc((UnsafePassData data, UnsafeGraphContext context) => + builder.SetRenderFunc(static (UnsafePassData data, UnsafeGraphContext context) => { context.cmd.SetRenderTarget(data.colorTarget); ExecutePass(context.cmd, data, data.rendererList); @@ -177,7 +177,7 @@ internal void RenderOverlay(RenderGraph renderGraph, ContextContainer frameData, passData.rendererList = renderGraph.CreateUIOverlayRendererList(cameraData.camera, UISubset.UIToolkit_UGUI); builder.UseRendererList(passData.rendererList); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { ExecutePass(context.cmd, data, data.rendererList); }); @@ -194,7 +194,7 @@ internal void RenderOverlay(RenderGraph renderGraph, ContextContainer frameData, passData.rendererList = renderGraph.CreateUIOverlayRendererList(cameraData.camera, UISubset.LowLevel); builder.UseRendererList(passData.rendererList); - builder.SetRenderFunc((UnsafePassData data, UnsafeGraphContext context) => + builder.SetRenderFunc(static (UnsafePassData data, UnsafeGraphContext context) => { context.cmd.SetRenderTarget(data.colorTarget); ExecutePass(context.cmd, data, data.rendererList); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DrawSkyboxPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DrawSkyboxPass.cs index ace645a9a60..26b443a933a 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DrawSkyboxPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DrawSkyboxPass.cs @@ -78,7 +78,7 @@ private void InitPassData(ref PassData passData, in XRPass xr, in RendererListHa passData.skyRendererListHandle = handle; } - internal void Render(RenderGraph renderGraph, ContextContainer frameData, ScriptableRenderContext context, TextureHandle colorTarget, TextureHandle depthTarget, Material skyboxMaterial) + internal void Render(RenderGraph renderGraph, ContextContainer frameData, ScriptableRenderContext context, in TextureHandle colorTarget, in TextureHandle depthTarget, Material skyboxMaterial) { UniversalCameraData cameraData = frameData.Get(); UniversalResourceData resourceData = frameData.Get(); @@ -115,7 +115,7 @@ internal void Render(RenderGraph renderGraph, ContextContainer frameData, Script } } - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { ExecutePass(context.cmd, data.xr, data.skyRendererListHandle); }); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/FinalBlitPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/FinalBlitPass.cs index e80cb8082f1..62681361765 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/FinalBlitPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/FinalBlitPass.cs @@ -197,7 +197,7 @@ override public void RecordRenderGraph(RenderGraph renderGraph, ContextContainer builder.AllowGlobalStateModification(true); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { data.blitMaterialData.material.enabledKeywords = null; diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/GBufferPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/GBufferPass.cs index 3eab752f673..dc66c0e9727 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/GBufferPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/GBufferPass.cs @@ -61,7 +61,7 @@ public GBufferPass(RenderPassEvent evt, RenderQueueRange renderQueueRange, Layer public void Dispose() { - m_DeferredLights?.ReleaseGbufferResources(); + } static void ExecutePass(RasterCommandBuffer cmd, PassData data, RendererList rendererList, RendererList errorRendererList) @@ -130,7 +130,7 @@ private void InitRendererLists( ref PassData passData, ScriptableRenderContext c stateBlocks.Dispose(); } - internal void Render(RenderGraph renderGraph, ContextContainer frameData, TextureHandle cameraColor, TextureHandle cameraDepth, bool setGlobalTextures, uint batchLayerMask = uint.MaxValue) + internal void Render(RenderGraph renderGraph, ContextContainer frameData, bool setGlobalTextures, uint batchLayerMask = uint.MaxValue) { UniversalResourceData resourceData = frameData.Get(); UniversalRenderingData renderingData = frameData.Get(); @@ -139,8 +139,11 @@ internal void Render(RenderGraph renderGraph, ContextContainer frameData, Textur using var builder = renderGraph.AddRasterRenderPass(passName, out var passData, profilingSampler); bool useCameraRenderingLayersTexture = m_DeferredLights.UseRenderingLayers && !m_DeferredLights.UseLightLayers; - var gbuffer = m_DeferredLights.GbufferTextureHandles; - for (int i = 0; i < m_DeferredLights.GBufferSliceCount; i++) + var cameraColor = resourceData.activeColorTexture; + var cameraDepth = resourceData.activeDepthTexture; + var gbuffer = resourceData.gBuffer; + + for (int i = 0; i < gbuffer.Length; i++) { Debug.Assert(gbuffer[i].IsValid()); builder.SetRenderAttachment(gbuffer[i], i, AccessFlags.Write); @@ -172,7 +175,7 @@ internal void Render(RenderGraph renderGraph, ContextContainer frameData, Textur builder.AllowGlobalStateModification(true); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { ExecutePass(context.cmd, data, data.rendererListHdl, data.objectsWithErrorRendererListHdl); }); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/HDRDebugViewPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/HDRDebugViewPass.cs index 581d3ebfdbe..b6e473c7b75 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/HDRDebugViewPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/HDRDebugViewPass.cs @@ -140,8 +140,8 @@ public void Setup(UniversalCameraData cameraData, HDRDebugMode hdrdebugMode) DebugHandler.ConfigureColorDescriptorForDebugScreen(ref descriptor, cameraData.pixelWidth, cameraData.pixelHeight); RenderingUtils.ReAllocateHandleIfNeeded(ref m_PassthroughRT, descriptor, name: "_HDRDebugDummyRT"); } - - internal void RenderHDRDebug(RenderGraph renderGraph, UniversalCameraData cameraData, TextureHandle srcColor, TextureHandle overlayUITexture, TextureHandle dstColor, HDRDebugMode hdrDebugMode) + + internal void RenderHDRDebug(RenderGraph renderGraph, UniversalCameraData cameraData, in TextureHandle srcColor, in TextureHandle overlayUITexture, in TextureHandle dstColor, HDRDebugMode hdrDebugMode) { bool requiresCIExyData = hdrDebugMode != HDRDebugMode.ValuesAbovePaperWhite; Vector4 luminanceParameters = GetLuminanceParameters(cameraData); @@ -171,7 +171,7 @@ internal void RenderHDRDebug(RenderGraph renderGraph, UniversalCameraData camera passData.passThrough = intermediateRT; builder.UseTexture(intermediateRT, AccessFlags.Write); - builder.SetRenderFunc((PassDataCIExy data, UnsafeGraphContext context) => + builder.SetRenderFunc(static (PassDataCIExy data, UnsafeGraphContext context) => { ExecuteCIExyPrepass(CommandBufferHelpers.GetNativeCommandBuffer(context.cmd), data, data.srcColor, data.xyBuffer, data.passThrough); }); @@ -201,7 +201,7 @@ internal void RenderHDRDebug(RenderGraph renderGraph, UniversalCameraData camera builder.UseTexture(overlayUITexture); } - builder.SetRenderFunc((PassDataDebugView data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassDataDebugView data, RasterGraphContext context) => { data.material.enabledKeywords = null; Vector4 scaleBias = RenderingUtils.GetFinalBlitScaleBias(in context, in data.srcColor, in data.dstColor); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/InvokeOnRenderObjectCallbackPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/InvokeOnRenderObjectCallbackPass.cs index f1bd1fdf9b5..262aff02f1c 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/InvokeOnRenderObjectCallbackPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/InvokeOnRenderObjectCallbackPass.cs @@ -21,14 +21,16 @@ private class PassData internal TextureHandle depthTarget; } - internal void Render(RenderGraph renderGraph, TextureHandle colorTarget, TextureHandle depthTarget) + internal void Render(RenderGraph renderGraph, in TextureHandle colorTarget, in TextureHandle depthTarget) { using (var builder = renderGraph.AddUnsafePass(passName, out var passData, profilingSampler)) { + passData.colorTarget = colorTarget; builder.UseTexture(colorTarget, AccessFlags.Write); + passData.depthTarget = depthTarget; builder.UseTexture(depthTarget, AccessFlags.Write); builder.AllowPassCulling(false); - builder.SetRenderFunc((PassData data, UnsafeGraphContext context) => + builder.SetRenderFunc(static (PassData data, UnsafeGraphContext context) => { context.cmd.SetRenderTarget(data.colorTarget, data.depthTarget); context.cmd.InvokeOnRenderObjectCallbacks(); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/MainLightShadowCasterPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/MainLightShadowCasterPass.cs index 6149bd16a93..45ad05f4fb1 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/MainLightShadowCasterPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/MainLightShadowCasterPass.cs @@ -412,7 +412,7 @@ internal TextureHandle Render(RenderGraph graph, ContextContainer frameData) if (shadowTexture.IsValid()) builder.SetGlobalTextureAfterPass(shadowTexture, MainLightShadowConstantBuffer._MainLightShadowmapID); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { RasterCommandBuffer rasterCommandBuffer = context.cmd; if (!data.emptyShadowmap) diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/MotionVectorRenderPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/MotionVectorRenderPass.cs index de405fb5f15..6590fbbd61e 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/MotionVectorRenderPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/MotionVectorRenderPass.cs @@ -148,7 +148,7 @@ private void InitRendererLists(ref PassData passData, ref CullingResults cullRes RenderingUtils.CreateRendererListWithRenderStateBlock(renderGraph, ref cullResults, drawingSettings, m_FilteringSettings, renderStateBlock, ref passData.rendererListHdl); } - internal void Render(RenderGraph renderGraph, ContextContainer frameData, TextureHandle cameraDepthTexture, TextureHandle motionVectorColor, TextureHandle motionVectorDepth) + internal void Render(RenderGraph renderGraph, ContextContainer frameData, in TextureHandle cameraDepthTexture, in TextureHandle motionVectorColor, in TextureHandle motionVectorDepth) { UniversalRenderingData renderingData = frameData.Get(); UniversalCameraData cameraData = frameData.Get(); @@ -182,7 +182,7 @@ internal void Render(RenderGraph renderGraph, ContextContainer frameData, Textur if (motionVectorDepth.IsValid()) builder.SetGlobalTextureAfterPass(motionVectorDepth, Shader.PropertyToID(k_MotionVectorDepthTextureName)); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { if (data.cameraMaterial != null) data.cameraMaterial.SetTexture(s_CameraDepthTextureID, data.cameraDepth); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/BloomPostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/BloomPostProcessPass.cs index 1647590ddb6..0f91048a123 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/BloomPostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/BloomPostProcessPass.cs @@ -4,7 +4,7 @@ namespace UnityEngine.Rendering.Universal { - internal sealed class BloomPostProcessPass : ScriptableRenderPass, IDisposable + internal sealed class BloomPostProcessPass : PostProcessPass { public const int k_MaxPyramidSize = 16; @@ -18,21 +18,19 @@ internal sealed class BloomPostProcessPass : ScriptableRenderPass, IDisposable bool m_IsValid; - // Settings - public Bloom bloom { get; set; } - - // Input - public TextureHandle sourceTexture {get; set;} - - // Output - public TextureHandle destinationTexture { get; private set; } // Bloom destination is a mip pyramid, hard to set the exact destination texture without an extra blit. - public BloomMipPyramid mipPyramid => m_MipPyramid; + const string k_PassNameKawase = "Blit Bloom Mipmaps (Kawase)"; + const string k_PassNameDual = "Blit Bloom Mipmaps (Dual)"; + ProfilingSampler m_ProfilingSamplerKawase; + ProfilingSampler m_ProfilingSamplerDual; + public BloomPostProcessPass(Shader shader) { this.renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing - 1; - this.profilingSampler = null; + this.profilingSampler = new ProfilingSampler("Blit Bloom Mipmaps"); + m_ProfilingSamplerKawase = new ProfilingSampler(k_PassNameKawase); + m_ProfilingSamplerDual = new ProfilingSampler(k_PassNameDual); m_Material = PostProcessUtils.LoadShader(shader, passName); @@ -50,19 +48,13 @@ public BloomPostProcessPass(Shader shader) m_MipPyramid = new BloomMipPyramid(k_MaxPyramidSize); } - public void Dispose() + public override void Dispose() { CoreUtils.Destroy(m_Material); for(int i = 0; i < k_MaxPyramidSize; i++) CoreUtils.Destroy(m_MaterialPyramid[i]); } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsValid() - { - return m_IsValid; - } - private class BloomPassData { internal Material material; @@ -75,11 +67,18 @@ private class BloomPassData public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { - Assertions.Assert.IsTrue(sourceTexture.IsValid(), $"Source texture must be set for BloomPostProcessPass."); + if (!m_IsValid) + return; + + var bloom = volumeStack.GetComponent(); + if (!bloom.IsActive()) + return; + UniversalResourceData resourceData = frameData.Get(); UniversalCameraData cameraData = frameData.Get(); - var srcDesc = sourceTexture.GetDescriptor(renderGraph); + var sourceTexture = resourceData.cameraColor; + var sourceDesc = sourceTexture.GetDescriptor(renderGraph); // Setup // Materials are set up beforehand. @@ -87,7 +86,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer // They should remain unchanged between graph build and execution. using(new ProfilingScope(ProfilingSampler.Get(URPProfileId.RG_BloomSetup))) { - m_MipPyramid.Update(renderGraph, bloom, in srcDesc); + m_MipPyramid.Update(renderGraph, bloom, in sourceDesc); int mipCount = m_MipPyramid.mipCount; // Pre-filtering parameters @@ -144,14 +143,14 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer switch (bloom.filter.value) { case BloomFilterMode.Dual: - destinationTexture = BloomDual(renderGraph, sourceTexture); + resourceData.bloom = BloomDual(renderGraph, sourceTexture); break; case BloomFilterMode.Kawase: - destinationTexture = BloomKawase(renderGraph, sourceTexture); + resourceData.bloom = BloomKawase(renderGraph, sourceTexture); break; case BloomFilterMode.Gaussian: goto default; default: - destinationTexture = BloomGaussian(renderGraph, sourceTexture); + resourceData.bloom = BloomGaussian(renderGraph, sourceTexture); break; } } @@ -193,7 +192,7 @@ static public int CalcBloomMipCount(Bloom bloom, in Vector2Int bloomResolution) TextureHandle BloomGaussian(RenderGraph renderGraph, in TextureHandle source) { - using (var builder = renderGraph.AddUnsafePass("Blit Bloom Mipmaps", out var passData, ProfilingSampler.Get(URPProfileId.Bloom))) + using (var builder = renderGraph.AddUnsafePass(passName, out var passData, profilingSampler)) { passData.sourceTexture = source; passData.material = m_Material; @@ -277,7 +276,7 @@ TextureHandle BloomGaussian(RenderGraph renderGraph, in TextureHandle source) TextureHandle BloomKawase(RenderGraph renderGraph, in TextureHandle source) { - using (var builder = renderGraph.AddUnsafePass("Blit Bloom Mipmaps (Kawase)", out var passData, ProfilingSampler.Get(URPProfileId.Bloom))) + using (var builder = renderGraph.AddUnsafePass(k_PassNameKawase, out var passData, m_ProfilingSamplerKawase)) { passData.sourceTexture = source; passData.material = m_Material; @@ -331,7 +330,7 @@ TextureHandle BloomKawase(RenderGraph renderGraph, in TextureHandle source) // Dual Filter, Bandwidth-Efficient Rendering, siggraph2015 TextureHandle BloomDual(RenderGraph renderGraph, in TextureHandle source) { - using (var builder = renderGraph.AddUnsafePass("Blit Bloom Mipmaps (Dual)", out var passData, ProfilingSampler.Get(URPProfileId.Bloom))) + using (var builder = renderGraph.AddUnsafePass(k_PassNameDual, out var passData, m_ProfilingSamplerDual)) { passData.sourceTexture = source; passData.material = m_Material; @@ -422,7 +421,7 @@ public TextureHandle GetResultMip(int index) if (mipCount == 1) return mipDownTextures[0]; // Prefilter only. - int i = Mathf.Clamp(index, 0, mipCount - 1); + int i = Mathf.Max(Mathf.Min(index, mipCount - 1), 0); return mipUpTextures[i]; // Upsampled results. } diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/DepthOfFieldBokehProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/DepthOfFieldBokehProcessPass.cs index 8e4a141fc62..cb07cedd6e7 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/DepthOfFieldBokehProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/DepthOfFieldBokehProcessPass.cs @@ -4,8 +4,11 @@ namespace UnityEngine.Rendering.Universal { - internal sealed class DepthOfFieldBokehPostProcessPass : ScriptableRenderPass, IDisposable + internal sealed class DepthOfFieldBokehPostProcessPass : PostProcessPass { + public const string k_TargetName = "CameraColorDepthOfFieldBokeh"; + const int k_DownSample = 2; + Material m_Material; bool m_IsValid; @@ -16,47 +19,25 @@ internal sealed class DepthOfFieldBokehPostProcessPass : ScriptableRenderPass, I float m_BokehMaxRadius; float m_BokehRcpAspect; - // Settings - public DepthOfField depthOfField { get; set; } - public bool useFastSRGBLinearConversion { get; set; } - - // Input - public TextureHandle sourceTexture { get; set; } - - // Output - public TextureHandle destinationTexture { get; set; } - public DepthOfFieldBokehPostProcessPass(Shader shader) { this.renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing - 1; - this.profilingSampler = null; + this.profilingSampler = new ProfilingSampler("Blit Depth of Field (Bokeh)"); m_Material = PostProcessUtils.LoadShader(shader, passName); m_IsValid = m_Material != null; } - public void Dispose() + public override void Dispose() { CoreUtils.Destroy(m_Material); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsValid() - { - return m_IsValid; + m_IsValid = false; } private class DoFBokehPassData { internal Material material; - // Setup - internal Vector4[] bokehKernel; - internal int downSample; - internal float uvMargin; - internal Vector4 cocParams; - internal bool useFastSRGBLinearConversion; - internal bool enableAlphaOutput; // Inputs internal TextureHandle sourceTexture; internal TextureHandle depthTexture; @@ -67,21 +48,37 @@ private class DoFBokehPassData internal TextureHandle pongTexture; // Output texture internal TextureHandle destinationTexture; + // Setup + internal Vector4[] bokehKernel; + internal Vector4 cocParams; + internal int downSample; + internal float uvMargin; + internal bool useFastSRGBLinearConversion; + internal bool enableAlphaOutput; }; public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { - Assertions.Assert.IsTrue(sourceTexture.IsValid(), $"Source texture must be set for DepthOfFieldBokehPostProcessPass."); - Assertions.Assert.IsTrue(destinationTexture.IsValid(), $"Destination texture must be set for DepthOfFieldBokehPostProcessPass."); + if (!m_IsValid) + return; - UniversalCameraData cameraData = frameData.Get(); - UniversalResourceData resourceData = frameData.Get(); + var depthOfField = volumeStack.GetComponent(); + if (!depthOfField.IsActive() || depthOfField.mode.value != DepthOfFieldMode.Bokeh) + return; + var cameraData = frameData.Get(); + if (cameraData.isSceneViewCamera) + return; + + var postProcessingData = frameData.Get(); + var resourceData = frameData.Get(); + + var sourceTexture = resourceData.cameraColor; + var destinationTexture = PostProcessUtils.CreateCompatibleTexture(renderGraph, sourceTexture, k_TargetName, true, FilterMode.Bilinear); var srcDesc = sourceTexture.GetDescriptor(renderGraph); - int downSample = 2; - int wh = srcDesc.width / downSample; - int hh = srcDesc.height / downSample; + int wh = srcDesc.width / k_DownSample; + int hh = srcDesc.height / k_DownSample; // Pass Textures var fullCoCTextureDesc = PostProcessUtils.GetCompatibleDescriptor(srcDesc, srcDesc.width, srcDesc.height, Experimental.Rendering.GraphicsFormat.R8_UNorm); @@ -91,7 +88,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer var pongTextureDesc = PostProcessUtils.GetCompatibleDescriptor(srcDesc, wh, hh, Experimental.Rendering.GraphicsFormat.R16G16B16A16_SFloat); var pongTexture = PostProcessUtils.CreateCompatibleTexture(renderGraph, pongTextureDesc, "_PongTexture", true, FilterMode.Bilinear); - using (var builder = renderGraph.AddUnsafePass("Depth of Field - Bokeh", out var passData)) + using (var builder = renderGraph.AddUnsafePass(passName, out var passData, profilingSampler)) { // Setup // "A Lens and Aperture Camera Model for Synthetic Image Generation" [Potmesil81] @@ -115,13 +112,13 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer depthOfField.bladeRotation.value, maxRadius, rcpAspect); } - float uvMargin = (1.0f / srcDesc.height) * downSample; + float uvMargin = (1.0f / srcDesc.height) * k_DownSample; passData.bokehKernel = m_BokehKernel; - passData.downSample = downSample; + passData.downSample = k_DownSample; passData.uvMargin = uvMargin; passData.cocParams = new Vector4(P, maxCoC, maxRadius, rcpAspect); - passData.useFastSRGBLinearConversion = useFastSRGBLinearConversion; + passData.useFastSRGBLinearConversion = postProcessingData.useFastSRGBLinearConversion; passData.enableAlphaOutput = cameraData.isAlphaOutputEnabled; // Inputs @@ -163,7 +160,6 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer dofMat.SetVector(ShaderConstants._DownSampleScaleFactor, new Vector4(1.0f / data.downSample, 1.0f / data.downSample, data.downSample,data.downSample)); dofMat.SetVector(ShaderConstants._BokehConstants, new Vector4(data.uvMargin, data.uvMargin * 2.0f)); dofMat.SetVector(ShaderConstants._SourceSize, sourceSize); - //PostProcessUtils.SetGlobalShaderSourceSize(cmd, data.sourceTexture); CoreUtils.SetKeyword(dofMat, ShaderKeywordStrings.UseFastSRGBLinearConversion, data.useFastSRGBLinearConversion); CoreUtils.SetKeyword(dofMat, ShaderKeywordStrings._ENABLE_ALPHA_OUTPUT, data.enableAlphaOutput); @@ -203,6 +199,8 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer } }); } + + resourceData.cameraColor = destinationTexture; } static void PrepareBokehKernel(ref Vector4[] bokehKernel, int bladeCount, float bladeCurvature, float bladeRotation, float maxRadius, float rcpAspect) diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/DepthOfFieldGaussianPostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/DepthOfFieldGaussianPostProcessPass.cs index c68fd8a209a..409d161079b 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/DepthOfFieldGaussianPostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/DepthOfFieldGaussianPostProcessPass.cs @@ -5,9 +5,10 @@ namespace UnityEngine.Rendering.Universal { - internal sealed class DepthOfFieldGaussianPostProcessPass : ScriptableRenderPass, IDisposable + internal sealed class DepthOfFieldGaussianPostProcessPass : PostProcessPass { - public const string k_TargetName = "_DoFTarget"; + public const string k_TargetName = "CameraColorDepthOfFieldGaussian"; + const int k_DownSample = 2; Material m_Material; Material m_MaterialCoc; @@ -15,19 +16,10 @@ internal sealed class DepthOfFieldGaussianPostProcessPass : ScriptableRenderPass Experimental.Rendering.GraphicsFormat m_CoCFormat; - // Settings - public DepthOfField depthOfField { get; set; } - - // Input - public TextureHandle sourceTexture { get; set; } - - // Output - public TextureHandle destinationTexture { get; set; } - public DepthOfFieldGaussianPostProcessPass(Shader shader) { this.renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing - 1; - this.profilingSampler = null; + this.profilingSampler = new ProfilingSampler("Blit Depth of Field (Gaussian)"); m_Material = PostProcessUtils.LoadShader(shader, passName); m_MaterialCoc = PostProcessUtils.LoadShader(shader, passName); @@ -46,30 +38,20 @@ public DepthOfFieldGaussianPostProcessPass(Shader shader) m_CoCFormat = Experimental.Rendering.GraphicsFormat.R8_UNorm; } - public void Dispose() + public override void Dispose() { CoreUtils.Destroy(m_Material); CoreUtils.Destroy(m_MaterialCoc); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsValid() - { - return m_IsValid; + m_IsValid = false; } private class DoFGaussianPassData { - // Setup - internal int downsample; - internal Vector3 cocParams; - internal bool highQualitySamplingValue; - internal bool enableAlphaOutput; // Inputs - internal TextureHandle sourceTexture; - internal TextureHandle depthTexture; internal Material material; internal Material materialCoC; + internal TextureHandle sourceTexture; + internal TextureHandle depthTexture; // Pass textures internal TextureHandle halfCoCTexture; internal TextureHandle fullCoCTexture; @@ -78,21 +60,35 @@ private class DoFGaussianPassData internal RenderTargetIdentifier[] multipleRenderTargets = new RenderTargetIdentifier[2]; // Output textures internal TextureHandle destination; + // Setup + internal Vector3 cocParams; + internal int downsample; + internal bool highQualitySamplingValue; + internal bool enableAlphaOutput; }; public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { - Assertions.Assert.IsTrue(sourceTexture.IsValid(), $"Source texture must be set for DepthOfFieldGaussianPostProcessPass."); - Assertions.Assert.IsTrue(destinationTexture.IsValid(), $"Destination texture must be set for DepthOfFieldGaussianPostProcessPass."); + if (!m_IsValid) + return; + + var depthOfField = volumeStack.GetComponent(); + if (!depthOfField.IsActive() || depthOfField.mode.value != DepthOfFieldMode.Gaussian) + return; UniversalCameraData cameraData = frameData.Get(); + if (cameraData.isSceneViewCamera) + return; + UniversalResourceData resourceData = frameData.Get(); + var sourceTexture = resourceData.cameraColor; + var destinationTexture = PostProcessUtils.CreateCompatibleTexture(renderGraph, sourceTexture, k_TargetName, true, FilterMode.Bilinear); + var srcDesc = sourceTexture.GetDescriptor(renderGraph); var colorFormat = srcDesc.colorFormat; - int downSample = 2; - int wh = srcDesc.width / downSample; - int hh = srcDesc.height / downSample; + int wh = srcDesc.width / k_DownSample; + int hh = srcDesc.height / k_DownSample; // Pass Textures var fullCoCTextureDesc = PostProcessUtils.GetCompatibleDescriptor(srcDesc, srcDesc.width, srcDesc.height, m_CoCFormat); @@ -104,7 +100,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer var pongTextureDesc = PostProcessUtils.GetCompatibleDescriptor(srcDesc, wh, hh, colorFormat); var pongTexture = PostProcessUtils.CreateCompatibleTexture(renderGraph, pongTextureDesc, "_PongTexture", true, FilterMode.Bilinear); - using (var builder = renderGraph.AddUnsafePass("Depth of Field - Gaussian", out var passData)) + using (var builder = renderGraph.AddUnsafePass(passName, out var passData, profilingSampler)) { // Setup float farStart = depthOfField.gaussianStart.value; @@ -116,7 +112,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer float maxRadius = depthOfField.gaussianMaxRadius.value * (wh / 1080f); maxRadius = Mathf.Min(maxRadius, 2f); - passData.downsample = downSample; + passData.downsample = k_DownSample; passData.cocParams = new Vector3(farStart, farEnd, maxRadius); passData.highQualitySamplingValue = depthOfField.highQualitySampling.value; passData.enableAlphaOutput = cameraData.isAlphaOutputEnabled; @@ -221,6 +217,8 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer } }); } + + resourceData.cameraColor = destinationTexture; } // Precomputed shader ids to same some CPU cycles (mostly affects mobile) diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/FinalPostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/FinalPostProcessPass.cs index 7977b316cc0..27c33bf3dbe 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/FinalPostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/FinalPostProcessPass.cs @@ -4,13 +4,13 @@ namespace UnityEngine.Rendering.Universal { - internal sealed class FinalPostProcessPass : ScriptableRenderPass, IDisposable + internal sealed class FinalPostProcessPass : PostProcessPass { Material m_Material; - Texture2D[] m_FilmGrainTextures; + bool m_IsValid; - public enum SamplingOperation + public enum FilteringOperation { Linear, Point, @@ -18,12 +18,12 @@ public enum SamplingOperation FsrSharpening } - SamplingOperation m_SamplingOperation; + Texture m_DitherTexture; + FilteringOperation m_FilteringOperation; HDROutputUtils.Operation m_HdrOperations; bool m_ApplySrgbEncoding; - //NOTE: This is used to communicate if FXAA is already done in the previous pass. - bool m_ApplyFxaa; - Texture m_DitherTexture; + bool m_ApplyFxaa; // NOTE: This is used to communicate if FXAA is already done in the previous pass. + bool m_RenderOverlayUI; public FinalPostProcessPass(Shader shader, Texture2D[] filmGrainTextures) { @@ -31,22 +31,32 @@ public FinalPostProcessPass(Shader shader, Texture2D[] filmGrainTextures) this.profilingSampler = new ProfilingSampler("Blit Final Post Processing"); m_Material = PostProcessUtils.LoadShader(shader, passName); - + m_IsValid = m_Material != null; m_FilmGrainTextures = filmGrainTextures; + + // Defaults + m_FilteringOperation = FilteringOperation.Linear; // Common case. + m_HdrOperations = HDROutputUtils.Operation.None; // HDR disabled by default. + m_ApplySrgbEncoding = false; // sRGB conversion is typically automatic based on format. + m_ApplyFxaa = true; // Upscale disabled by default. Apply FXAA in final pass. + m_RenderOverlayUI = false; // HDR disabled by default. HDR only. } - public void Dispose() + public override void Dispose() { CoreUtils.Destroy(m_Material); + m_IsValid = false; } - public void Setup(SamplingOperation samplingOperation, HDROutputUtils.Operation hdrOperations, bool applySrgbEncoding, bool applyFxaa, Texture ditherTexture) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public void Setup(Texture ditherTexture, FilteringOperation filteringOperation, HDROutputUtils.Operation hdrOperations, bool applySrgbEncoding, bool applyFxaa, bool renderOverlayUI) { - m_SamplingOperation = samplingOperation; + m_DitherTexture = ditherTexture; + m_FilteringOperation = filteringOperation; m_HdrOperations = hdrOperations; m_ApplySrgbEncoding = applySrgbEncoding; m_ApplyFxaa = applyFxaa; - m_DitherTexture = ditherTexture; + m_RenderOverlayUI = renderOverlayUI; } private class PostProcessingFinalBlitPassData @@ -57,7 +67,7 @@ private class PostProcessingFinalBlitPassData internal UniversalCameraData cameraData; internal Tonemapping tonemapping; - internal SamplingOperation samplingOperation; + internal FilteringOperation filteringOperation; internal HDROutputUtils.Operation hdrOperations; internal UberPostProcessPass.FilmGrainParams filmGrain; @@ -68,19 +78,17 @@ private class PostProcessingFinalBlitPassData } public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { - if (m_Material == null) + if (!m_IsValid) return; - //TODO get stack from VolumeEffect class in later PR - Tonemapping tonemapping = VolumeManager.instance.stack.GetComponent(); - FilmGrain filmGrain = VolumeManager.instance.stack.GetComponent(); + var tonemapping = volumeStack.GetComponent(); + var filmGrain = volumeStack.GetComponent(); var cameraData = frameData.Get(); var resourceData = frameData.Get(); var sourceTexture = resourceData.cameraColor; var destinationTexture = resourceData.backBufferColor; //By definition this pass blits to the backbuffer - var overlayUITexture = resourceData.overlayUITexture; // Final blit pass using (var builder = renderGraph.AddRasterRenderPass(passName, out var passData, profilingSampler)) @@ -92,14 +100,15 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer passData.sourceTexture = sourceTexture; builder.UseTexture(sourceTexture, AccessFlags.Read); - if (overlayUITexture.IsValid()) - builder.UseTexture(overlayUITexture, AccessFlags.Read); + // NOTE: Global texture. 'overlayUITexture' is bound by the DrawOffscreenUIPass pass if needed. Not in FinalPostProcessPass. + if (m_RenderOverlayUI) + builder.UseTexture(resourceData.overlayUITexture, AccessFlags.Read); passData.material = m_Material; passData.cameraData = cameraData; passData.tonemapping = tonemapping; - passData.samplingOperation = m_SamplingOperation; + passData.filteringOperation = m_FilteringOperation; passData.hdrOperations = m_HdrOperations; passData.filmGrain.Setup(filmGrain, m_FilmGrainTextures, cameraData.pixelWidth, cameraData.pixelHeight); @@ -128,31 +137,30 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer var cmd = context.cmd; var material = data.material; var cameraData = data.cameraData; - var samplingOperation = data.samplingOperation; + var filteringOperation = data.filteringOperation; var requireHDROutput = PostProcessUtils.RequireHDROutput(cameraData); var isAlphaOutputEnabled = cameraData.isAlphaOutputEnabled; var applyFxaa = data.applyFxaa; var hdrColorEncoding = data.hdrOperations.HasFlag(HDROutputUtils.Operation.ColorEncoding); var applySrgbEncoding = data.applySrgbEncoding; RTHandle sourceTextureHdl = data.sourceTexture; - RTHandle destinationTextureHdl = data.destinationTexture; // Clear shader keywords state material.shaderKeywords = null; - switch (samplingOperation) + switch (filteringOperation) { - case SamplingOperation.Point: + case FilteringOperation.Point: material.EnableKeyword(ShaderKeywordStrings.PointSampling); break; - case SamplingOperation.TaaSharpening: + case FilteringOperation.TaaSharpening: // Reuse RCAS as a standalone sharpening filter for TAA. // If FSR is enabled then it overrides the sharpening/TAA setting and we skip it. material.EnableKeyword(ShaderKeywordStrings.Rcas); FSRUtils.SetRcasConstantsLinear(cmd, data.cameraData.taaSettings.contrastAdaptiveSharpening); // TODO: Global state constants. break; - case SamplingOperation.FsrSharpening: + case FilteringOperation.FsrSharpening: // RCAS // Use the override value if it's available, otherwise use the default. float sharpness = data.cameraData.fsrOverrideSharpness ? data.cameraData.fsrSharpness : FSRUtils.kDefaultSharpnessLinear; @@ -165,7 +173,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer FSRUtils.SetRcasConstantsLinear(cmd, sharpness); // TODO: Global state constants. } break; - case SamplingOperation.Linear: goto default; + case FilteringOperation.Linear: goto default; default: break; } diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/Fsr1UpscalePostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/Fsr1UpscalePostProcessPass.cs index 24e46dd6a01..9299750d8f2 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/Fsr1UpscalePostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/Fsr1UpscalePostProcessPass.cs @@ -4,15 +4,14 @@ namespace UnityEngine.Rendering.Universal { - internal sealed class Fsr1UpscalePostProcessPass : ScriptableRenderPass, IDisposable + internal sealed class Fsr1UpscalePostProcessPass : PostProcessPass { + public const string k_TargetName = "CameraColorUpscaled"; + Material m_Material; bool m_IsValid; - // Input - public TextureHandle sourceTexture { get; set; } - // Output - public TextureHandle destinationTexture { get; set; } + TextureDesc m_UpscaledDesc; public Fsr1UpscalePostProcessPass(Shader shader) { @@ -21,36 +20,47 @@ public Fsr1UpscalePostProcessPass(Shader shader) m_Material = PostProcessUtils.LoadShader(shader, passName); m_IsValid = m_Material != null; - } - public void Dispose() - { - CoreUtils.Destroy(m_Material); + // Default + PostProcessUtils.MakeCompatible(ref m_UpscaledDesc); + m_UpscaledDesc.width = 1; // Unknown at pipe/pass construction time. Safe default. Avoid division by zero. + m_UpscaledDesc.height = 1; + m_UpscaledDesc.format = Experimental.Rendering.GraphicsFormat.B10G11R11_UFloatPack32; // URP default. } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsValid() + public override void Dispose() { - return m_IsValid; + CoreUtils.Destroy(m_Material); + m_IsValid = false; } private class PostProcessingFinalFSRScalePassData { - internal TextureHandle sourceTexture; internal Material material; + internal TextureHandle sourceTexture; internal Vector2 fsrInputSize; internal Vector2 fsrOutputSize; internal bool enableAlphaOutput; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public void Setup(TextureDesc upscaledDesc) + { + m_UpscaledDesc = upscaledDesc; + } + public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { - Assertions.Assert.IsTrue(sourceTexture.IsValid(), $"Source texture must be set for Fsr1UpscalePostProcessPass."); - Assertions.Assert.IsTrue(destinationTexture.IsValid(), $"Destination texture must be set for Fsr1UpscalePostProcessPass."); + if (!m_IsValid) + return; - UniversalCameraData cameraData = frameData.Get(); + var cameraData = frameData.Get(); + var resourceData = frameData.Get(); + var sourceTexture = resourceData.cameraColor; var srcDesc = renderGraph.GetTextureDesc(sourceTexture); + + var destinationTexture = PostProcessUtils.CreateCompatibleTexture(renderGraph, m_UpscaledDesc, k_TargetName, true, FilterMode.Point); var dstDesc = renderGraph.GetTextureDesc(destinationTexture); // FSR upscale @@ -79,8 +89,9 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer Vector2 viewportScale = sourceHdl.useScaling ? new Vector2(sourceHdl.rtHandleProperties.rtHandleScale.x, sourceHdl.rtHandleProperties.rtHandleScale.y) : Vector2.one; Blitter.BlitTexture(context.cmd, data.sourceTexture, viewportScale, material, 0); }); - return; } + + resourceData.cameraColor = destinationTexture; } diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/LensFlareDataDrivenPostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/LensFlareDataDrivenPostProcessPass.cs index d9241fc6b5b..b389ab3bba3 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/LensFlareDataDrivenPostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/LensFlareDataDrivenPostProcessPass.cs @@ -4,36 +4,28 @@ namespace UnityEngine.Rendering.Universal { - internal sealed class LensFlareDataDrivenPostProcessPass : ScriptableRenderPass, IDisposable + internal sealed class LensFlareDataDrivenPostProcessPass : PostProcessPass { Material m_Material; bool m_IsValid; - // Settings - public PaniniProjection paniniProjection { get; set; } // Note: dependency to another pass - - // Input - - // Output - public TextureHandle destinationTexture { get; set; } + const string k_passNameOcclusion = "Blit Lens Flare Occlusion"; + ProfilingSampler m_ProfilingSamplerOcclusion; public LensFlareDataDrivenPostProcessPass(Shader shader) { this.renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing - 1; - this.profilingSampler = null; + this.profilingSampler = new ProfilingSampler("Blit Lens Flares (Data Driven)"); + m_ProfilingSamplerOcclusion = new ProfilingSampler(k_passNameOcclusion); m_Material = PostProcessUtils.LoadShader(shader, passName); m_IsValid = m_Material != null; } - public void Dispose() + public override void Dispose() { CoreUtils.Destroy(m_Material); - } - - public bool IsValid() - { - return m_IsValid; + m_IsValid = false; } private class LensFlarePassData @@ -51,25 +43,35 @@ private class LensFlarePassData public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { - Assertions.Assert.IsTrue(destinationTexture.IsValid(), $"Destination texture must be set for LensFlareDataDrivenPostProcessPass."); + if (!m_IsValid) + return; + + var postProcessingData = frameData.Get(); + if (LensFlareCommonSRP.Instance.IsEmpty() || !postProcessingData.supportDataDrivenLensFlare) + return; var cameraData = frameData.Get(); var resourceData = frameData.Get(); + // No "sourceTexture". Source is procedurally generated. + var destinationTexture = resourceData.cameraColor; + // Reset keywords m_Material.shaderKeywords = null; var desc = destinationTexture.GetDescriptor(renderGraph); + var paniniProjection = volumeStack.GetComponent(); + if (LensFlareCommonSRP.IsOcclusionRTCompatible()) - LensFlareDataDrivenComputeOcclusion(renderGraph, resourceData, cameraData, in desc); + LensFlareDataDrivenComputeOcclusion(renderGraph, resourceData, cameraData, in desc, paniniProjection); - RenderLensFlareDataDriven(renderGraph, resourceData, cameraData, destinationTexture, in desc); + RenderLensFlareDataDriven(renderGraph, resourceData, cameraData, destinationTexture, in desc, paniniProjection); } - void LensFlareDataDrivenComputeOcclusion(RenderGraph renderGraph, UniversalResourceData resourceData, UniversalCameraData cameraData, in TextureDesc dstDesc) + void LensFlareDataDrivenComputeOcclusion(RenderGraph renderGraph, UniversalResourceData resourceData, UniversalCameraData cameraData, in TextureDesc dstDesc, PaniniProjection paniniProjection) { - using (var builder = renderGraph.AddUnsafePass("Lens Flare Compute Occlusion", out var passData, ProfilingSampler.Get(URPProfileId.LensFlareDataDrivenComputeOcclusion))) + using (var builder = renderGraph.AddUnsafePass(k_passNameOcclusion, out var passData, m_ProfilingSamplerOcclusion)) { TextureHandle occlusionHandle = renderGraph.ImportTexture(LensFlareCommonSRP.occlusionRT); passData.destinationTexture = occlusionHandle; @@ -162,9 +164,9 @@ void LensFlareDataDrivenComputeOcclusion(RenderGraph renderGraph, UniversalResou } } - void RenderLensFlareDataDriven(RenderGraph renderGraph, UniversalResourceData resourceData, UniversalCameraData cameraData, in TextureHandle destination, in TextureDesc srcDesc) + void RenderLensFlareDataDriven(RenderGraph renderGraph, UniversalResourceData resourceData, UniversalCameraData cameraData, in TextureHandle destination, in TextureDesc srcDesc, PaniniProjection paniniProjection) { - using (var builder = renderGraph.AddUnsafePass("Lens Flare Data Driven Pass", out var passData, ProfilingSampler.Get(URPProfileId.LensFlareDataDriven))) + using (var builder = renderGraph.AddUnsafePass(passName, out var passData, profilingSampler)) { // Use WriteTexture here because DoLensFlareDataDrivenCommon will call SetRenderTarget internally. // TODO RENDERGRAPH: convert SRP core lens flare to be rendergraph friendly diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/LensFlareScreenSpacePostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/LensFlareScreenSpacePostProcessPass.cs index 2a551339fa4..23d0c14500d 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/LensFlareScreenSpacePostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/LensFlareScreenSpacePostProcessPass.cs @@ -4,49 +4,49 @@ namespace UnityEngine.Rendering.Universal { - internal sealed class LensFlareScreenSpacePostProcessPass : ScriptableRenderPass, IDisposable + internal sealed class LensFlareScreenSpacePostProcessPass : PostProcessPass { Material m_Material; bool m_IsValid; - // Settings - public ScreenSpaceLensFlare lensFlareScreenSpace { get; set; } - - public bool sameSourceDestinationTexture { get; set; } = false; - - // Input - // Post-processing main color-buffer texture desc. Can be different from downsampled bloom/flare textures. - public TextureDesc colorBufferTextureDesc { get; set; } - - // Flare streaks are generated from this texture. Typically, a lower resolution downsampled bloom (mipN) texture. - public TextureHandle sourceTexture { get; set; } - - // Flare is blended to the destination. Typically, the bloom (mip0) texture. Bloom can be at different resolution compared to the main color source. - public TextureHandle destinationTexture { get; set; } + int m_ColorBufferWidth; + int m_ColorBufferHeight; + int m_FlareSourceBloomMipIndex; public LensFlareScreenSpacePostProcessPass(Shader shader) { this.renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing - 1; - this.profilingSampler = null; + this.profilingSampler = new ProfilingSampler("Blit Lens Flares (Screen Space)"); m_Material = PostProcessUtils.LoadShader(shader, passName); m_IsValid = m_Material != null; + + // Default values + m_ColorBufferWidth = 1; // Unknown at pipe/pass construction time. Safe default. Avoid division by zero. + m_ColorBufferHeight = 1; + m_FlareSourceBloomMipIndex = 0; // Safe. Mip pyramid might not exist. } - public void Dispose() + public override void Dispose() { CoreUtils.Destroy(m_Material); + m_IsValid = false; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsValid() + public void Setup(int colorBufferWidth, int colorBufferHeight, int flareSourceBloomMipIndex) { - return m_IsValid; + m_ColorBufferWidth = colorBufferWidth; + m_ColorBufferHeight = colorBufferHeight; + m_FlareSourceBloomMipIndex = flareSourceBloomMipIndex; } private class LensFlareScreenSpacePassData { + internal Material material; + internal ScreenSpaceLensFlare lensFlareScreenSpace; + internal Camera camera; internal TextureHandle streakTmpTexture; internal TextureHandle streakTmpTexture2; internal TextureHandle flareResultTmp; @@ -54,33 +54,48 @@ private class LensFlareScreenSpacePassData internal TextureHandle flareSourceBloomMipTexture; internal int actualColorWidth; internal int actualColorHeight; - internal Camera camera; - internal Material material; - internal ScreenSpaceLensFlare lensFlareScreenSpace; internal int downsample; } public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { - Assertions.Assert.IsTrue(sourceTexture.IsValid(), $"Source texture must be set for LensFlareScreenSpacePostProcessPass."); - Assertions.Assert.IsTrue(destinationTexture.IsValid(), $"Destination texture must be set for LensFlareScreenSpacePostProcessPass."); + if (!m_IsValid) + return; + + if (!IsActive(volumeStack, frameData)) + return; + + var lensFlareScreenSpace = volumeStack.GetComponent(); + var bloom = volumeStack.GetComponent(); + + // Check if Flare source and Flare target is the same texture. In practice BloomMip[0] + // TODO: Check src/dst handle equality in the future. + // Kawase blur does not use the mip pyramid. + // It is safe to pass the same texture to both input/output. + bool useDestinationAsSource = m_FlareSourceBloomMipIndex == 0 || bloom.filter.value == BloomFilterMode.Kawase; + + var resourceData = frameData.Get(); + var cameraData = frameData.Get(); - UniversalCameraData cameraData = frameData.Get(); - Camera camera = cameraData.camera; + // Flare streaks are generated from this texture. Typically, a lower resolution downsampled bloom (mipN) texture. + var sourceTexture = resourceData.cameraColor; + // Flare is blended to the destination. Typically, the bloom (mip0) texture. Bloom can be at different resolution compared to the main color source. + var destinationTexture = resourceData.bloom; var downsample = (int) lensFlareScreenSpace.resolution.value; - int flareRenderWidth = Math.Max( colorBufferTextureDesc.width / downsample, 1); - int flareRenderHeight = Math.Max( colorBufferTextureDesc.height / downsample, 1); + int flareRenderWidth = Math.Max( m_ColorBufferWidth / downsample, 1); + int flareRenderHeight = Math.Max( m_ColorBufferHeight / downsample, 1); - var streakTextureDesc = PostProcessUtils.GetCompatibleDescriptor(colorBufferTextureDesc, flareRenderWidth, flareRenderHeight, colorBufferTextureDesc.colorFormat); + var streakDesc = renderGraph.GetTextureDesc(resourceData.cameraColor); + var streakTextureDesc = PostProcessUtils.GetCompatibleDescriptor(streakDesc, flareRenderWidth, flareRenderHeight, streakDesc.colorFormat); var streakTmpTexture = PostProcessUtils.CreateCompatibleTexture(renderGraph, streakTextureDesc, "_StreakTmpTexture", true, FilterMode.Bilinear); var streakTmpTexture2 = PostProcessUtils.CreateCompatibleTexture(renderGraph, streakTextureDesc, "_StreakTmpTexture2", true, FilterMode.Bilinear); // NOTE: Result texture is the result of the flares/streaks only. Not the final output which is "bloom + flares". var resultTmpTexture = PostProcessUtils.CreateCompatibleTexture(renderGraph, streakTextureDesc, "_LensFlareScreenSpace", true, FilterMode.Bilinear); - using (var builder = renderGraph.AddUnsafePass("Blit Lens Flare Screen Space", out var passData, ProfilingSampler.Get(URPProfileId.LensFlareScreenSpace))) + using (var builder = renderGraph.AddUnsafePass(passName, out var passData, profilingSampler)) { // Use WriteTexture here because DoLensFlareScreenSpaceCommon will call SetRenderTarget internally. // TODO RENDERGRAPH: convert SRP core lensflare to be rendergraph friendly @@ -92,11 +107,11 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer builder.UseTexture(sourceTexture, AccessFlags.ReadWrite); passData.flareDestinationBloomTexture = destinationTexture; // Input/Output can be the same texture. There's a temp texture in between. Avoid RG double write error. - if(!sameSourceDestinationTexture) + if(!useDestinationAsSource) builder.UseTexture(destinationTexture, AccessFlags.ReadWrite); - passData.actualColorWidth = colorBufferTextureDesc.width; - passData.actualColorHeight = colorBufferTextureDesc.height; - passData.camera = camera; + passData.actualColorWidth = m_ColorBufferWidth; + passData.actualColorHeight = m_ColorBufferHeight; + passData.camera = cameraData.camera; passData.material = m_Material; passData.lensFlareScreenSpace = lensFlareScreenSpace; // NOTE: reference, assumed constant until executed. passData.downsample = downsample; @@ -151,5 +166,15 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer }); } } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + static internal bool IsActive(VolumeStack volumeStack, ContextContainer frameData) + { + var lensFlareScreenSpace = volumeStack.GetComponent(); + if (!lensFlareScreenSpace.IsActive()) + return false; + + return frameData.Get().supportScreenSpaceLensFlare; + } } } diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/MotionBlurPostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/MotionBlurPostProcessPass.cs index 38c329bb7d0..5775f9c4eef 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/MotionBlurPostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/MotionBlurPostProcessPass.cs @@ -4,68 +4,84 @@ namespace UnityEngine.Rendering.Universal { - internal sealed class MotionBlurPostProcessPass : ScriptableRenderPass, IDisposable + internal sealed class MotionBlurPostProcessPass : PostProcessPass { - public const string k_TargetName = "_MotionBlurTarget"; + public const string k_TargetName = "CameraColorMotionBlur"; Material m_Material; bool m_IsValid; - // Settings - public MotionBlur motionBlur { get; set; } - - // Input - public TextureHandle sourceTexture { get; set; } - // Output - public TextureHandle destinationTexture { get; set; } - public MotionBlurPostProcessPass(Shader shader) { this.renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing - 1; - this.profilingSampler = null; + this.profilingSampler = new ProfilingSampler("Blit Motion Blur"); m_Material = PostProcessUtils.LoadShader(shader, passName); m_IsValid = m_Material != null; } - public void Dispose() + public override void Dispose() { CoreUtils.Destroy(m_Material); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsValid() - { - return m_IsValid; + m_IsValid = false; } private class MotionBlurPassData { - internal TextureHandle sourceTexture; internal Material material; - internal int passIndex; internal Camera camera; - internal Experimental.Rendering.XRPass xr; + internal TextureHandle sourceTexture; + internal int passIndex; internal float intensity; internal float clamp; internal bool enableAlphaOutput; + internal Experimental.Rendering.XRPass xr; } public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { - Assertions.Assert.IsTrue(sourceTexture.IsValid(), $"Source texture must be set for MotionBlurPostProcessPass."); - Assertions.Assert.IsTrue(destinationTexture.IsValid(), $"Destination texture must be set for MotionBlurPostProcessPass."); + if(!m_IsValid) + return; + + // Disable MotionBlur in EditMode, so that editing remains clear and readable. + // NOTE: HDRP does the same via CoreUtils::AreAnimatedMaterialsEnabled(). + // Disable MotionBlurMode.CameraAndObjects on renderers that do not support motion vectors + if(!Application.isPlaying) + return; + + var motionBlur = volumeStack.GetComponent(); + if (!motionBlur.IsActive()) + return; UniversalCameraData cameraData = frameData.Get(); - UniversalResourceData resourceData = frameData.Get(); + if (cameraData.isSceneViewCamera) + return; + UniversalResourceData resourceData = frameData.Get(); TextureHandle motionVectorColor = resourceData.motionVectorColor; + + if (motionBlur.mode.value == MotionBlurMode.CameraAndObjects) + { + if(!motionVectorColor.IsValid()) + { + var warning = "Disabling Motion Blur for Camera And Objects because of missing motion vectors. The renderer might not support rendering motion vectors."; + const int warningThrottleFrames = 60 * 1; // 60 FPS * 1 sec + if (Time.frameCount % warningThrottleFrames == 0) + Debug.LogWarning(warning); + + return; + } + } + + var sourceTexture = resourceData.cameraColor; + var destinationTexture = PostProcessUtils.CreateCompatibleTexture(renderGraph, sourceTexture, k_TargetName, true, FilterMode.Bilinear); + TextureHandle cameraDepthTexture = resourceData.cameraDepthTexture; var mode = motionBlur.mode.value; int passIndex = (int)motionBlur.quality.value; passIndex += (mode == MotionBlurMode.CameraAndObjects) ? ShaderPass.k_CameraAndObjectMotionBlurLow : ShaderPass.k_CameraMotionBlurLow; - using (var builder = renderGraph.AddRasterRenderPass("Motion Blur", out var passData, ProfilingSampler.Get(URPProfileId.RG_MotionBlur))) + using (var builder = renderGraph.AddRasterRenderPass(passName, out var passData, profilingSampler)) { builder.SetRenderAttachment(destinationTexture, 0, AccessFlags.Write); passData.sourceTexture = sourceTexture; @@ -84,10 +100,10 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer passData.material = m_Material; passData.passIndex = passIndex; passData.camera = cameraData.camera; - passData.xr = cameraData.xr; passData.enableAlphaOutput = cameraData.isAlphaOutputEnabled; passData.intensity = motionBlur.intensity.value; passData.clamp = motionBlur.clamp.value; + passData.xr = cameraData.xr; builder.SetRenderFunc(static (MotionBlurPassData data, RasterGraphContext context) => { var cmd = context.cmd; @@ -104,9 +120,9 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer Vector2 viewportScale = sourceTextureHdl.useScaling ? new Vector2(sourceTextureHdl.rtHandleProperties.rtHandleScale.x, sourceTextureHdl.rtHandleProperties.rtHandleScale.y) : Vector2.one; Blitter.BlitTexture(cmd, sourceTextureHdl, viewportScale, data.material, data.passIndex); }); - - return; } + + resourceData.cameraColor = destinationTexture; } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/PaniniProjectionPostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/PaniniProjectionPostProcessPass.cs index 913a23aa497..6d39e573fdd 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/PaniniProjectionPostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/PaniniProjectionPostProcessPass.cs @@ -4,40 +4,26 @@ namespace UnityEngine.Rendering.Universal { - internal sealed class PaniniProjectionPostProcessPass : ScriptableRenderPass, IDisposable + internal sealed class PaniniProjectionPostProcessPass : PostProcessPass { - public const string k_TargetName = "_PaniniProjectionTarget"; + public const string k_TargetName = "CameraColorPaniniProjection"; Material m_Material; bool m_IsValid; - // Settings - public PaniniProjection paniniProjection { get; set; } - - // Input - public TextureHandle sourceTexture { get; set; } - - // Output - public TextureHandle destinationTexture { get; set; } - public PaniniProjectionPostProcessPass(Shader shader) { this.renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing - 1; - this.profilingSampler = null; + this.profilingSampler = new ProfilingSampler("Blit Panini Projection"); m_Material = PostProcessUtils.LoadShader(shader, passName); m_IsValid = m_Material != null; } - public void Dispose() + public override void Dispose() { CoreUtils.Destroy(m_Material); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsValid() - { - return m_IsValid; + m_IsValid = false; } private class PaniniProjectionPassData @@ -49,10 +35,22 @@ private class PaniniProjectionPassData } public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { - Assertions.Assert.IsTrue(sourceTexture.IsValid(), $"Source texture must be set for PaniniProjectionPostProcessPass."); - Assertions.Assert.IsTrue(destinationTexture.IsValid(), $"Destination texture must be set for PaniniProjectionPostProcessPass."); + if(!m_IsValid) + return; + + var paniniProjection = volumeStack.GetComponent(); + + if(!paniniProjection.IsActive()) + return; UniversalCameraData cameraData = frameData.Get(); + if (cameraData.isSceneViewCamera) + return; + + UniversalResourceData resourceData = frameData.Get(); + var sourceTexture = resourceData.cameraColor; + var destinationTexture = PostProcessUtils.CreateCompatibleTexture(renderGraph, sourceTexture, k_TargetName, true, FilterMode.Bilinear); + Camera camera = cameraData.camera; // Use source width/height for aspect ratio which can be different from camera aspect. (e.g. viewport) @@ -68,7 +66,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer float paniniD = distance; float paniniS = Mathf.Lerp(1f, Mathf.Clamp01(scaleF), paniniProjection.cropToFit.value); - using (var builder = renderGraph.AddRasterRenderPass("Panini Projection", out var passData, ProfilingSampler.Get(URPProfileId.PaniniProjection))) + using (var builder = renderGraph.AddRasterRenderPass(passName, out var passData, profilingSampler)) { builder.AllowGlobalStateModification(true); builder.SetRenderAttachment(destinationTexture, 0, AccessFlags.Write); @@ -89,9 +87,9 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer Vector2 viewportScale = sourceTextureHdl.useScaling ? new Vector2(sourceTextureHdl.rtHandleProperties.rtHandleScale.x, sourceTextureHdl.rtHandleProperties.rtHandleScale.y) : Vector2.one; Blitter.BlitTexture(cmd, sourceTextureHdl, viewportScale, data.material, 0); }); - - return; } + + resourceData.cameraColor = destinationTexture; } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/PostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/PostProcessPass.cs new file mode 100644 index 00000000000..622b938233a --- /dev/null +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/PostProcessPass.cs @@ -0,0 +1,30 @@ +using System; + +namespace UnityEngine.Rendering.Universal +{ + internal abstract class PostProcessPass : ScriptableRenderPass, IDisposable + { + VolumeStack m_VolumeStackOverride; + + public VolumeStack volumeStack + { + get{ + if (m_VolumeStackOverride == null) + { + return VolumeManager.instance.stack; + } + else + { + return m_VolumeStackOverride; + } + } + } + + public VolumeStack volumeStackOverride + { + set { m_VolumeStackOverride = value; } + } + + public abstract void Dispose(); + } +} diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/PostProcessPass.cs.meta b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/PostProcessPass.cs.meta new file mode 100644 index 00000000000..d6e4b4a5941 --- /dev/null +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/PostProcessPass.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 389e75599c6f47399ec151a887fef961 +timeCreated: 1761069683 \ No newline at end of file diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/ScalingSetupPostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/ScalingSetupPostProcessPass.cs index 03f0af2cb7c..38fbd254932 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/ScalingSetupPostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/ScalingSetupPostProcessPass.cs @@ -4,23 +4,14 @@ namespace UnityEngine.Rendering.Universal { - internal sealed class ScalingSetupPostProcessPass : ScriptableRenderPass, IDisposable + internal sealed class ScalingSetupPostProcessPass : PostProcessPass { - public const string k_TargetName = "_ScalingSetupTarget"; + public const string k_TargetName = "SetupUpscaling"; Material m_Material; bool m_IsValid; - // Settings - public Tonemapping tonemapping { get; set; } - - public HDROutputUtils.Operation hdrOperations { get; set; } - - // Input - public TextureHandle sourceTexture { get; set; } - // Output - public TextureHandle destinationTexture { get; set; } - + HDROutputUtils.Operation m_HdrOperations; public ScalingSetupPostProcessPass(Shader shader) { @@ -29,17 +20,21 @@ public ScalingSetupPostProcessPass(Shader shader) m_Material = PostProcessUtils.LoadShader(shader, passName); m_IsValid = m_Material != null; + + // Defaults + m_HdrOperations = HDROutputUtils.Operation.None; // HDR disabled. } - public void Dispose() + public override void Dispose() { CoreUtils.Destroy(m_Material); + m_IsValid = false; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsValid() + public void Setup(HDROutputUtils.Operation hdrOperations) { - return m_IsValid; + m_HdrOperations = hdrOperations; } private class PostProcessingFinalSetupPassData @@ -54,14 +49,30 @@ private class PostProcessingFinalSetupPassData public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { - Assertions.Assert.IsTrue(sourceTexture.IsValid(), $"Source texture must be set for ScalingSetupPostProcessPass."); - Assertions.Assert.IsTrue(destinationTexture.IsValid(), $"Destination texture must be set for ScalingSetupPostProcessPass."); + if (!m_IsValid) + return; + + var tonemapping = volumeStack.GetComponent(); + + var cameraData = frameData.Get(); + var resourceData = frameData.Get(); + + var sourceTexture = resourceData.cameraColor; + + var scalingSetupDesc = renderGraph.GetTextureDesc(sourceTexture); + bool requireHDROutput = PostProcessUtils.RequireHDROutput(cameraData); + if (!requireHDROutput) + { + // Select a UNORM format since we've already performed tonemapping. (Values are in 0-1 range) + // This improves precision and is required if we want to avoid excessive banding when FSR is in use. + scalingSetupDesc.format = UniversalRenderPipeline.MakeUnormRenderTextureGraphicsFormat(); + } + + var destinationTexture = PostProcessUtils.CreateCompatibleTexture(renderGraph, scalingSetupDesc, k_TargetName, true, FilterMode.Point); // Scaled FXAA using (var builder = renderGraph.AddRasterRenderPass(passName, out var passData, profilingSampler)) { - UniversalCameraData cameraData = frameData.Get(); - passData.destinationTexture = destinationTexture; builder.SetRenderAttachment(destinationTexture, 0, AccessFlags.Write); passData.sourceTexture = sourceTexture; @@ -70,7 +81,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer passData.material = m_Material; passData.cameraData = cameraData; passData.tonemapping = tonemapping; - passData.hdrOperations = hdrOperations; + passData.hdrOperations = m_HdrOperations; builder.SetRenderFunc(static (PostProcessingFinalSetupPassData data, RasterGraphContext context) => { @@ -100,6 +111,8 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer PostProcessUtils.ScaleViewportAndBlit(context, data.sourceTexture, data.destinationTexture, data.cameraData, data.material, isFinalPass); }); } + + resourceData.cameraColor = destinationTexture; } diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/SmaaPostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/SmaaPostProcessPass.cs index 2b87e160cba..fb4d7b1395c 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/SmaaPostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/SmaaPostProcessPass.cs @@ -4,9 +4,9 @@ namespace UnityEngine.Rendering.Universal { - internal sealed class SmaaPostProcessPass : ScriptableRenderPass, IDisposable + internal sealed class SmaaPostProcessPass : PostProcessPass { - public const string k_TargetName = "_SMAATarget"; + public const string k_TargetName = "CameraColorSMAA"; Material m_Material; bool m_IsValid; @@ -17,19 +17,18 @@ internal sealed class SmaaPostProcessPass : ScriptableRenderPass, IDisposable Experimental.Rendering.GraphicsFormat m_SMAAEdgeFormat; - // Settings - public AntialiasingQuality antialiasingQuality { get; set; } - - // Input - public TextureHandle sourceTexture { get; set; } - - // Output - public TextureHandle destinationTexture { get; set; } + const string k_passNameEdgeDetection = "Blit SMAA Edge Detection"; + const string k_passNameBlendWeights = "Blit SMAA Blend Weights"; + ProfilingSampler m_ProfilingSamplerEdgeDetection; + ProfilingSampler m_ProfilingSamplerBlendWeights; public SmaaPostProcessPass(Shader shader, Texture2D smaaAreaTexture, Texture2D smaaSearchTexture) { this.renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing - 1; - this.profilingSampler = null; + this.profilingSampler = new ProfilingSampler("Blit SMAA Neighborhood Blending"); + + m_ProfilingSamplerEdgeDetection = new ProfilingSampler(k_passNameEdgeDetection); + m_ProfilingSamplerBlendWeights = new ProfilingSampler(k_passNameBlendWeights); m_Material = PostProcessUtils.LoadShader(shader, passName); m_IsValid = m_Material != null; @@ -45,15 +44,10 @@ public SmaaPostProcessPass(Shader shader, Texture2D smaaAreaTexture, Texture2D s m_SMAAEdgeFormat = Experimental.Rendering.GraphicsFormat.R8G8B8A8_UNorm; } - public void Dispose() + public override void Dispose() { CoreUtils.Destroy(m_Material); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsValid() - { - return m_IsValid; + m_IsValid = false; } private class SMAASetupPassData @@ -77,12 +71,18 @@ private class SMAAPassData public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { - Assertions.Assert.IsTrue(sourceTexture.IsValid(), "Source texture must be set for SmaaPostProcessPass."); - Assertions.Assert.IsTrue(destinationTexture.IsValid(), "Destination texture must be set for SmaaPostProcessPass."); + if (!m_IsValid) + return; - UniversalResourceData resourceData = frameData.Get(); + var cameraData = frameData.Get(); + if (cameraData.antialiasing != AntialiasingMode.SubpixelMorphologicalAntiAliasing) + return; + var resourceData = frameData.Get(); + + var sourceTexture = resourceData.cameraColor; var destDesc = renderGraph.GetTextureDesc(sourceTexture); + var destinationTexture = PostProcessUtils.CreateCompatibleTexture(renderGraph, destDesc, k_TargetName, true, FilterMode.Bilinear); destDesc.clearColor = Color.black; destDesc.clearColor.a = 0.0f; @@ -99,7 +99,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer blendTextureDesc.format = Experimental.Rendering.GraphicsFormat.R8G8B8A8_UNorm; var blendTexture = PostProcessUtils.CreateCompatibleTexture(renderGraph, blendTextureDesc, "_BlendTexture", true, FilterMode.Point); - using (var builder = renderGraph.AddRasterRenderPass("SMAA Edge Detection", out var passData, ProfilingSampler.Get(URPProfileId.RG_SMAAEdgeDetection))) + using (var builder = renderGraph.AddRasterRenderPass(k_passNameEdgeDetection, out var passData, m_ProfilingSamplerEdgeDetection)) { // Material setup const int kStencilBit = 64; @@ -112,7 +112,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer passData.stencilRef = (float)kStencilBit; passData.stencilMask = (float)kStencilBit; - passData.antialiasingQuality = antialiasingQuality; + passData.antialiasingQuality = cameraData.antialiasingQuality; passData.material = m_Material; builder.SetRenderAttachment(edgeTexture, 0, AccessFlags.Write); @@ -136,7 +136,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer }); } - using (var builder = renderGraph.AddRasterRenderPass("SMAA Blend weights", out var passData, ProfilingSampler.Get(URPProfileId.RG_SMAABlendWeight))) + using (var builder = renderGraph.AddRasterRenderPass(k_passNameBlendWeights, out var passData, m_ProfilingSamplerBlendWeights)) { builder.SetRenderAttachment(blendTexture, 0, AccessFlags.Write); builder.SetRenderAttachmentDepth(edgeTextureStencil, AccessFlags.Read); @@ -156,7 +156,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer }); } - using (var builder = renderGraph.AddRasterRenderPass("SMAA Neighborhood blending", out var passData, ProfilingSampler.Get(URPProfileId.RG_SMAANeighborhoodBlend))) + using (var builder = renderGraph.AddRasterRenderPass(passName, out var passData, profilingSampler)) { builder.SetRenderAttachment(destinationTexture, 0, AccessFlags.Write); passData.sourceTexture = sourceTexture; @@ -177,6 +177,8 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer Blitter.BlitTexture(cmd, sourceTextureHdl, viewportScale, SMAAMaterial, ShaderPass.k_NeighborhoodBlending); }); } + + resourceData.cameraColor = destinationTexture; } static void SetupMaterial(SMAASetupPassData data) diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/StopNanPostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/StopNanPostProcessPass.cs index 091adc7a5f6..f906b0c1e74 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/StopNanPostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/StopNanPostProcessPass.cs @@ -4,38 +4,26 @@ namespace UnityEngine.Rendering.Universal { - internal sealed class StopNanPostProcessPass : ScriptableRenderPass, IDisposable + internal sealed class StopNanPostProcessPass : PostProcessPass { - public const string k_TargetName = "_StopNaNsTarget"; + public const string k_TargetName = "CameraColorStopNaNs"; Material m_Material; bool m_IsValid; - // Input - public TextureHandle sourceTexture { get; set; } - - // Output - public TextureHandle destinationTexture { get; set; } - - public StopNanPostProcessPass(Shader shader) { this.renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing - 1; - this.profilingSampler = null; + this.profilingSampler = new ProfilingSampler("Stop NaNs"); m_Material = PostProcessUtils.LoadShader(shader, passName); m_IsValid = m_Material != null; } - public void Dispose() + public override void Dispose() { CoreUtils.Destroy(m_Material); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsValid() - { - return m_IsValid; + m_IsValid = false; } private class StopNaNsPassData @@ -45,11 +33,19 @@ private class StopNaNsPassData } public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { - Assertions.Assert.IsTrue(sourceTexture.IsValid(), $"Source texture must be set for StopNanPostProcessPass."); - Assertions.Assert.IsTrue(destinationTexture.IsValid(), $"Destination texture must be set for StopNanPostProcessPass."); + if (!m_IsValid) + return; + + var cameraData = frameData.Get(); + if (!cameraData.isStopNaNEnabled) + return; - using (var builder = renderGraph.AddRasterRenderPass("Stop NaNs", out var passData, - ProfilingSampler.Get(URPProfileId.RG_StopNaNs))) + var resourceData = frameData.Get(); + var sourceTexture = resourceData.cameraColor; + var destinationTexture = PostProcessUtils.CreateCompatibleTexture(renderGraph, sourceTexture, k_TargetName, true, FilterMode.Bilinear); + + using (var builder = renderGraph.AddRasterRenderPass(passName, out var passData, + profilingSampler)) { builder.SetRenderAttachment(destinationTexture, 0, AccessFlags.ReadWrite); passData.sourceTexture = sourceTexture; @@ -63,6 +59,8 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer Blitter.BlitTexture(cmd, sourceTextureHdl, viewportScale, data.stopNaN, 0); }); } + + resourceData.cameraColor = destinationTexture; } diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/StpPostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/StpPostProcessPass.cs index 1f30a95b9cb..0c6941d3757 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/StpPostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/StpPostProcessPass.cs @@ -4,18 +4,12 @@ namespace UnityEngine.Rendering.Universal { - internal sealed class StpPostProcessPass : ScriptableRenderPass, IDisposable + internal sealed class StpPostProcessPass : PostProcessPass { - public const string k_UpscaledColorTargetName = "_CameraColorUpscaledSTP"; + public const string k_UpscaledColorTargetName = "CameraColorUpscaledSTP"; Texture2D[] m_BlueNoise16LTex; bool m_IsValid; - // Input - public TextureHandle sourceTexture { get; set; } - - // Output - public TextureHandle destinationTexture { get; set; } - public StpPostProcessPass(Texture2D[] blueNoise16LTex) { this.renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing - 1; @@ -25,24 +19,48 @@ public StpPostProcessPass(Texture2D[] blueNoise16LTex) m_IsValid = m_BlueNoise16LTex != null && m_BlueNoise16LTex.Length > 0; } - public void Dispose() + public override void Dispose() { - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsValid() - { - return m_IsValid; + m_IsValid = false; } public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { - Assertions.Assert.IsTrue(sourceTexture.IsValid(), $"Source texture must be set for StpPostProcessPass."); - Assertions.Assert.IsTrue(destinationTexture.IsValid(), $"Destination texture must be set for StpPostProcessPass."); + if (!m_IsValid) + return; + +#if ENABLE_UPSCALER_FRAMEWORK + var postProcessingData = frameData.Get(); + if (postProcessingData.activeUpscaler != null) + return; +#endif + + // Note that enabling jitters uses the same CameraData::IsTemporalAAEnabled(). So if we add any other kind of overrides (like + // disable useTemporalAA if another feature is disabled) then we need to put it in CameraData::IsTemporalAAEnabled() as opposed + // to tweaking the value here. + var cameraData = frameData.Get(); + bool useTemporalAA = cameraData.IsTemporalAAEnabled(); + + // STP is only enabled when TAA is enabled and all of its runtime requirements are met. + // Using IsSTPRequested() vs IsSTPEnabled() for perf reason here, as we already know TAA status + bool isSTPRequested = cameraData.IsSTPRequested(); + bool useSTP = useTemporalAA && isSTPRequested; + if (!useSTP) + { + // Warn users if TAA and STP are disabled despite being requested + if (cameraData.IsTemporalAARequested()) + TemporalAA.ValidateAndWarn(cameraData, isSTPRequested); + return; + } - UniversalCameraData cameraData = frameData.Get(); UniversalResourceData resourceData = frameData.Get(); + var sourceTexture = resourceData.cameraColor; + + var srcDesc = renderGraph.GetTextureDesc(sourceTexture); + var dstDesc = StpPostProcessPass.GetStpTargetDesc(srcDesc, cameraData); + var destinationTexture = PostProcessUtils.CreateCompatibleTexture(renderGraph, dstDesc, k_UpscaledColorTargetName, false, FilterMode.Bilinear); + TextureHandle cameraDepth = resourceData.cameraDepthTexture; TextureHandle motionVectors = resourceData.motionVectorColor; @@ -56,6 +74,8 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer // Update the camera resolution to reflect the upscaled size var destDesc = destinationTexture.GetDescriptor(renderGraph); UpscalerPostProcessPass.UpdateCameraResolution(renderGraph, cameraData, new Vector2Int(destDesc.width, destDesc.height)); + + resourceData.cameraColor = destinationTexture; } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/TemporalAntiAliasingPostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/TemporalAntiAliasingPostProcessPass.cs index 29a71651e66..875a1f9d96f 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/TemporalAntiAliasingPostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/TemporalAntiAliasingPostProcessPass.cs @@ -4,19 +4,13 @@ namespace UnityEngine.Rendering.Universal { - internal sealed class TemporalAntiAliasingPostProcessPass : ScriptableRenderPass, IDisposable + internal sealed class TemporalAntiAliasingPostProcessPass : PostProcessPass { - public const string k_TargetName = "_TemporalAATarget"; + public const string k_TargetName = "CameraColorTemporalAA"; Material m_Material; bool m_IsValid; - // Input - public TextureHandle sourceTexture { get; set; } - - // Output - public TextureHandle destinationTexture { get; set; } - public TemporalAntiAliasingPostProcessPass(Shader shader) { this.renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing - 1; @@ -26,31 +20,52 @@ public TemporalAntiAliasingPostProcessPass(Shader shader) m_IsValid = m_Material != null; } - public void Dispose() + public override void Dispose() { CoreUtils.Destroy(m_Material); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsValid() - { - return m_IsValid; + m_IsValid = false; } public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { - Assertions.Assert.IsTrue(sourceTexture.IsValid(), $"Source texture must be set for TemporalAntiAliasingPostProcessPass."); - Assertions.Assert.IsTrue(destinationTexture.IsValid(), $"Destination texture must be set for TemporalAntiAliasingPostProcessPass."); + if (!m_IsValid) + return; + +#if ENABLE_UPSCALER_FRAMEWORK + var postProcessingData = frameData.Get(); + if (postProcessingData.activeUpscaler != null) + return; +#endif UniversalCameraData cameraData = frameData.Get(); + // We are actually running STP which reuses TAA Jitter. Skip TAA pass. + if (cameraData.IsSTPRequested()) + return; + + // Note that enabling camera jitter uses the same CameraData::IsTemporalAAEnabled(). So if we add any other kind of overrides + // then we need to put it in CameraData::IsTemporalAAEnabled() as opposed + // to tweaking it locally here. + if (!cameraData.IsTemporalAAEnabled()) + { + // Warn users if TAA is disabled despite being requested + if (cameraData.IsTemporalAARequested()) + TemporalAA.ValidateAndWarn(cameraData, false); + return; + } + UniversalResourceData resourceData = frameData.Get(); + var sourceTexture = resourceData.cameraColor; + var destinationTexture = PostProcessUtils.CreateCompatibleTexture(renderGraph, sourceTexture, k_TargetName, false, FilterMode.Bilinear); + TextureHandle cameraDepth = resourceData.cameraDepth; TextureHandle motionVectors = resourceData.motionVectorColor; Debug.Assert(motionVectors.IsValid(), "MotionVectors are invalid. TAA requires a motion vector texture."); TemporalAA.Render(renderGraph, m_Material, cameraData, sourceTexture, in cameraDepth, in motionVectors, destinationTexture); + + resourceData.cameraColor = destinationTexture; } diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/UberPostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/UberPostProcessPass.cs index b2a332f9646..5db78fecaae 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/UberPostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/UberPostProcessPass.cs @@ -4,30 +4,18 @@ namespace UnityEngine.Rendering.Universal { - internal sealed class UberPostProcessPass : ScriptableRenderPass, IDisposable + internal sealed class UberPostProcessPass : PostProcessPass { Material m_Material; - Texture2D[] m_FilmGrainTextures; - // Settings - public ColorLookup colorLookup { get; set; } - public ColorAdjustments colorAdjustments { get; set; } - public Tonemapping tonemapping { get; set; } - public Bloom bloom { get; set; } - - public LensDistortion lensDistortion { get; set; } - public ChromaticAberration chromaticAberration { get; set; } - public Vignette vignette { get; set; } - public FilmGrain filmGrain { get; set; } - - - public bool isFinalPass { get; set; } - public HDROutputUtils.Operation hdrOperations { get; set; } - public bool requireSRGBConversionBlit { get; set; } - public bool useFastSRGBLinearConversion { get; set; } - - public Texture ditherTexture { get; set; } + Texture m_DitherTexture; + RTHandle m_UserLut; + HDROutputUtils.Operation m_HdrOperations; + bool m_IsValid; + bool m_IsFinalPass; + bool m_RequireSRGBConversionBlit; + bool m_RenderOverlayUI; public UberPostProcessPass(Shader shader, Texture2D[] filmGrainTextures) { @@ -35,14 +23,35 @@ public UberPostProcessPass(Shader shader, Texture2D[] filmGrainTextures) this.profilingSampler = new ProfilingSampler("Blit Post Processing"); m_Material = PostProcessUtils.LoadShader(shader, passName); - + m_IsValid = m_Material != null; m_FilmGrainTextures = filmGrainTextures; + + // Defaults + m_DitherTexture = null; // Dither disabled. + m_HdrOperations = HDROutputUtils.Operation.None; // HDR disabled. + m_RequireSRGBConversionBlit = false; // sRGB conversion is typically automatic based on format. + m_IsFinalPass = false; // Assume other passes. + m_RenderOverlayUI = false; // HDR disabled. HDR only. } - public void Dispose() + public override void Dispose() { - CoreUtils.Destroy(m_Material); m_UserLut?.Release(); + CoreUtils.Destroy(m_Material); + m_IsValid = false; + } + + public void Setup(Texture ditherTexture, + HDROutputUtils.Operation hdrOperations, + bool requireSRGBConversionBlit, + bool isFinalPass, + bool renderOverlayUI) + { + m_DitherTexture = ditherTexture; + m_HdrOperations = hdrOperations; + m_RequireSRGBConversionBlit = requireSRGBConversionBlit; + m_IsFinalPass = isFinalPass; + m_RenderOverlayUI = renderOverlayUI; } private class UberPostPassData @@ -76,9 +85,18 @@ private class UberPostPassData /// public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { - if (m_Material == null) + if(!m_IsValid) return; + var colorLookup = volumeStack.GetComponent(); + var colorAdjustments = volumeStack.GetComponent(); + var tonemapping = volumeStack.GetComponent(); + var bloom = volumeStack.GetComponent(); + var lensDistortion = volumeStack.GetComponent(); + var chromaticAberration = volumeStack.GetComponent(); + var vignette = volumeStack.GetComponent(); + var filmGrain = volumeStack.GetComponent(); + var cameraData = frameData.Get(); var postProcessingData = frameData.Get(); var resourceData = frameData.Get(); @@ -101,8 +119,8 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer resourceData.destinationCameraColor //TODO here we don't seem to apply PostProcessUtils.CreateCompatibleTexture. This seems completely out of sync with the other post process passes. //However, changing it, breaks some tests because rendering with the color and depth after this pass when MSAA is on leads to mismatch. - //It seems completely arbitrary that we continue to write out color with MSAA if no other pp pass has been applied earlier. - : renderGraph.CreateTexture(sourceTexture, _CameraColorAfterPostProcessingName); + //It seems completely arbitrary that we continue to write out color with MSAA if no other pp pass has been applied earlier. + : renderGraph.CreateTexture(sourceTexture, _CameraColorAfterPostProcessingName); resourceData.destinationCameraColor = TextureHandle.nullHandle; } @@ -131,7 +149,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer passData.sourceTexture = sourceTexture; builder.UseTexture(sourceTexture, AccessFlags.Read); - if(overlayUITexture.IsValid()) + if(m_RenderOverlayUI && overlayUITexture.IsValid()) builder.UseTexture(overlayUITexture, AccessFlags.Read); builder.UseTexture(internalColorLut, AccessFlags.Read); @@ -143,12 +161,12 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer passData.material = m_Material; passData.cameraData = cameraData; - passData.useFastSRGBLinearConversion = useFastSRGBLinearConversion; - passData.requireSRGBConversionBlit = requireSRGBConversionBlit; + passData.useFastSRGBLinearConversion = postProcessingData.useFastSRGBLinearConversion; + passData.requireSRGBConversionBlit = m_RequireSRGBConversionBlit; // HDR passData.tonemapping = tonemapping; - passData.hdrOperations = hdrOperations; + passData.hdrOperations = m_HdrOperations; passData.isHdrGrading = postProcessingData.gradingMode == ColorGradingMode.HighDynamicRange; passData.lut.Setup(colorAdjustments, colorLookup, postProcessingData.lutSize, internalColorLut, userColorLut); @@ -158,19 +176,17 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer passData.vignette.Setup(vignette, srcDesc.width, srcDesc.height, cameraData.xr); // Final pass effects - if (isFinalPass) + if (m_IsFinalPass) { passData.filmGrain.Setup(filmGrain, m_FilmGrainTextures, cameraData.pixelWidth, cameraData.pixelHeight); - passData.dither.Setup(ditherTexture, cameraData.pixelWidth, cameraData.pixelHeight); + passData.dither.Setup(m_DitherTexture, cameraData.pixelWidth, cameraData.pixelHeight); } - passData.isFinalPass = isFinalPass; + passData.isFinalPass = m_IsFinalPass; builder.SetRenderFunc(static (UberPostPassData data, RasterGraphContext context) => { - var cmd = context.cmd; var cameraData = data.cameraData; var material = data.material; - RTHandle sourceTextureHdl = data.sourceTexture; // Reset keywords material.shaderKeywords = null; @@ -227,7 +243,6 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer else #endif PostProcessUtils.ScaleViewportAndBlit(context, data.sourceTexture, data.destinationTexture, data.cameraData, material, data.isFinalPass); - }); } @@ -238,7 +253,6 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer } #region ColorLut - RTHandle m_UserLut; TextureHandle TryGetCachedUserLutTextureHandle(RenderGraph renderGraph, ColorLookup colorLookup) { if (colorLookup.texture.value == null) @@ -260,26 +274,7 @@ TextureHandle TryGetCachedUserLutTextureHandle(RenderGraph renderGraph, ColorLoo return m_UserLut != null ? renderGraph.ImportTexture(m_UserLut) : TextureHandle.nullHandle; } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void CalcColorLutParams(ColorAdjustments colorAdjustments, ColorLookup colorLookup, int lutHeight, out Vector4 internalLutParams, out Vector4 userLutParams) - { - Assertions.Assert.IsNotNull(colorAdjustments, "SetupColorLut colorAdjustments cannot be null."); - Assertions.Assert.IsNotNull(colorLookup, "SetupColorLut colorLookup cannot be null."); - - int lutWidth = lutHeight * lutHeight; - - float postExposureLinear = Mathf.Pow(2f, colorAdjustments.postExposure.value); - internalLutParams = new Vector4(1f / lutWidth, 1f / lutHeight, lutHeight - 1f, postExposureLinear); - - userLutParams = !colorLookup.IsActive() - ? Vector4.zero - : new Vector4(1f / colorLookup.texture.value.width, - 1f / colorLookup.texture.value.height, - colorLookup.texture.value.height - 1f, - colorLookup.contribution.value); - } - - public struct LutParams + internal struct LutParams { public TextureHandle internalLutTexture; public TextureHandle activeUserLutTexture; @@ -303,46 +298,29 @@ public void Apply(Material material) material.SetVector(ShaderConstants._UserLut_Params, userLutParams); } - } -#endregion - -#region Bloom - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void CalcBloomParams(Bloom bloom, in TextureDesc srcDesc, out Vector4 bloomParams, out bool highQualityFiltering, out Texture dirtTexture, out Vector4 dirtScaleOffset, out float dirtIntensity) - { - using (new ProfilingScope(ProfilingSampler.Get(URPProfileId.RG_UberPostSetupBloomPass))) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void CalcColorLutParams(ColorAdjustments colorAdjustments, ColorLookup colorLookup, int lutHeight, out Vector4 internalLutParams, out Vector4 userLutParams) { - // Setup bloom on uber - var tint = bloom.tint.value.linear; - var luma = ColorUtils.Luminance(tint); - tint = luma > 0f ? tint * (1f / luma) : Color.white; - bloomParams = new Vector4(bloom.intensity.value, tint.r, tint.g, tint.b); - - highQualityFiltering = bloom.highQualityFiltering.value; - - // Setup lens dirtiness on uber - // Keep the aspect ratio correct & center the dirt texture, we don't want it to be - // stretched or squashed - dirtTexture = bloom.dirtTexture.value == null ? Texture2D.blackTexture : bloom.dirtTexture.value; - float dirtRatio = dirtTexture.width / (float)dirtTexture.height; - float screenRatio = srcDesc.width / (float)srcDesc.height; - dirtScaleOffset = new Vector4(1f, 1f, 0f, 0f); - dirtIntensity = bloom.dirtIntensity.value; - - if (dirtRatio > screenRatio) - { - dirtScaleOffset.x = screenRatio / dirtRatio; - dirtScaleOffset.z = (1f - dirtScaleOffset.x) * 0.5f; - } - else if (screenRatio > dirtRatio) - { - dirtScaleOffset.y = dirtRatio / screenRatio; - dirtScaleOffset.w = (1f - dirtScaleOffset.y) * 0.5f; - } + Assertions.Assert.IsNotNull(colorAdjustments, "SetupColorLut colorAdjustments cannot be null."); + Assertions.Assert.IsNotNull(colorLookup, "SetupColorLut colorLookup cannot be null."); + + int lutWidth = lutHeight * lutHeight; + + float postExposureLinear = Mathf.Pow(2f, colorAdjustments.postExposure.value); + internalLutParams = new Vector4(1f / lutWidth, 1f / lutHeight, lutHeight - 1f, postExposureLinear); + + userLutParams = !colorLookup.IsActive() + ? Vector4.zero + : new Vector4(1f / colorLookup.texture.value.width, + 1f / colorLookup.texture.value.height, + colorLookup.texture.value.height - 1f, + colorLookup.contribution.value); } } +#endregion - public struct BloomParams +#region Bloom + internal struct BloomParams { public TextureHandle activeBloomTexture; public Vector4 bloomParams; @@ -380,32 +358,46 @@ public void Apply(Material material) else material.EnableKeyword(dirtIntensity > 0f ? ShaderKeywordStrings.BloomLQDirt : ShaderKeywordStrings.BloomLQ); } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void CalcBloomParams(Bloom bloom, in TextureDesc srcDesc, out Vector4 bloomParams, out bool highQualityFiltering, out Texture dirtTexture, out Vector4 dirtScaleOffset, out float dirtIntensity) + { + using (new ProfilingScope(ProfilingSampler.Get(URPProfileId.RG_UberPostSetupBloomPass))) + { + // Setup bloom on uber + var tint = bloom.tint.value.linear; + var luma = ColorUtils.Luminance(tint); + tint = luma > 0f ? tint * (1f / luma) : Color.white; + bloomParams = new Vector4(bloom.intensity.value, tint.r, tint.g, tint.b); + + highQualityFiltering = bloom.highQualityFiltering.value; + + // Setup lens dirtiness on uber + // Keep the aspect ratio correct & center the dirt texture, we don't want it to be + // stretched or squashed + dirtTexture = bloom.dirtTexture.value == null ? Texture2D.blackTexture : bloom.dirtTexture.value; + float dirtRatio = dirtTexture.width / (float)dirtTexture.height; + float screenRatio = srcDesc.width / (float)srcDesc.height; + dirtScaleOffset = new Vector4(1f, 1f, 0f, 0f); + dirtIntensity = bloom.dirtIntensity.value; + + if (dirtRatio > screenRatio) + { + dirtScaleOffset.x = screenRatio / dirtRatio; + dirtScaleOffset.z = (1f - dirtScaleOffset.x) * 0.5f; + } + else if (screenRatio > dirtRatio) + { + dirtScaleOffset.y = dirtRatio / screenRatio; + dirtScaleOffset.w = (1f - dirtScaleOffset.y) * 0.5f; + } + } + } } #endregion #region Lens Distortion - [MethodImpl(MethodImplOptions.AggressiveInlining)] - static public void CalcLensDistortionParams(LensDistortion lensDistortion, out Vector4 lensDistortionParams1, out Vector4 lensDistortionParams2) - { - float amount = 1.6f * Mathf.Max(Mathf.Abs(lensDistortion.intensity.value * 100f), 1f); - float theta = Mathf.Deg2Rad * Mathf.Min(160f, amount); - float sigma = 2f * Mathf.Tan(theta * 0.5f); - var center = lensDistortion.center.value * 2f - Vector2.one; - lensDistortionParams1 = new Vector4( - center.x, - center.y, - Mathf.Max(lensDistortion.xMultiplier.value, 1e-4f), - Mathf.Max(lensDistortion.yMultiplier.value, 1e-4f) - ); - lensDistortionParams2 = new Vector4( - lensDistortion.intensity.value >= 0f ? theta : 1f / theta, - sigma, - 1f / lensDistortion.scale.value, - lensDistortion.intensity.value * 100f - ); - } - - public struct LensDistortionParams + internal struct LensDistortionParams { public Vector4 lensDistortionParams1; public Vector4 lensDistortionParams2; @@ -432,12 +424,33 @@ public void Apply(Material material) material.EnableKeyword(ShaderKeywordStrings.Distortion); } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + static public void CalcLensDistortionParams(LensDistortion lensDistortion, out Vector4 lensDistortionParams1, out Vector4 lensDistortionParams2) + { + float amount = 1.6f * Mathf.Max(Mathf.Abs(lensDistortion.intensity.value * 100f), 1f); + float theta = Mathf.Deg2Rad * Mathf.Min(160f, amount); + float sigma = 2f * Mathf.Tan(theta * 0.5f); + var center = lensDistortion.center.value * 2f - Vector2.one; + lensDistortionParams1 = new Vector4( + center.x, + center.y, + Mathf.Max(lensDistortion.xMultiplier.value, 1e-4f), + Mathf.Max(lensDistortion.yMultiplier.value, 1e-4f) + ); + lensDistortionParams2 = new Vector4( + lensDistortion.intensity.value >= 0f ? theta : 1f / theta, + sigma, + 1f / lensDistortion.scale.value, + lensDistortion.intensity.value * 100f + ); + } } #endregion #region Chromatic Aberration - public struct ChromaticAberrationParams + internal struct ChromaticAberrationParams { public float chromaticAberrationIntensity; public bool chromaticAberrationActive; @@ -466,34 +479,8 @@ public void Apply(Material material) #endregion #region Vignette - [MethodImpl(MethodImplOptions.AggressiveInlining)] - static public void CalcVignetteParams(Vignette vignette, int width, int height, Experimental.Rendering.XRPass xrPass, out Vector4 vignetteParams1, out Vector4 vignetteParams2) - { - var color = vignette.color.value; - var center = vignette.center.value; - var aspectRatio = width / (float)height; - -#if ENABLE_VR && ENABLE_XR_MODULE - if (xrPass != null && xrPass.enabled && !xrPass.singlePassEnabled) - { - // In multi-pass mode we need to modify the eye center with the values from .xy of the corrected - // center since the version of the shader that is not single-pass will use the value in _Vignette_Params2 - center = xrPass.ApplyXRViewCenterOffset(center); - } -#endif - vignetteParams1 = new Vector4( - color.r, color.g, color.b, - vignette.rounded.value ? aspectRatio : 1f - ); - vignetteParams2 = new Vector4( - center.x, center.y, - vignette.intensity.value * 3f, - vignette.smoothness.value * 5f - ); - } - - public struct VignetteParams + internal struct VignetteParams { public Vector4 vignetteParams1; public Vector4 vignetteParams2; @@ -518,20 +505,38 @@ public void Apply(Material material, Experimental.Rendering.XRPass xrPass) } #endif } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + static public void CalcVignetteParams(Vignette vignette, int width, int height, Experimental.Rendering.XRPass xrPass, out Vector4 vignetteParams1, out Vector4 vignetteParams2) + { + var color = vignette.color.value; + var center = vignette.center.value; + var aspectRatio = width / (float)height; + +#if ENABLE_VR && ENABLE_XR_MODULE + if (xrPass != null && xrPass.enabled && !xrPass.singlePassEnabled) + { + // In multi-pass mode we need to modify the eye center with the values from .xy of the corrected + // center since the version of the shader that is not single-pass will use the value in _Vignette_Params2 + center = xrPass.ApplyXRViewCenterOffset(center); + } +#endif + + vignetteParams1 = new Vector4( + color.r, color.g, color.b, + vignette.rounded.value ? aspectRatio : 1f + ); + vignetteParams2 = new Vector4( + center.x, center.y, + vignette.intensity.value * 3f, + vignette.smoothness.value * 5f + ); + } } #endregion #region Film Grain - // NOTE: Procedural FilmGrain can be done using the custom texture with RenderTexture. No need to import it into the RenderGraph. - const float k_FilmGrainIntensityScale = 4f; - [MethodImpl(MethodImplOptions.AggressiveInlining)] - static public void CalcFilmGrainParams(FilmGrain filmGrain, Texture2D[] filmGrainTextures, out Texture grainTexture, out Vector2 grainParams) - { - grainTexture = (filmGrain.type.value == FilmGrainLookup.Custom) ? filmGrain.texture.value : filmGrainTextures[(int)filmGrain.type.value]; - grainParams = new Vector2(filmGrain.intensity.value * k_FilmGrainIntensityScale, filmGrain.response.value); - } - - public struct FilmGrainParams + internal struct FilmGrainParams { public Texture activeGrainTexture; public Vector4 tilingParams; @@ -560,12 +565,21 @@ public void Apply(Material material) PostProcessUtils.ConfigureFilmGrainMaterial(material, activeGrainTexture, grainParams, tilingParams); material.EnableKeyword(ShaderKeywordStrings.FilmGrain); } + + // NOTE: Procedural FilmGrain can be done using the custom texture with RenderTexture. No need to import it into the RenderGraph. + const float k_FilmGrainIntensityScale = 4f; + [MethodImpl(MethodImplOptions.AggressiveInlining)] + static public void CalcFilmGrainParams(FilmGrain filmGrain, Texture2D[] filmGrainTextures, out Texture grainTexture, out Vector2 grainParams) + { + grainTexture = (filmGrain.type.value == FilmGrainLookup.Custom) ? filmGrain.texture.value : filmGrainTextures[(int)filmGrain.type.value]; + grainParams = new Vector2(filmGrain.intensity.value * k_FilmGrainIntensityScale, filmGrain.response.value); + } } #endregion #region 8-bit Dithering - public struct DitheringParams + internal struct DitheringParams { public Texture activeDitherTexture; public Vector4 tilingParams; diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/UpscalerPostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/UpscalerPostProcessPass.cs index 465c914a48a..c0297b1986c 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/UpscalerPostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/UpscalerPostProcessPass.cs @@ -4,20 +4,12 @@ namespace UnityEngine.Rendering.Universal { - internal sealed class UpscalerPostProcessPass : ScriptableRenderPass, IDisposable + internal sealed class UpscalerPostProcessPass : PostProcessPass { - public const string k_UpscaledColorTargetName = "_CameraColorUpscaled"; + public const string k_UpscaledColorTargetName = "CameraColorUpscaled"; Texture2D[] m_BlueNoise16LTex; bool m_IsValid; - // Settings - - // Input - public TextureHandle sourceTexture { get; set; } - - // Output - public TextureHandle destinationTexture { get; private set; } - public UpscalerPostProcessPass(Texture2D[] blueNoise16LTex) { this.renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing - 1; @@ -27,28 +19,25 @@ public UpscalerPostProcessPass(Texture2D[] blueNoise16LTex) m_IsValid = m_BlueNoise16LTex != null && m_BlueNoise16LTex.Length > 0; } - public void Dispose() - { - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsValid() + public override void Dispose() { - return m_IsValid; + m_IsValid = false; } public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { #if ENABLE_UPSCALER_FRAMEWORK - Assertions.Assert.IsTrue(sourceTexture.IsValid(), $"Source texture must be set for StpPostProcessPass."); + if (!m_IsValid) + return; - // TODO: User should be able to set the destination texture externally. This allows the user to decide where the upscaled texture should be stored. - //Assertions.Assert.IsTrue(destinationTexture.IsValid(), $"Destination texture must be set for StpPostProcessPass."); + UniversalPostProcessingData postProcessingData = frameData.Get(); + if (postProcessingData.activeUpscaler == null) + return; UniversalCameraData cameraData = frameData.Get(); UniversalResourceData resourceData = frameData.Get(); - UniversalPostProcessingData postProcessingData = frameData.Get(); + var sourceTexture = resourceData.cameraColor; var srcDesc = sourceTexture.GetDescriptor(renderGraph); // Create a context item containing upscaling inputs @@ -78,7 +67,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer motionData = additionalCameraData.motionVectorsPersistentData; Debug.Assert(motionData != null); } - io.cameraInstanceID = cameraData.camera.GetInstanceID(); + io.cameraInstanceID = cameraData.camera.GetEntityId(); io.nearClipPlane = cameraData.camera.nearClipPlane; io.farClipPlane = cameraData.camera.farClipPlane; io.fieldOfViewDegrees = cameraData.camera.fieldOfView; @@ -129,7 +118,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer UpdateCameraResolution(renderGraph, cameraData, new Vector2Int(dstDesc.width, dstDesc.height)); // Use the output texture of upscaling - destinationTexture = io.cameraColor; + resourceData.cameraColor = io.cameraColor; #endif } diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/ProbeVolumeDebugPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/ProbeVolumeDebugPass.cs index d1b3d30ea2d..ca929671d1e 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/ProbeVolumeDebugPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/ProbeVolumeDebugPass.cs @@ -36,7 +36,7 @@ class WriteApvData /// /// /// - internal void Render(RenderGraph renderGraph, ContextContainer frameData, TextureHandle depthPyramidBuffer, TextureHandle normalBuffer) + internal void Render(RenderGraph renderGraph, ContextContainer frameData, in TextureHandle depthPyramidBuffer, in TextureHandle normalBuffer) { UniversalCameraData cameraData = frameData.Get(); @@ -58,7 +58,7 @@ internal void Render(RenderGraph renderGraph, ContextContainer frameData, Textur builder.UseTexture(passData.depthBuffer, AccessFlags.Read); builder.UseTexture(passData.normalBuffer, AccessFlags.Read); - builder.SetRenderFunc((WriteApvData data, ComputeGraphContext ctx) => + builder.SetRenderFunc(static (WriteApvData data, ComputeGraphContext ctx) => { int kernel = data.computeShader.FindKernel("ComputePositionNormal"); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/RenderObjectsPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/RenderObjectsPass.cs index ff637b4090d..6cd36815636 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/RenderObjectsPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/RenderObjectsPass.cs @@ -291,7 +291,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer } } - builder.SetRenderFunc((PassData data, RasterGraphContext rgContext) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext rgContext) => { var isYFlipped = RenderingUtils.IsHandleYFlipped(rgContext, in data.color); ExecutePass(data, rgContext.cmd, data.rendererListHdl, isYFlipped); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/ScreenSpaceAmbientOcclusionPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/ScreenSpaceAmbientOcclusionPass.cs index c6481da2fbc..d8b1a6a16fa 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/ScreenSpaceAmbientOcclusionPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/ScreenSpaceAmbientOcclusionPass.cs @@ -373,7 +373,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer builder.SetGlobalTextureAfterPass(finalTexture, s_SSAOFinalTextureID); } - builder.SetRenderFunc((SSAOPassData data, UnsafeGraphContext rgContext) => + builder.SetRenderFunc(static (SSAOPassData data, UnsafeGraphContext rgContext) => { CommandBuffer cmd = CommandBufferHelpers.GetNativeCommandBuffer(rgContext.cmd); RenderBufferLoadAction finalLoadAction = data.afterOpaque ? RenderBufferLoadAction.Load : RenderBufferLoadAction.DontCare; diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/StencilCrossFadeRenderPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/StencilCrossFadeRenderPass.cs index e31575ce8b7..6fbee042467 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/StencilCrossFadeRenderPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/StencilCrossFadeRenderPass.cs @@ -56,7 +56,7 @@ private class PassData /// /// Set render graph pass /// - public void Render(RenderGraph renderGraph, ScriptableRenderContext context, TextureHandle depthTarget) + public void Render(RenderGraph renderGraph, ScriptableRenderContext context, in TextureHandle depthTarget) { using (var builder = renderGraph.AddRasterRenderPass("Prepare Cross Fade Stencil", out var passData, m_ProfilingSampler)) { @@ -64,7 +64,7 @@ public void Render(RenderGraph renderGraph, ScriptableRenderContext context, Tex passData.stencilDitherMaskSeedMaterials = m_StencilDitherMaskSeedMaterials; passData.depthTarget = depthTarget; - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { ExecutePass(context.cmd, data.depthTarget, data.stencilDitherMaskSeedMaterials); }); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/PostProcess.cs b/Packages/com.unity.render-pipelines.universal/Runtime/PostProcess.cs index 08b40f6b033..b1f283bbb1f 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/PostProcess.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/PostProcess.cs @@ -61,7 +61,7 @@ public PostProcess(PostProcessData postProcessResourceAssetData) // Final post processing. m_ScalingSetupFinalPostProcessPass = new ScalingSetupPostProcessPass(m_Resources.shaders.scalingSetupPS); - m_Fsr1UpscaleFinalPostProcessPass = new Fsr1UpscalePostProcessPass(m_Resources.shaders.easuPS); + m_Fsr1UpscaleFinalPostProcessPass = new Fsr1UpscalePostProcessPass(m_Resources.shaders.easuPS); m_FinalPostProcessPass = new FinalPostProcessPass(m_Resources.shaders.finalPostPassPS, m_Resources.textures.filmGrainTex); } @@ -124,278 +124,88 @@ static void UpdateGlobalDebugHandlerPass(RenderGraph renderGraph, UniversalCamer debugHandler?.UpdateShaderGlobalPropertiesForFinalValidationPass(renderGraph, cameraData, isFinalPass && !resolveToDebugScreen); } - const string _CameraColorUpscaled = "_CameraColorUpscaled"; - // If hasFinalPass == true, Film Grain and Dithering are setup in the final pass, otherwise they are setup in this pass. public void RenderPostProcessing(RenderGraph renderGraph, ContextContainer frameData, bool hasFinalPass, bool enableColorEncodingIfNeeded) { var resourceData = frameData.Get(); var cameraData = frameData.Get(); - var postProcessingData = frameData.Get(); - - var stack = VolumeManager.instance.stack; - var depthOfField = stack.GetComponent(); - var motionBlur = stack.GetComponent(); - var paniniProjection = stack.GetComponent(); - var bloom = stack.GetComponent(); - var lensFlareScreenSpace = stack.GetComponent(); - var lensDistortion = stack.GetComponent(); - var chromaticAberration = stack.GetComponent(); - var vignette = stack.GetComponent(); - var colorLookup = stack.GetComponent(); - var colorAdjustments = stack.GetComponent(); - var tonemapping = stack.GetComponent(); - var filmGrain = stack.GetComponent(); - - bool useFastSRGBLinearConversion = postProcessingData.useFastSRGBLinearConversion; - bool supportDataDrivenLensFlare = postProcessingData.supportDataDrivenLensFlare; - bool supportScreenSpaceLensFlare = postProcessingData.supportScreenSpaceLensFlare; - - bool isSceneViewCamera = cameraData.isSceneViewCamera; - - //We blit back and forth without msaa untill the last blit. - bool useStopNan = cameraData.isStopNaNEnabled && m_StopNanPostProcessPass.IsValid(); - bool useSubPixelMorpAA = (cameraData.antialiasing == AntialiasingMode.SubpixelMorphologicalAntiAliasing) && m_SmaaPostProcessPass.IsValid(); - bool useDepthOfField = depthOfField.IsActive() && !isSceneViewCamera && (m_DepthOfFieldGaussianPass.IsValid() || m_DepthOfFieldBokehPass.IsValid()); - bool useLensFlare = !LensFlareCommonSRP.Instance.IsEmpty() && supportDataDrivenLensFlare; - bool useLensFlareScreenSpace = lensFlareScreenSpace.IsActive() && supportScreenSpaceLensFlare; - bool useMotionBlur = motionBlur.IsActive() && !isSceneViewCamera && m_MotionBlurPass.IsValid(); - bool usePaniniProjection = paniniProjection.IsActive() && !isSceneViewCamera && m_PaniniProjectionPass.IsValid(); - - // Disable MotionBlur in EditMode, so that editing remains clear and readable. - // NOTE: HDRP does the same via CoreUtils::AreAnimatedMaterialsEnabled(). - // Disable MotionBlurMode.CameraAndObjects on renderers that do not support motion vectors - useMotionBlur = useMotionBlur && Application.isPlaying; - if (useMotionBlur && motionBlur.mode.value == MotionBlurMode.CameraAndObjects) - { - ScriptableRenderer renderer = cameraData.renderer; - useMotionBlur &= renderer.SupportsMotionVectors(); - if (!useMotionBlur) - { - var warning = "Disabling Motion Blur for Camera And Objects because the renderer does not implement motion vectors."; - const int warningThrottleFrames = 60 * 1; // 60 FPS * 1 sec - if (Time.frameCount % warningThrottleFrames == 0) - Debug.LogWarning(warning); - } - } - - // Note that enabling jitters uses the same CameraData::IsTemporalAAEnabled(). So if we add any other kind of overrides (like - // disable useTemporalAA if another feature is disabled) then we need to put it in CameraData::IsTemporalAAEnabled() as opposed - // to tweaking the value here. - bool useTemporalAA = cameraData.IsTemporalAAEnabled() && m_TemporalAntiAliasingPass.IsValid(); - - // STP is only enabled when TAA is enabled and all of its runtime requirements are met. - // Using IsSTPRequested() vs IsSTPEnabled() for perf reason here, as we already know TAA status - bool isSTPRequested = cameraData.IsSTPRequested(); - bool useSTP = useTemporalAA && isSTPRequested; - - // Warn users if TAA and STP are disabled despite being requested - if (!useTemporalAA && cameraData.IsTemporalAARequested()) - TemporalAA.ValidateAndWarn(cameraData, isSTPRequested); // NOTE: Debug handling injects a global state render pass. UpdateGlobalDebugHandlerPass(renderGraph, cameraData, !hasFinalPass); - TextureHandle currentSource = resourceData.cameraColor; + // We blit back and forth without msaa until the last blit. + // `resourceData.cameraColor` is the current post-process input for each pass. + var colorSourceDesc = resourceData.cameraColor.GetDescriptor(renderGraph); // Optional NaN killer before post-processing kicks in // stopNaN may be null on Adreno 3xx. It doesn't support full shader level 3.5, but SystemInfo.graphicsShaderLevel is 35. - if (useStopNan) - { - var stopNanTarget = PostProcessUtils.CreateCompatibleTexture(renderGraph, currentSource, StopNanPostProcessPass.k_TargetName, true, FilterMode.Bilinear); - m_StopNanPostProcessPass.sourceTexture = currentSource; - m_StopNanPostProcessPass.destinationTexture = stopNanTarget; - m_StopNanPostProcessPass.RecordRenderGraph(renderGraph, frameData); - currentSource = m_StopNanPostProcessPass.destinationTexture; - } + m_StopNanPostProcessPass.RecordRenderGraph(renderGraph, frameData); - if(useSubPixelMorpAA) - { - var targetDesc = renderGraph.GetTextureDesc(currentSource); - var smaaTarget = PostProcessUtils.CreateCompatibleTexture(renderGraph, targetDesc, SmaaPostProcessPass.k_TargetName, true, FilterMode.Bilinear); - m_SmaaPostProcessPass.antialiasingQuality = cameraData.antialiasingQuality; - m_SmaaPostProcessPass.sourceTexture = currentSource; - m_SmaaPostProcessPass.destinationTexture = smaaTarget; - m_SmaaPostProcessPass.RecordRenderGraph(renderGraph, frameData); - currentSource = m_SmaaPostProcessPass.destinationTexture; - } + // Subpixel Morphological Anti Aliasing + m_SmaaPostProcessPass.RecordRenderGraph(renderGraph, frameData); // Depth of Field // Adreno 3xx SystemInfo.graphicsShaderLevel is 35, but instancing support is disabled due to buggy drivers. // DOF shader uses #pragma target 3.5 which adds requirement for instancing support, thus marking the shader unsupported on those devices. - if (useDepthOfField) - { - var doFTarget = PostProcessUtils.CreateCompatibleTexture(renderGraph, currentSource, DepthOfFieldGaussianPostProcessPass.k_TargetName, true, FilterMode.Bilinear); - if(depthOfField.mode.value == DepthOfFieldMode.Gaussian) - { - m_DepthOfFieldGaussianPass.depthOfField = depthOfField; - m_DepthOfFieldGaussianPass.sourceTexture = currentSource; - m_DepthOfFieldGaussianPass.destinationTexture = doFTarget; - m_DepthOfFieldGaussianPass.RecordRenderGraph(renderGraph, frameData); - } - else - { - m_DepthOfFieldBokehPass.depthOfField = depthOfField; - m_DepthOfFieldBokehPass.useFastSRGBLinearConversion = useFastSRGBLinearConversion; - m_DepthOfFieldBokehPass.sourceTexture = currentSource; - m_DepthOfFieldBokehPass.destinationTexture = doFTarget; - m_DepthOfFieldBokehPass.RecordRenderGraph(renderGraph, frameData); - } - currentSource = doFTarget; - } + m_DepthOfFieldGaussianPass.RecordRenderGraph(renderGraph, frameData); + m_DepthOfFieldBokehPass.RecordRenderGraph(renderGraph, frameData); // Temporal Anti Aliasing / Upscaling - - if (useTemporalAA) - { #if ENABLE_UPSCALER_FRAMEWORK - if (postProcessingData.activeUpscaler != null) - { - // TODO: The caller of the pass should create the upscaled target. Caller should have the control of the placement of the result. - m_UpscalerPostProcessPass.sourceTexture = currentSource; - m_UpscalerPostProcessPass.RecordRenderGraph(renderGraph, frameData); - currentSource = m_UpscalerPostProcessPass.destinationTexture; - } - else + m_UpscalerPostProcessPass.RecordRenderGraph(renderGraph, frameData); #endif - if (useSTP) - { - var srcDesc = renderGraph.GetTextureDesc(currentSource); - var dstDesc = StpPostProcessPass.GetStpTargetDesc(srcDesc, cameraData); - var stpTarget = PostProcessUtils.CreateCompatibleTexture(renderGraph, dstDesc, StpPostProcessPass.k_UpscaledColorTargetName, false, FilterMode.Bilinear); - - m_StpPostProcessPass.sourceTexture = currentSource; - m_StpPostProcessPass.destinationTexture = stpTarget; - m_StpPostProcessPass.RecordRenderGraph(renderGraph, frameData); - currentSource = m_StpPostProcessPass.destinationTexture; - } - else - { - var taaTarget = PostProcessUtils.CreateCompatibleTexture(renderGraph, currentSource, TemporalAntiAliasingPostProcessPass.k_TargetName, false, FilterMode.Bilinear); - - m_TemporalAntiAliasingPass.sourceTexture = currentSource; - m_TemporalAntiAliasingPass.destinationTexture = taaTarget; - m_TemporalAntiAliasingPass.RecordRenderGraph(renderGraph, frameData); - currentSource = m_TemporalAntiAliasingPass.destinationTexture; - } - } + m_StpPostProcessPass.RecordRenderGraph(renderGraph, frameData); + m_TemporalAntiAliasingPass.RecordRenderGraph(renderGraph, frameData); - if(useMotionBlur) - { - var motionTarget = PostProcessUtils.CreateCompatibleTexture(renderGraph, currentSource, MotionBlurPostProcessPass.k_TargetName, true, FilterMode.Bilinear); + m_MotionBlurPass.RecordRenderGraph(renderGraph, frameData); + m_PaniniProjectionPass.RecordRenderGraph(renderGraph, frameData); - m_MotionBlurPass.motionBlur = motionBlur; - m_MotionBlurPass.sourceTexture = currentSource; - m_MotionBlurPass.destinationTexture = motionTarget; - m_MotionBlurPass.RecordRenderGraph(renderGraph, frameData); - currentSource = m_MotionBlurPass.destinationTexture; - } - - if(usePaniniProjection) + // Bloom & Screen Space Lens Flares { - var paniniTarget = PostProcessUtils.CreateCompatibleTexture(renderGraph, currentSource, PaniniProjectionPostProcessPass.k_TargetName, true, FilterMode.Bilinear); - - m_PaniniProjectionPass.paniniProjection = paniniProjection; - m_PaniniProjectionPass.sourceTexture = currentSource; - m_PaniniProjectionPass.destinationTexture = paniniTarget; - m_PaniniProjectionPass.RecordRenderGraph(renderGraph, frameData); - currentSource = m_PaniniProjectionPass.destinationTexture; - } - - // Uberpost - { - var colorSrcDesc = currentSource.GetDescriptor(renderGraph); - - // Bloom goes first - TextureHandle bloomTexture = TextureHandle.nullHandle; - bool bloomActive = bloom.IsActive() || useLensFlareScreenSpace; - //Even if bloom is not active we need the texture if the lensFlareScreenSpace pass is active. - if (bloomActive) - { - // NOTE: bloom destination texture is some texture in the bloom mip pyramid. It's not explicitly set beforehand. - m_BloomPass.bloom = bloom; - m_BloomPass.sourceTexture = currentSource; - m_BloomPass.RecordRenderGraph(renderGraph, frameData); - bloomTexture = m_BloomPass.destinationTexture; - - if (useLensFlareScreenSpace) - { - var mipPyramid = m_BloomPass.mipPyramid; - - // We need to take into account how many valid mips the bloom pass produced. - int bloomMipCount = mipPyramid.mipCount; - int maxBloomMip = Mathf.Clamp(bloomMipCount - 1, 0, bloom.maxIterations.value / 2); - int useBloomMip = Mathf.Clamp(lensFlareScreenSpace.bloomMip.value, 0, maxBloomMip); - - TextureHandle bloomMipFlareSource = mipPyramid.GetResultMip(useBloomMip); - // Flare source and Flare target is the same texture. BloomMip[0] - bool sameBloomSrcDestTex = useBloomMip == 0; + var volumeStack = VolumeManager.instance.stack; + var bloom = volumeStack.GetComponent(); + var lensFlareScreenSpace = volumeStack.GetComponent(); - // Kawase blur does not use the mip pyramid. - // It is safe to pass the same texture to both input/output. - if (bloom.filter.value == BloomFilterMode.Kawase) - { - bloomMipFlareSource = bloomTexture; - sameBloomSrcDestTex = true; - } - - m_LensFlareScreenSpacePass.lensFlareScreenSpace = lensFlareScreenSpace; - m_LensFlareScreenSpacePass.sameSourceDestinationTexture = sameBloomSrcDestTex; - m_LensFlareScreenSpacePass.colorBufferTextureDesc = colorSrcDesc; - m_LensFlareScreenSpacePass.sourceTexture = bloomMipFlareSource; - m_LensFlareScreenSpacePass.destinationTexture = bloomTexture; - m_LensFlareScreenSpacePass.RecordRenderGraph(renderGraph, frameData); - } - } + // NOTE: Even if bloom is not active we might need to run it for the texture if the lensFlareScreenSpace pass is active. + if (!bloom.IsActive() && LensFlareScreenSpacePostProcessPass.IsActive(volumeStack, frameData)) + bloom.intensity = lensFlareScreenSpace.intensity; // Set Bloom Active to true. - if (useLensFlare) - { - // Lens Flares are procedurally generated and blended to the destination texture. - m_LensFlareDataDrivenPass.paniniProjection = paniniProjection; - m_LensFlareDataDrivenPass.destinationTexture = currentSource; - m_LensFlareDataDrivenPass.RecordRenderGraph(renderGraph, frameData); - } + m_BloomPass.RecordRenderGraph(renderGraph, frameData); - // Settings - m_UberPass.colorLookup = colorLookup; - m_UberPass.colorAdjustments = colorAdjustments; - m_UberPass.tonemapping = tonemapping; - m_UberPass.bloom = bloom; - m_UberPass.lensDistortion = lensDistortion; - m_UberPass.chromaticAberration = chromaticAberration; - m_UberPass.vignette = vignette; - m_UberPass.filmGrain = filmGrain; - - m_UberPass.isFinalPass = !hasFinalPass; - m_UberPass.requireSRGBConversionBlit = RequireSRGBConversionBlitToBackBuffer(cameraData, enableColorEncodingIfNeeded); - m_UberPass.useFastSRGBLinearConversion = useFastSRGBLinearConversion; - - //TODO remove once all passes are converted to use the resourceData with cameraColor swapping - resourceData.cameraColor = currentSource; - - var activeOverlayUITextureUberPost = TextureHandle.nullHandle; - bool requireHDROutput = PostProcessUtils.RequireHDROutput(cameraData); - if (requireHDROutput) - { - // Color space conversion is already applied through color grading, do encoding if uber post is the last pass - // Otherwise encoding will happen in the final post process pass or the final blit pass - m_UberPass.hdrOperations = !hasFinalPass && enableColorEncodingIfNeeded ? HDROutputUtils.Operation.ColorEncoding : HDROutputUtils.Operation.None; + // We need to take into account how many valid mips the bloom pass produced. + var mipPyramid = m_BloomPass.mipPyramid; + int bloomMipCount = mipPyramid.mipCount; + int bloomMipMax = Mathf.Clamp(bloomMipCount - 1, 0, bloom.maxIterations.value / 2); + int bloomMipIndex = Mathf.Clamp(lensFlareScreenSpace.bloomMip.value, 0, bloomMipMax); - if(enableColorEncodingIfNeeded && resourceData.overlayUITexture.IsValid()) - activeOverlayUITextureUberPost = resourceData.overlayUITexture; - } + var prevCameraColor = resourceData.cameraColor; + resourceData.cameraColor = mipPyramid.GetResultMip(bloomMipIndex);; - var overlayUITexture = resourceData.overlayUITexture; + m_LensFlareScreenSpacePass.Setup(colorSourceDesc.width, colorSourceDesc.height, bloomMipIndex); + m_LensFlareScreenSpacePass.RecordRenderGraph(renderGraph, frameData); - resourceData.overlayUITexture = activeOverlayUITextureUberPost; - resourceData.bloom = bloomTexture; + resourceData.cameraColor = prevCameraColor; + } - m_UberPass.ditherTexture = cameraData.isDitheringEnabled ? GetNextDitherTexture() : null; + // Lens Flares are procedurally generated and blended to the destination texture. + m_LensFlareDataDrivenPass.RecordRenderGraph(renderGraph, frameData); - m_UberPass.RecordRenderGraph(renderGraph, frameData); + // Uber post + var ditherTexture = cameraData.isDitheringEnabled ? GetNextDitherTexture() : null; + var hdrOperations = HDROutputUtils.Operation.None; + var applySrgbEncoding = RequireSRGBConversionBlitToBackBuffer(cameraData, enableColorEncodingIfNeeded); - resourceData.overlayUITexture = overlayUITexture; + bool requireHDROutput = PostProcessUtils.RequireHDROutput(cameraData); + if (requireHDROutput) + { + // Color space conversion is already applied through color grading, do encoding if uber post is the last pass + // Otherwise encoding will happen in the final post process pass or the final blit pass + hdrOperations = !hasFinalPass && enableColorEncodingIfNeeded ? HDROutputUtils.Operation.ColorEncoding : HDROutputUtils.Operation.None; } + + bool renderOverlayUI = requireHDROutput && enableColorEncodingIfNeeded; + m_UberPass.Setup(ditherTexture, hdrOperations, applySrgbEncoding, !hasFinalPass, renderOverlayUI); + m_UberPass.RecordRenderGraph(renderGraph, frameData); } #region FinalPass @@ -403,16 +213,11 @@ public void RenderFinalPostProcessing(RenderGraph renderGraph, ContextContainer { UniversalCameraData cameraData = frameData.Get(); - var stack = VolumeManager.instance.stack; - var tonemapping = stack.GetComponent(); - var filmGrain = stack.GetComponent(); - // NOTE: Debug handling injects a global state render pass. UpdateGlobalDebugHandlerPass(renderGraph, cameraData, true); var resourceData = frameData.Get(); - var currentSource = resourceData.cameraColor; - var srcDesc = renderGraph.GetTextureDesc(currentSource); + var sourceDesc = renderGraph.GetTextureDesc(resourceData.cameraColor); HDROutputUtils.Operation hdrOperations = HDROutputUtils.Operation.None; bool requireHDROutput = PostProcessUtils.RequireHDROutput(cameraData); @@ -425,14 +230,14 @@ public void RenderFinalPostProcessing(RenderGraph renderGraph, ContextContainer hdrOperations |= HDROutputUtils.Operation.ColorConversion; } - FinalPostProcessPass.SamplingOperation samplingOperation = FinalPostProcessPass.SamplingOperation.Linear; + FinalPostProcessPass.FilteringOperation filteringOperation = FinalPostProcessPass.FilteringOperation.Linear; // Reuse RCAS pass as an optional standalone post sharpening pass for TAA. // This avoids the cost of EASU and is available for other upscaling options. // If FSR is enabled then FSR settings override the TAA settings and we perform RCAS only once. // If STP is enabled, then TAA sharpening has already been performed inside STP. if(PostProcessUtils.IsTaaSharpeningEnabled(cameraData)) - samplingOperation = FinalPostProcessPass.SamplingOperation.TaaSharpening; + filteringOperation = FinalPostProcessPass.FilteringOperation.TaaSharpening; bool applyFxaa = PostProcessUtils.IsFxaaEnabled(cameraData); @@ -450,24 +255,8 @@ public void RenderFinalPostProcessing(RenderGraph renderGraph, ContextContainer // When FXAA is needed while scaling is active, we must perform it before the scaling takes place. if (isSetupRequired) { - var scalingSetupDesc = srcDesc; - if (!requireHDROutput) - { - // Select a UNORM format since we've already performed tonemapping. (Values are in 0-1 range) - // This improves precision and is required if we want to avoid excessive banding when FSR is in use. - scalingSetupDesc.format = UniversalRenderPipeline.MakeUnormRenderTextureGraphicsFormat(); - } - - var scalingSetupTarget = PostProcessUtils.CreateCompatibleTexture(renderGraph, scalingSetupDesc, ScalingSetupPostProcessPass.k_TargetName, true, FilterMode.Point); - - m_ScalingSetupFinalPostProcessPass.tonemapping = tonemapping; - m_ScalingSetupFinalPostProcessPass.hdrOperations = hdrOperations; - - m_ScalingSetupFinalPostProcessPass.sourceTexture = currentSource; - m_ScalingSetupFinalPostProcessPass.destinationTexture = scalingSetupTarget; - m_ScalingSetupFinalPostProcessPass.RecordRenderGraph(renderGraph,frameData); - - currentSource = m_ScalingSetupFinalPostProcessPass.destinationTexture; + m_ScalingSetupFinalPostProcessPass.Setup(hdrOperations); + m_ScalingSetupFinalPostProcessPass.RecordRenderGraph(renderGraph, frameData); // Indicate that we no longer need to perform FXAA in the final pass since it was already perfomed here. applyFxaa = false; @@ -475,10 +264,10 @@ public void RenderFinalPostProcessing(RenderGraph renderGraph, ContextContainer // Upscaling (and downscaling) - var upscaledDesc = srcDesc; + var upscaledDesc = sourceDesc; upscaledDesc.width = cameraData.pixelWidth; upscaledDesc.height = cameraData.pixelHeight; - var upScaleTarget = PostProcessUtils.CreateCompatibleTexture(renderGraph, upscaledDesc, "_UpscaledTexture", true, FilterMode.Point); + // NOTE: upscaledDesc.format != scalingSetupDesc.format (in resourceData.cameraColor) switch (cameraData.imageScalingMode) { @@ -489,8 +278,8 @@ public void RenderFinalPostProcessing(RenderGraph renderGraph, ContextContainer case ImageUpscalingFilter.Point: { // TAA post sharpening is an RCAS pass, avoid overriding it with point sampling. - if (samplingOperation != FinalPostProcessPass.SamplingOperation.TaaSharpening) - samplingOperation = FinalPostProcessPass.SamplingOperation.Point; + if (filteringOperation != FinalPostProcessPass.FilteringOperation.TaaSharpening) + filteringOperation = FinalPostProcessPass.FilteringOperation.Point; break; } case ImageUpscalingFilter.Linear: @@ -499,11 +288,9 @@ public void RenderFinalPostProcessing(RenderGraph renderGraph, ContextContainer } case ImageUpscalingFilter.FSR: { - m_Fsr1UpscaleFinalPostProcessPass.sourceTexture = currentSource; - m_Fsr1UpscaleFinalPostProcessPass.destinationTexture = upScaleTarget; - m_Fsr1UpscaleFinalPostProcessPass.RecordRenderGraph(renderGraph,frameData); - currentSource = m_Fsr1UpscaleFinalPostProcessPass.destinationTexture; - samplingOperation = FinalPostProcessPass.SamplingOperation.FsrSharpening; + m_Fsr1UpscaleFinalPostProcessPass.Setup(upscaledDesc); + m_Fsr1UpscaleFinalPostProcessPass.RecordRenderGraph(renderGraph, frameData); + filteringOperation = FinalPostProcessPass.FilteringOperation.FsrSharpening; break; } } @@ -515,29 +302,17 @@ public void RenderFinalPostProcessing(RenderGraph renderGraph, ContextContainer // and it's already the default option in the shader. // Also disable TAA post sharpening pass when downscaling. - samplingOperation = FinalPostProcessPass.SamplingOperation.Linear; + filteringOperation = FinalPostProcessPass.FilteringOperation.Linear; break; } } } - //TODO remove once all passes are converted to use the resourceData with cameraColor swapping - resourceData.cameraColor = currentSource; - - bool renderOverlayUI = requireHDROutput && enableColorEncodingIfNeeded && cameraData.rendersOverlayUI; - var overlayUITexture = resourceData.overlayUITexture; - - //We will swap the resourceData.overlayUITexture back after the pass - if (!renderOverlayUI) - resourceData.overlayUITexture = TextureHandle.nullHandle; - - bool applySrgbEncoding = RequireSRGBConversionBlitToBackBuffer(cameraData, enableColorEncodingIfNeeded); var ditherTexture = cameraData.isDitheringEnabled ? GetNextDitherTexture() : null; - - m_FinalPostProcessPass.Setup(samplingOperation, hdrOperations, applySrgbEncoding, applyFxaa, ditherTexture); - m_FinalPostProcessPass.RecordRenderGraph(renderGraph,frameData); - - resourceData.overlayUITexture = overlayUITexture; + bool applySrgbEncoding = RequireSRGBConversionBlitToBackBuffer(cameraData, enableColorEncodingIfNeeded); + bool renderOverlayUI = requireHDROutput && enableColorEncodingIfNeeded && cameraData.rendersOverlayUI; + m_FinalPostProcessPass.Setup(ditherTexture, filteringOperation, hdrOperations, applySrgbEncoding, applyFxaa, renderOverlayUI); + m_FinalPostProcessPass.RecordRenderGraph(renderGraph, frameData); } #endregion } diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RTHandleUtils.cs b/Packages/com.unity.render-pipelines.universal/Runtime/RTHandleUtils.cs index 10785882b1b..ba1ba87dd9b 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/RTHandleUtils.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/RTHandleUtils.cs @@ -176,7 +176,7 @@ internal int GetHashCodeWithNameHash(in TextureDesc texDesc) internal static TextureDesc CreateTextureDesc(RenderTextureDescriptor desc, TextureSizeMode textureSizeMode = TextureSizeMode.Explicit, int anisoLevel = 1, float mipMapBias = 0, FilterMode filterMode = FilterMode.Point, TextureWrapMode wrapMode = TextureWrapMode.Clamp, string name = "") - { + { var format = (desc.depthStencilFormat != GraphicsFormat.None) ? desc.depthStencilFormat : desc.graphicsFormat; TextureDesc rgDesc = new TextureDesc(desc.width, desc.height); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/ReflectionProbeManager.cs b/Packages/com.unity.render-pipelines.universal/Runtime/ReflectionProbeManager.cs index 30930e9313f..871fbac13e9 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/ReflectionProbeManager.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/ReflectionProbeManager.cs @@ -159,7 +159,7 @@ public unsafe void UpdateGpuData(CommandBuffer cmd, ref CullingResults cullResul var probe = probes[probeIndex]; var texture = probe.texture; - var id = probe.reflectionProbe.GetInstanceID(); + var id = probe.reflectionProbe.GetEntityId(); var wasCached = m_Cache.TryGetValue(id, out var cachedProbe); if (!texture) @@ -263,7 +263,7 @@ public unsafe void UpdateGpuData(CommandBuffer cmd, ref CullingResults cullResul for (var probeIndex = 0; probeIndex < probeCount; probeIndex++) { var probe = probes[probeIndex]; - var id = probe.reflectionProbe.GetInstanceID(); + var id = probe.reflectionProbe.GetEntityId(); var dataIndex = probeIndex - skipCount; if (!m_Cache.TryGetValue(id, out var cachedProbe) || !probe.texture) { diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/DecalRendererFeature.cs b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/DecalRendererFeature.cs index f4cd828cf3d..19343f1ce36 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/DecalRendererFeature.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/DecalRendererFeature.cs @@ -429,7 +429,7 @@ private bool RecreateSystemsIfNeeded(ScriptableRenderer renderer, in CameraData { // the RenderPassEvent needs to be RenderPassEvent.AfterRenderingPrePasses + 1, so we are sure that if depth priming is enabled // this copy happens after the primed depth is copied, so the depth texture is available - m_CopyDepthPass = new DBufferCopyDepthPass(RenderPassEvent.AfterRenderingPrePasses + 1, rendererShaders.copyDepthPS, false, !universalRenderer.usesDeferredLighting); + m_CopyDepthPass = new DBufferCopyDepthPass(RenderPassEvent.AfterRenderingPrePasses + 1, rendererShaders.copyDepthPS, false); m_DecalDrawDBufferSystem = new DecalDrawDBufferSystem(m_DecalEntityManager); m_DBufferRenderPass = new DBufferRenderPass(m_DBufferClearMaterial, m_DBufferSettings, m_DecalDrawDBufferSystem, m_Settings.decalLayers); @@ -506,20 +506,6 @@ public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingD m_DecalCreateDrawCallSystem.Execute(); } - if (m_Technique == DecalTechnique.DBuffer) - { - var universalRenderer = renderer as UniversalRenderer; - if (universalRenderer.usesDeferredLighting) - { - m_CopyDepthPass.CopyToDepth = false; - } - else - { - m_CopyDepthPass.CopyToDepth = true; - m_CopyDepthPass.MsaaSamples = 1; - } - } - switch (m_Technique) { case DecalTechnique.ScreenSpace: diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/FullScreenPassRendererFeature.cs b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/FullScreenPassRendererFeature.cs index 5737fa52bbc..b7366aeb782 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/FullScreenPassRendererFeature.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/FullScreenPassRendererFeature.cs @@ -198,7 +198,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer } } - private void AddFullscreenRenderPassInputPass(RenderGraph renderGraph, UniversalResourceData resourcesData, UniversalCameraData cameraData, TextureHandle source, TextureHandle destination) + private void AddFullscreenRenderPassInputPass(RenderGraph renderGraph, UniversalResourceData resourcesData, UniversalCameraData cameraData, in TextureHandle source, in TextureHandle destination) { using (var builder = renderGraph.AddRasterRenderPass(passName, out var passData, profilingSampler)) { @@ -251,14 +251,14 @@ private void AddFullscreenRenderPassInputPass(RenderGraph renderGraph, Universal if (m_BindDepthStencilAttachment) builder.SetRenderAttachmentDepth(resourcesData.activeDepthTexture, AccessFlags.ReadWrite); - builder.SetRenderFunc((MainPassData data, RasterGraphContext rgContext) => + builder.SetRenderFunc(static (MainPassData data, RasterGraphContext rgContext) => { ExecuteMainPass(rgContext.cmd, data.inputTexture, data.material, data.passIndex); }); } } - private void AddCopyPassRenderPassFullscreen(RenderGraph renderGraph, TextureHandle source, TextureHandle destination) + private void AddCopyPassRenderPassFullscreen(RenderGraph renderGraph, in TextureHandle source, in TextureHandle destination) { using (var builder = renderGraph.AddRasterRenderPass("Copy Color Full Screen", out var passData, profilingSampler)) { @@ -267,7 +267,7 @@ private void AddCopyPassRenderPassFullscreen(RenderGraph renderGraph, TextureHan builder.SetRenderAttachment(destination, 0, AccessFlags.Write); - builder.SetRenderFunc((CopyPassData data, RasterGraphContext rgContext) => + builder.SetRenderFunc(static (CopyPassData data, RasterGraphContext rgContext) => { ExecuteCopyColorPass(rgContext.cmd, data.inputTexture); }); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/FullScreenPassRendererFeature_OldGUID.cs b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/FullScreenPassRendererFeature_OldGUID.cs index 755f3e03f82..6c8142f96df 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/FullScreenPassRendererFeature_OldGUID.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/FullScreenPassRendererFeature_OldGUID.cs @@ -31,7 +31,7 @@ void DownCast() var serializedObject = new SerializedObject(this); var scriptProperty = serializedObject.FindProperty("m_Script"); MonoScript currentScript = scriptProperty.objectReferenceValue as MonoScript; - AssetDatabase.TryGetGUIDAndLocalFileIdentifier(currentScript.GetInstanceID(), out var currentGUID, out var _); + AssetDatabase.TryGetGUIDAndLocalFileIdentifier(currentScript.GetEntityId(), out var currentGUID, out var _); if (currentGUID != oldGUID) return; diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/OnTilePostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/OnTilePostProcessPass.cs index c7f306328af..a7b4c7cba9c 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/OnTilePostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/OnTilePostProcessPass.cs @@ -199,7 +199,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer } builder.SetRenderAttachment(destination, 0, AccessFlags.WriteAll); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => ExecuteFBFetchPass(data, context)); + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => ExecuteFBFetchPass(data, context)); passData.useXRVisibilityMesh = false; passData.msaaSamples = (int)srcDesc.msaaSamples; diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/ScreenSpaceShadows.cs b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/ScreenSpaceShadows.cs index 9ac588cc20e..29010dd6f13 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/ScreenSpaceShadows.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/ScreenSpaceShadows.cs @@ -177,7 +177,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer if (color.IsValid()) builder.SetGlobalTextureAfterPass(color, m_ScreenSpaceShadowmapTextureID); - builder.SetRenderFunc((PassData data, UnsafeGraphContext rgContext) => + builder.SetRenderFunc(static (PassData data, UnsafeGraphContext rgContext) => { ExecutePass(rgContext.cmd, data, data.target); }); @@ -232,7 +232,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer builder.AllowGlobalStateModification(true); - builder.SetRenderFunc((PassData data, RasterGraphContext rgContext) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext rgContext) => { ExecutePass(rgContext.cmd, data.shadowData); }); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/ScreenResolveUpsampling.compute b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/ScreenResolveUpsampling.compute index e6d1c0ff178..68f8509562e 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/ScreenResolveUpsampling.compute +++ b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/ScreenResolveUpsampling.compute @@ -52,7 +52,7 @@ void Upsample(uint2 targetPixelPos : SV_DispatchThreadID) { const float goldenAngle = 2.39996323f; const float kernelExponent = 0.5f; - const float angle = rng.GetFloat(0) + goldenAngle * sampleIdx; + const float angle = TWO_PI * rng.GetFloat(0) + goldenAngle * sampleIdx; const float radius = pow(float(sampleIdx + 1) * reciprocalSampleCount, kernelExponent) * _FilterRadius; float2 sinCos; diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/SurfaceCacheGlobalIlluminationRendererFeature.cs b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/SurfaceCacheGlobalIlluminationRendererFeature.cs index d4bd29ad1b7..d03f4283cb9 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/SurfaceCacheGlobalIlluminationRendererFeature.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/SurfaceCacheGlobalIlluminationRendererFeature/SurfaceCacheGlobalIlluminationRendererFeature.cs @@ -353,6 +353,7 @@ public SurfaceCachePass( uint lookupSampleCount, float upsamplingKernelSize, uint upsamplingSampleCount, + uint defragCount, SurfaceCacheGridParameterSet gridParams, SurfaceCacheEstimationParameterSet estimationParams, SurfaceCachePatchFilteringParameterSet patchFilteringParams, @@ -392,7 +393,7 @@ public SurfaceCachePass( _upsamplingSampleCount = upsamplingSampleCount; _lookupSampleCount = lookupSampleCount; - _cache = new SurfaceCache(resourceSet, gridParams, estimationParams, patchFilteringParams); + _cache = new SurfaceCache(resourceSet, defragCount, gridParams, estimationParams, patchFilteringParams); _sceneTracker = new SceneUpdatesTracker(); _world = new SurfaceCacheWorld(); @@ -974,9 +975,11 @@ private static void UpdateInstances( { foreach (var meshRendererEntityID in removedInstances) { - Debug.Assert(entityIDToInstanceHandle.ContainsKey(meshRendererEntityID)); - world.RemoveInstance(entityIDToInstanceHandle[meshRendererEntityID]); - entityIDToInstanceHandle.Remove(meshRendererEntityID); + if (entityIDToInstanceHandle.TryGetValue(meshRendererEntityID, out var instanceHandle)) + { + world.RemoveInstance(instanceHandle); + entityIDToInstanceHandle.Remove(meshRendererEntityID); + } } foreach (var meshRenderer in addedInstances) @@ -984,6 +987,10 @@ private static void UpdateInstances( Debug.Assert(!meshRenderer.isPartOfStaticBatch); var mesh = meshRenderer.GetComponent().sharedMesh; + + if (mesh.vertexCount == 0) + continue; + var localToWorldMatrix = meshRenderer.transform.localToWorldMatrix; var materials = Util.GetMaterials(meshRenderer); @@ -1056,7 +1063,7 @@ internal static SurfaceCacheWorld.LightDescriptor[] ConvertUnityLightsToLightDes Light light = lights[i]; ref SurfaceCacheWorld.LightDescriptor descriptor = ref descriptors[i]; descriptor.Type = light.type; - descriptor.LinearLightColor = Util.GetLinearLightColor(light); + descriptor.LinearLightColor = Util.GetLinearLightColor(light) * light.bounceIntensity; if (multiplyPunctualLightIntensityByPI && Util.IsPunctualLightType(light.type)) descriptor.LinearLightColor *= Mathf.PI; descriptor.Transform = light.transform.localToWorldMatrix; @@ -1114,12 +1121,18 @@ class ScreenFilteringParameterSet } [Serializable] - class GridParameterSet + class VolumeParameterSet { - public uint GridSize = 32; - public float VoxelMinSize = 1.0f; + public uint Resolution = 32; + public float Size = 128.0f; public uint CascadeCount = 4; - public bool CascadeMovement = true; + public bool Movement = true; + } + + [Serializable] + class AdvancedParameterSet + { + public uint DefragCount = 2; } [Serializable] @@ -1133,7 +1146,8 @@ class ParameterSet [SerializeField] public RisEstimationParameterSet RisEstimationParams = new RisEstimationParameterSet(); public PatchFilteringParameterSet PatchFilteringParams = new PatchFilteringParameterSet(); [SerializeField] public ScreenFilteringParameterSet ScreenFilteringParams = new ScreenFilteringParameterSet(); - [SerializeField] public GridParameterSet GridParams = new GridParameterSet(); + [SerializeField] public VolumeParameterSet VolumeParams = new VolumeParameterSet(); + [SerializeField] public AdvancedParameterSet AdvancedParams = new AdvancedParameterSet(); public bool DebugEnabled = false; public DebugViewMode_ DebugViewMode = DebugViewMode_.CellIndex; @@ -1177,11 +1191,14 @@ public override void Create() var coreResourceLoadResult = coreResources.LoadFromRenderPipelineResources(_rtContext); Debug.Assert(coreResourceLoadResult); + float volSize = _parameterSet.VolumeParams.Size; + uint volRes = _parameterSet.VolumeParams.Resolution; + uint volCascCount = _parameterSet.VolumeParams.CascadeCount; var gridParams = new SurfaceCacheGridParameterSet { - GridSize = _parameterSet.GridParams.GridSize, - VoxelMinSize = _parameterSet.GridParams.VoxelMinSize, - CascadeCount = _parameterSet.GridParams.CascadeCount, + GridSize = volRes, + VoxelMinSize = volSize / (volRes * (float)(1u << (int)(volCascCount - 1u))), + CascadeCount = volCascCount }; var estimationParams = new SurfaceCacheEstimationParameterSet @@ -1222,10 +1239,11 @@ public override void Create() _parameterSet.ScreenFilteringParams.LookupSampleCount, _parameterSet.ScreenFilteringParams.UpsamplingKernelSize, _parameterSet.ScreenFilteringParams.UpsamplingSampleCount, + _parameterSet.AdvancedParams.DefragCount, gridParams, estimationParams, patchFilteringParams, - _parameterSet.GridParams.CascadeMovement); + _parameterSet.VolumeParams.Movement); _pass.renderPassEvent = RenderPassEvent.AfterRenderingPrePasses + 1; } diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RenderingUtils.cs b/Packages/com.unity.render-pipelines.universal/Runtime/RenderingUtils.cs index 97f54362248..c3ee6eb9879 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/RenderingUtils.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/RenderingUtils.cs @@ -277,6 +277,22 @@ internal static bool MultisampleDepthResolveSupported() return SystemInfo.supportsMultisampleResolveDepth && SystemInfo.supportsMultisampleResolveStencil; } + internal static bool ShouldDepthAttachmentBindMS() + { + bool canResolveDepth = RenderingUtils.MultisampleDepthResolveSupported(); + var canSampleMSAADepth = SystemInfo.supportsMultisampledTextures != 0; + + // If we aren't using hardware depth resolves and we have MSAA, we need to resolve depth manually by binding as an MSAA texture. + bool bindMS = !canResolveDepth && canSampleMSAADepth; + + // binding MS surfaces is not supported by the GLES backend, and it won't be fixed after investigating + // the high performance impact of potential fixes, which would make it more expensive than depth prepass (fogbugz 1339401 for more info) + if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.OpenGLES3) + bindMS = false; + + return bindMS; + } + /// /// Return true if handle does not match descriptor /// diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/ScriptableRenderer.cs b/Packages/com.unity.render-pipelines.universal/Runtime/ScriptableRenderer.cs index fe6b67ecf7e..ce528d6ac73 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/ScriptableRenderer.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/ScriptableRenderer.cs @@ -405,14 +405,6 @@ static void SetShaderTimeValues(IBaseCommandBuffer cmd, float time, float deltaT cmd.SetGlobalVector(ShaderPropertyId.lastTimeParameters, lastTimeParametersVector); } - /// - /// Returns the camera color target for this renderer. - /// It's only valid to call cameraColorTarget in the scope of ScriptableRenderPass. - /// . - /// - [Obsolete("Use cameraColorTargetHandle. #from(2022.1) #breakingFrom(2023.2)", true)] - public RenderTargetIdentifier cameraColorTarget => throw new NotSupportedException("cameraColorTarget has been deprecated. Use cameraColorTargetHandle instead"); - /// /// Returns a list of renderer features added to this renderer. /// @@ -445,92 +437,18 @@ protected List activeRenderPassQueue /// public GraphicsDeviceType[] unsupportedGraphicsDeviceTypes { get; set; } = new GraphicsDeviceType[0]; - static class RenderPassBlock - { - // Executes render passes that are inputs to the main rendering - // but don't depend on camera state. They all render in monoscopic mode. f.ex, shadow maps. - public static readonly int BeforeRendering = 0; - - // Main bulk of render pass execution. They required camera state to be properly set - // and when enabled they will render in stereo. - public static readonly int MainRenderingOpaque = 1; - public static readonly int MainRenderingTransparent = 2; - - // Execute after Post-processing. - public static readonly int AfterRendering = 3; - } - - private StoreActionsOptimization m_StoreActionsOptimizationSetting = StoreActionsOptimization.Auto; - private static bool m_UseOptimizedStoreActions = false; - - const int k_RenderPassBlockCount = 4; - - /// - /// An RTHandle wrapping the BuiltinRenderTextureType.CameraTarget render target. This is a helper - /// that avoids having to (re)allocate a new RTHandle every time the camera target is needed. - /// - protected static readonly RTHandle k_CameraTarget = RTHandles.Alloc(BuiltinRenderTextureType.CameraTarget); - List m_ActiveRenderPassQueue = new List(32); List m_RendererFeatures = new List(10); - RTHandle m_CameraColorTarget; - RTHandle m_CameraDepthTarget; - RTHandle m_CameraResolveTarget; - - bool m_FirstTimeCameraColorTargetIsBound = true; // flag used to track when m_CameraColorTarget should be cleared (if necessary), as well as other special actions only performed the first time m_CameraColorTarget is bound as a render target - bool m_FirstTimeCameraDepthTargetIsBound = true; // flag used to track when m_CameraDepthTarget should be cleared (if necessary), the first time m_CameraDepthTarget is bound as a render target - // The pipeline can only guarantee the camera target texture are valid when the pipeline is executing. // Trying to access the camera target before or after might be that the pipeline texture have already been disposed. bool m_IsPipelineExecuting = false; internal bool useRenderPassEnabled = false; - // Used to cache nameID of m_ActiveColorAttachments for CoreUtils without allocating arrays at each call - static RenderTargetIdentifier[] m_ActiveColorAttachmentIDs = new RenderTargetIdentifier[8]; - static RTHandle[] m_ActiveColorAttachments = new RTHandle[8]; - static RTHandle m_ActiveDepthAttachment; ContextContainer m_frameData = new(); internal ContextContainer frameData => m_frameData; - private static RenderBufferStoreAction[] m_ActiveColorStoreActions = new RenderBufferStoreAction[] - { - RenderBufferStoreAction.Store, RenderBufferStoreAction.Store, RenderBufferStoreAction.Store, RenderBufferStoreAction.Store, - RenderBufferStoreAction.Store, RenderBufferStoreAction.Store, RenderBufferStoreAction.Store, RenderBufferStoreAction.Store - }; - - private static RenderBufferStoreAction m_ActiveDepthStoreAction = RenderBufferStoreAction.Store; - - // CommandBuffer.SetRenderTarget(RenderTargetIdentifier[] colors, RenderTargetIdentifier depth, int mipLevel, CubemapFace cubemapFace, int depthSlice); - // called from CoreUtils.SetRenderTarget will issue a warning assert from native c++ side if "colors" array contains some invalid RTIDs. - // To avoid that warning assert we trim the RenderTargetIdentifier[] arrays we pass to CoreUtils.SetRenderTarget. - // To avoid re-allocating a new array every time we do that, we re-use one of these arrays for both RTHandles and RenderTargetIdentifiers: - static RenderTargetIdentifier[][] m_TrimmedColorAttachmentCopyIDs = - { - Array.Empty(), // only used to make indexing code easier to read - new RenderTargetIdentifier[1], - new RenderTargetIdentifier[2], - new RenderTargetIdentifier[3], - new RenderTargetIdentifier[4], - new RenderTargetIdentifier[5], - new RenderTargetIdentifier[6], - new RenderTargetIdentifier[7], - new RenderTargetIdentifier[8], - }; - static RTHandle[][] m_TrimmedColorAttachmentCopies = - { - Array.Empty(), // only used to make indexing code easier to read - new RTHandle[1], - new RTHandle[2], - new RTHandle[3], - new RTHandle[4], - new RTHandle[5], - new RTHandle[6], - new RTHandle[7], - new RTHandle[8], - }; - private static Plane[] s_Planes = new Plane[6]; private static Vector4[] s_VectorPlanes = new Vector4[6]; @@ -564,15 +482,7 @@ public ScriptableRenderer(ScriptableRendererData data) m_RendererFeatures.Add(feature); } useRenderPassEnabled = data.useNativeRenderPass; - Clear(CameraRenderType.Base); m_ActiveRenderPassQueue.Clear(); - - if (UniversalRenderPipeline.asset) - { - m_StoreActionsOptimizationSetting = UniversalRenderPipeline.asset.storeActionsOptimization; - } - - m_UseOptimizedStoreActions = m_StoreActionsOptimizationSetting != StoreActionsOptimization.Store; } /// @@ -672,7 +582,7 @@ private void InitRenderGraphFrame(RenderGraph renderGraph) builder.AllowPassCulling(false); - builder.SetRenderFunc((PassData data, UnsafeGraphContext rgContext) => + builder.SetRenderFunc(static (PassData data, UnsafeGraphContext rgContext) => { UnsafeCommandBuffer cmd = rgContext.cmd; #if UNITY_EDITOR @@ -716,7 +626,7 @@ internal void ProcessVFXCameraCommand(RenderGraph renderGraph) builder.AllowPassCulling(false); - builder.SetRenderFunc((VFXProcessCameraPassData data, UnsafeGraphContext context) => + builder.SetRenderFunc(static (VFXProcessCameraPassData data, UnsafeGraphContext context) => { if (data.xrPass != null) data.xrPass.StartSinglePass(context.cmd); @@ -731,7 +641,7 @@ internal void ProcessVFXCameraCommand(RenderGraph renderGraph) } } - internal void SetupRenderGraphCameraProperties(RenderGraph renderGraph, TextureHandle target) + internal void SetupRenderGraphCameraProperties(RenderGraph renderGraph, in TextureHandle target) { using (var builder = renderGraph.AddRasterRenderPass(Profiling.setupCamera.name, out var passData, Profiling.setupCamera)) @@ -743,7 +653,7 @@ internal void SetupRenderGraphCameraProperties(RenderGraph renderGraph, TextureH builder.AllowGlobalStateModification(true); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { bool yFlipped = SystemInfo.graphicsUVStartsAtTop && RenderingUtils.IsHandleYFlipped(context, in data.target); @@ -797,7 +707,7 @@ private class DrawGizmosPassData /// /// /// - internal void DrawRenderGraphGizmos(RenderGraph renderGraph, ContextContainer frameData, TextureHandle color, TextureHandle depth, GizmoSubset gizmoSubset) + internal void DrawRenderGraphGizmos(RenderGraph renderGraph, ContextContainer frameData, in TextureHandle color, in TextureHandle depth, GizmoSubset gizmoSubset) { #if UNITY_EDITOR UniversalCameraData cameraData = frameData.Get(); @@ -819,7 +729,7 @@ internal void DrawRenderGraphGizmos(RenderGraph renderGraph, ContextContainer fr builder.UseRendererList(passData.gizmoRenderList); builder.AllowPassCulling(false); - builder.SetRenderFunc((DrawGizmosPassData data, UnsafeGraphContext rgContext) => + builder.SetRenderFunc(static (DrawGizmosPassData data, UnsafeGraphContext rgContext) => { using (new ProfilingScope(rgContext.cmd, Profiling.drawGizmos)) { @@ -836,7 +746,7 @@ private class DrawWireOverlayPassData public RendererListHandle wireOverlayList; }; - internal void DrawRenderGraphWireOverlay(RenderGraph renderGraph, ContextContainer frameData, TextureHandle color) + internal void DrawRenderGraphWireOverlay(RenderGraph renderGraph, ContextContainer frameData, in TextureHandle color) { #if UNITY_EDITOR UniversalCameraData cameraData = frameData.Get(); @@ -964,7 +874,7 @@ private void SetEditorTarget(RenderGraph renderGraph) { builder.AllowPassCulling(false); - builder.SetRenderFunc((DummyData data, UnsafeGraphContext context) => + builder.SetRenderFunc(static (DummyData data, UnsafeGraphContext context) => { context.cmd.SetRenderTarget(BuiltinRenderTextureType.CameraTarget, RenderBufferLoadAction.Load, RenderBufferStoreAction.Store, // color @@ -1203,10 +1113,6 @@ internal void AddRenderPasses(ref RenderingData renderingData) if (activeRenderPassQueue[i] == null) activeRenderPassQueue.RemoveAt(i); } - - // if any pass was injected, the "automatic" store optimization policy will disable the optimized load actions - if (count > 0 && m_StoreActionsOptimizationSetting == StoreActionsOptimization.Auto) - m_UseOptimizedStoreActions = false; } static void ClearRenderingState(IBaseCommandBuffer cmd) @@ -1236,23 +1142,6 @@ static void ClearRenderingState(IBaseCommandBuffer cmd) cmd.SetGlobalVector(ScreenSpaceAmbientOcclusionPass.s_AmbientOcclusionParamID, Vector4.zero); } - internal void Clear(CameraRenderType cameraType) - { - m_ActiveColorAttachments[0] = k_CameraTarget; - for (int i = 1; i < m_ActiveColorAttachments.Length; ++i) - m_ActiveColorAttachments[i] = null; - for (int i = 0; i < m_ActiveColorAttachments.Length; ++i) - m_ActiveColorAttachmentIDs[i] = m_ActiveColorAttachments[i]?.nameID ?? 0; - - m_ActiveDepthAttachment = k_CameraTarget; - - m_FirstTimeCameraColorTargetIsBound = cameraType == CameraRenderType.Base; - m_FirstTimeCameraDepthTargetIsBound = true; - - m_CameraColorTarget = null; - m_CameraDepthTarget = null; - } - // Scene filtering is enabled when in prefab editing mode internal bool IsSceneFilteringEnabled(Camera camera) { diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/ShadowUtils.cs b/Packages/com.unity.render-pipelines.universal/Runtime/ShadowUtils.cs index 49aeae15d1a..8bfad4cccce 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/ShadowUtils.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/ShadowUtils.cs @@ -662,7 +662,7 @@ internal static float SoftShadowQualityToShaderProperty(Light light, bool softSh internal static bool SupportsPerLightSoftShadowQuality() { bool supportsPerLightSoftShadowQuality = true; - #if ENABLE_VR && ENABLE_VR_MODULE + #if ENABLE_VR && ENABLE_XR_MODULE #if PLATFORM_WINRT || PLATFORM_ANDROID // We are using static branches on Quest2 + HL for performance reasons supportsPerLightSoftShadowQuality = !PlatformAutoDetect.isXRMobile; diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/StpUtils.cs b/Packages/com.unity.render-pipelines.universal/Runtime/StpUtils.cs index 288e4e8c99c..8f34940e331 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/StpUtils.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/StpUtils.cs @@ -15,7 +15,7 @@ static void CalculateJitter(int frameIndex, out Vector2 jitter, out bool allowSc // Static allocation of JitterFunc delegate to avoid GC internal static TemporalAA.JitterFunc s_JitterFunc = CalculateJitter; - static void PopulateStpConfig(UniversalCameraData cameraData, TextureHandle inputColor, TextureHandle inputDepth, TextureHandle inputMotion, int debugViewIndex, TextureHandle debugView, TextureHandle destination, Texture2D noiseTexture, out STP.Config config) + static void PopulateStpConfig(UniversalCameraData cameraData, in TextureHandle inputColor, in TextureHandle inputDepth, in TextureHandle inputMotion, int debugViewIndex, in TextureHandle debugView, in TextureHandle destination, Texture2D noiseTexture, out STP.Config config) { cameraData.camera.TryGetComponent(out var additionalCameraData); Debug.Assert(additionalCameraData != null); @@ -113,7 +113,7 @@ static void PopulateStpConfig(UniversalCameraData cameraData, TextureHandle inpu config.perViewConfigs = STP.perViewConfigs; } - static internal void Execute(RenderGraph renderGraph, UniversalResourceData resourceData, UniversalCameraData cameraData, TextureHandle inputColor, TextureHandle inputDepth, TextureHandle inputMotion, TextureHandle destination, Texture2D noiseTexture) + static internal void Execute(RenderGraph renderGraph, UniversalResourceData resourceData, UniversalCameraData cameraData, in TextureHandle inputColor, in TextureHandle inputDepth, in TextureHandle inputMotion, in TextureHandle destination, Texture2D noiseTexture) { var debugView = TextureHandle.nullHandle; int debugViewIndex = 0; diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/TemporalAA.cs b/Packages/com.unity.render-pipelines.universal/Runtime/TemporalAA.cs index bf8a3747256..1c7562caf07 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/TemporalAA.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/TemporalAA.cs @@ -380,66 +380,6 @@ internal static string ValidateAndWarn(UniversalCameraData cameraData, bool isST return reasonWarning; } - internal static void ExecutePass(CommandBuffer cmd, Material taaMaterial, ref CameraData cameraData, RTHandle source, RTHandle destination, RenderTexture motionVectors) - { - using (new ProfilingScope(cmd, ProfilingSampler.Get(URPProfileId.TemporalAA))) - { - int multipassId = 0; -#if ENABLE_VR && ENABLE_XR_MODULE - multipassId = cameraData.xr.multipassId; -#endif - bool isNewFrame = cameraData.taaHistory.GetAccumulationVersion(multipassId) != Time.frameCount; - - RTHandle taaHistoryAccumulationTex = cameraData.taaHistory.GetAccumulationTexture(multipassId); - taaMaterial.SetTexture(ShaderConstants._TaaAccumulationTex, taaHistoryAccumulationTex); - - // On frame rerender or pause, stop all motion using a black motion texture. - // This is done to avoid blurring the Taa resolve due to motion and Taa history mismatch. - // - // Taa history copy is in sync with motion vectors and Time.frameCount, but we updated the TAA history - // for the next frame, as we did not know that we're going render this frame again. - // We would need history double buffering to solve this properly, but at the cost of memory. - // - // Frame #1: MotionVectors.Update: #1 Prev: #-1, Taa.Execute: #1 Prev: #-1, Taa.CopyHistory: #1 Prev: #-1 - // Frame #2: MotionVectors.Update: #2 Prev: #1, Taa.Execute: #2 Prev #1, Taa.CopyHistory: #2 - // - // Frame #2: MotionVectors.Update: #2, Taa.Execute: #2 prev #2 (Ooops! Incorrect history for frame #2!) - taaMaterial.SetTexture(ShaderConstants._TaaMotionVectorTex, isNewFrame ? motionVectors : Texture2D.blackTexture); - - ref var taa = ref cameraData.taaSettings; - float taaInfluence = taa.resetHistoryFrames == 0 ? taa.m_FrameInfluence : 1.0f; - taaMaterial.SetFloat(ShaderConstants._TaaFrameInfluence, taaInfluence); - taaMaterial.SetFloat(ShaderConstants._TaaVarianceClampScale, taa.varianceClampScale); - - if (taa.quality == TemporalAAQuality.VeryHigh) - taaMaterial.SetFloatArray(ShaderConstants._TaaFilterWeights, CalculateFilterWeights(ref taa)); - - switch (taaHistoryAccumulationTex.rt.graphicsFormat) - { - // Avoid precision issues with YCoCg and low bit color formats. - case GraphicsFormat.B10G11R11_UFloatPack32: - case GraphicsFormat.R8G8B8A8_UNorm: - case GraphicsFormat.B8G8R8A8_UNorm: - taaMaterial.EnableKeyword(ShaderKeywords.TAA_LOW_PRECISION_SOURCE); - break; - default: - taaMaterial.DisableKeyword(ShaderKeywords.TAA_LOW_PRECISION_SOURCE); - break; - } - - CoreUtils.SetKeyword(taaMaterial, ShaderKeywordStrings._ENABLE_ALPHA_OUTPUT, cameraData.isAlphaOutputEnabled); - - Blitter.BlitCameraTexture(cmd, source, destination, RenderBufferLoadAction.DontCare, RenderBufferStoreAction.Store, taaMaterial, (int)taa.quality); - - if (isNewFrame) - { - int kHistoryCopyPass = taaMaterial.shader.passCount - 1; - Blitter.BlitCameraTexture(cmd, destination, taaHistoryAccumulationTex, RenderBufferLoadAction.DontCare, RenderBufferStoreAction.Store, taaMaterial, kHistoryCopyPass); - cameraData.taaHistory.SetAccumulationVersion(multipassId, Time.frameCount); - } - } - } - private class TaaPassData { internal TextureHandle dstTex; @@ -476,9 +416,17 @@ internal static void Render(RenderGraph renderGraph, Material taaMaterial, Unive // On frame rerender or pause, stop all motion using a black motion texture. // This is done to avoid blurring the Taa resolve due to motion and Taa history mismatch. + // Taa history copy is in sync with motion vectors and Time.frameCount. + // // The TAA history was updated for the next frame, as we did not know yet that we're going render this frame again. // We would need to keep the both the current and previous history (double buffering) in order to resolve // either this frame (again) or the next frame correctly, but it would cost more memory. + // + // For example: + // Frame #1: MotionVectors.Update: #1 Prev: #-1, Taa.Execute: #1 Prev: #-1, Taa.CopyHistory: #1 Prev: #-1 + // Frame #2: MotionVectors.Update: #2 Prev: #1, Taa.Execute: #2 Prev #1, Taa.CopyHistory: #2 + // + // Frame #2: MotionVectors.Update: #2, Taa.Execute: #2 prev #2 (Ooops! Incorrect history for frame #2!) TextureHandle activeMotionVectors = isNewFrame ? srcMotionVectors : renderGraph.defaultResources.blackTexture; using (var builder = renderGraph.AddRasterRenderPass("Temporal Anti-aliasing", out var passData, ProfilingSampler.Get(URPProfileId.RG_TAA))) @@ -568,7 +516,7 @@ internal static void Render(RenderGraph renderGraph, Material taaMaterial, Unive passData.material = taaMaterial; passData.passIndex = kHistoryCopyPass; - builder.SetRenderFunc((TaaPassData data, RasterGraphContext context) => { Blitter.BlitTexture(context.cmd, data.srcColorTex, Vector2.one, data.material, data.passIndex); }); + builder.SetRenderFunc(static (TaaPassData data, RasterGraphContext context) => { Blitter.BlitTexture(context.cmd, data.srcColorTex, Vector2.one, data.material, data.passIndex); }); } cameraData.taaHistory.SetAccumulationVersion(multipassId, Time.frameCount); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Unity.RenderPipelines.Universal.Runtime.asmdef b/Packages/com.unity.render-pipelines.universal/Runtime/Unity.RenderPipelines.Universal.Runtime.asmdef index b917230185b..d520cbfc812 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Unity.RenderPipelines.Universal.Runtime.asmdef +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Unity.RenderPipelines.Universal.Runtime.asmdef @@ -38,11 +38,6 @@ "expression": "1.0.0", "define": "ENABLE_BURST_1_0_0_OR_NEWER" }, - { - "name": "com.unity.modules.vr", - "expression": "1.0.0", - "define": "ENABLE_VR_MODULE" - }, { "name": "com.unity.modules.xr", "expression": "1.0.0", @@ -62,7 +57,12 @@ "name": "com.unity.inputsystem", "expression": "0.0.0", "define": "ENABLE_INPUT_SYSTEM_PACKAGE" - } + }, + { + "name": "com.unity.2d.common", + "expression": "13.0.0", + "define": "USING_2DCOMMON" + } ], "noEngineReferences": false } \ No newline at end of file diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs index f08e4d15532..f4f1e7f4241 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs @@ -750,8 +750,6 @@ static void RenderSingleCamera(ScriptableRenderContext context, UniversalCameraD var cameraMetadata = CameraMetadataCache.GetCached(camera); using (new ProfilingScope(cmdScope, cameraMetadata.sampler)) // Enqueues a "BeginSample" command into the CommandBuffer cmd { - renderer.Clear(cameraData.renderType); - using (new ProfilingScope(Profiling.Pipeline.Renderer.setupCullingParameters)) { var legacyCameraData = new CameraData(frameData); @@ -1355,7 +1353,7 @@ static UniversalCameraData CreateCameraData(ContextContainer frameData, Camera c cameraData.hdrColorBufferPrecision = asset ? asset.hdrColorBufferPrecision : HDRColorBufferPrecision._32Bits; cameraData.cameraTargetDescriptor = CreateRenderTextureDescriptor(camera, cameraData, - cameraData.isHdrEnabled, cameraData.hdrColorBufferPrecision, msaaSamples, needsAlphaChannel, cameraData.requiresOpaqueTexture); + cameraData.isHdrEnabled, cameraData.hdrColorBufferPrecision, msaaSamples, needsAlphaChannel); uint count = GraphicsFormatUtility.GetAlphaComponentCount(cameraData.cameraTargetDescriptor.graphicsFormat); cameraData.isAlphaOutputEnabled = GraphicsFormatUtility.HasAlphaChannel(cameraData.cameraTargetDescriptor.graphicsFormat); @@ -1888,18 +1886,6 @@ static UniversalLightData CreateLightData(ContextContainer frameData, UniversalR lightData.maxPerObjectAdditionalLightsCount = 0; } - if (settings.mainLightRenderingMode == LightRenderingMode.Disabled) - { - var mainLightIndex = GetBrightestDirectionalLightIndex(settings, visibleLights); - if (mainLightIndex != -1) - { - // a visible main light was disabled, since it is still in the visible lights array we need to maintain - // the mainLightIndex otherwise indexing in the lightloop goes wrong - lightData.additionalLightsCount--; - lightData.mainLightIndex = mainLightIndex; - } - } - lightData.supportsAdditionalLights = settings.additionalLightsRenderingMode != LightRenderingMode.Disabled; lightData.shadeAdditionalLightsPerVertex = settings.additionalLightsRenderingMode == LightRenderingMode.PerVertex; lightData.supportsMixedLighting = settings.supportsMixedLighting; diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipelineCore.cs b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipelineCore.cs index 0c46f196f96..0be1994ce60 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipelineCore.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipelineCore.cs @@ -1530,7 +1530,7 @@ internal static GraphicsFormat MakeUnormRenderTextureGraphicsFormat() } internal static RenderTextureDescriptor CreateRenderTextureDescriptor(Camera camera, UniversalCameraData cameraData, - bool isHdrEnabled, HDRColorBufferPrecision requestHDRColorBufferPrecision, int msaaSamples, bool needsAlpha, bool requiresOpaqueTexture) + bool isHdrEnabled, HDRColorBufferPrecision requestHDRColorBufferPrecision, int msaaSamples, bool needsAlpha) { RenderTextureDescriptor desc; @@ -1955,7 +1955,7 @@ internal static class PlatformAutoDetect internal static void Initialize() { bool isRunningMobile = false; - #if ENABLE_VR && ENABLE_VR_MODULE + #if ENABLE_VR && ENABLE_XR_MODULE #if PLATFORM_WINRT || PLATFORM_ANDROID isRunningMobile = IsRunningXRMobile(); #endif @@ -1967,7 +1967,7 @@ internal static void Initialize() isSwitch2 = Application.platform == RuntimePlatform.Switch2; } -#if ENABLE_VR && ENABLE_VR_MODULE +#if ENABLE_VR && ENABLE_XR_MODULE #if PLATFORM_WINRT || PLATFORM_ANDROID // XR mobile platforms are not treated as dedicated mobile platforms in Core. Handle them specially here. (Quest and HL). private static List displaySubsystemList = new List(); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs index acf0aa6165e..70a3445b5e1 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs @@ -59,8 +59,6 @@ public sealed partial class UniversalRenderer : ScriptableRenderer const int k_FinalBlitPassQueueOffset = 1; const int k_AfterFinalBlitPassQueueOffset = k_FinalBlitPassQueueOffset + 1; - static readonly List k_DepthNormalsOnly = new List { new ShaderTagId("DepthNormalsOnly") }; - /// public override int SupportedCameraStackingTypes() { @@ -194,7 +192,7 @@ internal RenderingMode renderingModeActual { Material m_CameraMotionVecMaterial = null; internal bool isPostProcessActive { get => m_PostProcess != null; } - + internal DeferredLights deferredLights { get => m_DeferredLights; } internal LayerMask prepassLayerMask { get; set; } internal LayerMask opaqueLayerMask { get; set; } @@ -269,7 +267,7 @@ public UniversalRenderer(UniversalRendererData data) : base(data) this.stripShadowsOffVariants = data.stripShadowsOffVariants; this.stripAdditionalLightOffVariants = data.stripAdditionalLightOffVariants; -#if ENABLE_VR && ENABLE_VR_MODULE +#if ENABLE_VR && ENABLE_XR_MODULE #if PLATFORM_WINRT || PLATFORM_ANDROID // AdditionalLightOff variant is available on HL&Quest platform due to performance consideration. this.stripAdditionalLightOffVariants = !PlatformAutoDetect.isXRMobile; @@ -335,14 +333,13 @@ public UniversalRenderer(UniversalRendererData data) : base(data) m_RenderOpaqueForwardPass = new DrawObjectsPass(URPProfileId.DrawOpaqueObjects, true, RenderPassEvent.BeforeRenderingOpaques, RenderQueueRange.opaque, data.opaqueLayerMask, m_DefaultStencilState, stencilData.stencilReference); m_RenderOpaqueForwardWithRenderingLayersPass = new DrawObjectsWithRenderingLayersPass(URPProfileId.DrawOpaqueObjects, true, RenderPassEvent.BeforeRenderingOpaques, RenderQueueRange.opaque, data.opaqueLayerMask, m_DefaultStencilState, stencilData.stencilReference); - bool copyDepthAfterTransparents = m_CopyDepthMode == CopyDepthMode.AfterTransparents; - RenderPassEvent copyDepthEvent = copyDepthAfterTransparents ? RenderPassEvent.AfterRenderingTransparents : RenderPassEvent.AfterRenderingSkybox; + //This is calculated later for RG, so dummy value. + RenderPassEvent copyDepthEvent = RenderPassEvent.AfterRenderingSkybox; m_CopyDepthPass = new CopyDepthPass( copyDepthEvent, copyDephPS, - shouldClear: true, - copyResolvedDepth: RenderingUtils.MultisampleDepthResolveSupported() && copyDepthAfterTransparents); + shouldClear: true); // Motion vectors depend on the (copy) depth texture. Depth is reprojected to calculate motion vectors. m_MotionVectorPass = new MotionVectorRenderPass(copyDepthEvent + 1, m_CameraMotionVecMaterial, data.opaqueLayerMask); @@ -361,11 +358,11 @@ public UniversalRenderer(UniversalRendererData data) : base(data) // History generation passes for "raw color/depth". These execute only if explicitly requested by users. // VFX system particles uses these. See RawColorHistory.cs. m_HistoryRawColorCopyPass = new CopyColorPass(RenderPassEvent.BeforeRenderingPostProcessing, m_SamplingMaterial, m_BlitMaterial, customPassName: "Copy Color Raw History"); - m_HistoryRawDepthCopyPass = new CopyDepthPass(RenderPassEvent.BeforeRenderingPostProcessing, copyDephPS, false, RenderingUtils.MultisampleDepthResolveSupported(), customPassName: "Copy Depth Raw History"); + m_HistoryRawDepthCopyPass = new CopyDepthPass(RenderPassEvent.BeforeRenderingPostProcessing, copyDephPS, false, customPassName: "Copy Depth Raw History"); m_DrawOffscreenUIPass = new DrawScreenSpaceUIPass(RenderPassEvent.BeforeRenderingPostProcessing, true); m_DrawOverlayUIPass = new DrawScreenSpaceUIPass(RenderPassEvent.AfterRendering + k_AfterFinalBlitPassQueueOffset, false); // after m_FinalBlitPass - + //No postProcessData means that post processes are disabled if (data.postProcessData != null) { @@ -377,7 +374,7 @@ public UniversalRenderer(UniversalRendererData data) : base(data) m_FinalBlitPass = new FinalBlitPass(RenderPassEvent.AfterRendering + k_FinalBlitPassQueueOffset, m_BlitMaterial, m_BlitHDRMaterial); #if UNITY_EDITOR - m_FinalDepthCopyPass = new CopyDepthPass(RenderPassEvent.AfterRendering + 9, copyDephPS, false, true, customPassName: "Copy Final Depth"); + m_FinalDepthCopyPass = new CopyDepthPass(RenderPassEvent.AfterRendering + 9, copyDephPS, false, customPassName: "Copy Final Depth"); if (GraphicsSettings.TryGetRenderPipelineSettings(out var debugShaders)) m_ProbeVolumeDebugPass = new ProbeVolumeDebugPass(RenderPassEvent.BeforeRenderingTransparents, debugShaders.probeVolumeSamplingDebugComputeShader); #endif @@ -447,7 +444,7 @@ internal override void ReleaseRenderTargets() { if (m_DeferredLights != null && !m_DeferredLights.UseFramebufferFetch) m_GBufferPass?.Dispose(); - + m_MainLightShadowCasterPass?.Dispose(); m_AdditionalLightsShadowCasterPass?.Dispose(); } @@ -597,53 +594,79 @@ public override void FinishRendering(CommandBuffer cmd) struct RenderPassInputSummary { internal bool requiresDepthTexture; - internal bool requiresDepthPrepass; internal bool requiresNormalsTexture; internal bool requiresColorTexture; internal bool requiresMotionVectors; - internal RenderPassEvent requiresDepthNormalAtEvent; + internal RenderPassEvent requiresNormalTextureEarliestEvent; internal RenderPassEvent requiresDepthTextureEarliestEvent; } - static RenderPassInputSummary GetRenderPassInputs(bool isTemporalAAEnabled, bool postProcessingEnabled, bool isSceneViewCamera, bool renderingLayerProvidesByDepthNormalPass, List activeRenderPassQueue, MotionVectorRenderPass motionVectorPass) + static RenderPassInputSummary GetRenderPassInputs(List activeRenderPassQueue) { - RenderPassInputSummary inputSummary = new RenderPassInputSummary(); - inputSummary.requiresDepthNormalAtEvent = RenderPassEvent.BeforeRenderingOpaques; - inputSummary.requiresDepthTextureEarliestEvent = RenderPassEvent.BeforeRenderingPostProcessing; + RenderPassInputSummary inputSummary = new RenderPassInputSummary + { + requiresNormalTextureEarliestEvent = RenderPassEvent.AfterRenderingPostProcessing, + requiresDepthTextureEarliestEvent = RenderPassEvent.AfterRenderingPostProcessing + }; for (int i = 0; i < activeRenderPassQueue.Count; ++i) { ScriptableRenderPass pass = activeRenderPassQueue[i]; - bool needsDepth = (pass.input & ScriptableRenderPassInput.Depth) != ScriptableRenderPassInput.None; - bool needsNormals = (pass.input & ScriptableRenderPassInput.Normal) != ScriptableRenderPassInput.None; - bool needsColor = (pass.input & ScriptableRenderPassInput.Color) != ScriptableRenderPassInput.None; - bool needsMotion = (pass.input & ScriptableRenderPassInput.Motion) != ScriptableRenderPassInput.None; - bool eventBeforeRenderingOpaques = pass.renderPassEvent < RenderPassEvent.AfterRenderingOpaques; - - inputSummary.requiresDepthTexture |= needsDepth; - - // A depth prepass is always required when normals are needed because URP's forward passes don't support rendering into the normals texture - // If depth is needed without normals, we only need a prepass when the event consuming depth occurs before opaque rendering is completed. - inputSummary.requiresDepthPrepass |= needsNormals || (needsDepth && eventBeforeRenderingOpaques); + bool needsDepth = (pass.input & ScriptableRenderPassInput.Depth) != ScriptableRenderPassInput.None; + bool needsNormals = (pass.input & ScriptableRenderPassInput.Normal) != ScriptableRenderPassInput.None; + bool needsColor = (pass.input & ScriptableRenderPassInput.Color) != ScriptableRenderPassInput.None; + bool needsMotion = (pass.input & ScriptableRenderPassInput.Motion) != ScriptableRenderPassInput.None; + inputSummary.requiresDepthTexture |= needsDepth; inputSummary.requiresNormalsTexture |= needsNormals; - inputSummary.requiresColorTexture |= needsColor; - inputSummary.requiresMotionVectors |= needsMotion; + inputSummary.requiresColorTexture |= needsColor; + inputSummary.requiresMotionVectors |= needsMotion; + if (needsDepth) inputSummary.requiresDepthTextureEarliestEvent = (RenderPassEvent)Mathf.Min((int)pass.renderPassEvent, (int)inputSummary.requiresDepthTextureEarliestEvent); - if (needsNormals || needsDepth) - inputSummary.requiresDepthNormalAtEvent = (RenderPassEvent)Mathf.Min((int)pass.renderPassEvent, (int)inputSummary.requiresDepthNormalAtEvent); + if (needsNormals) + inputSummary.requiresNormalTextureEarliestEvent = (RenderPassEvent)Mathf.Min((int)pass.renderPassEvent, (int)inputSummary.requiresNormalTextureEarliestEvent); } + return inputSummary; + } + void AddRequirementsOfInternalFeatures(ref RenderPassInputSummary inputSummary, UniversalCameraData cameraData, bool postProcessingEnabled, bool renderingLayerProvidesByDepthNormalPass, MotionVectorRenderPass motionVectorPass, CopyDepthMode copyDepthMode) + { // TAA in postprocess requires it to function. - if (isTemporalAAEnabled) + if (cameraData.IsTemporalAAEnabled() ) inputSummary.requiresMotionVectors = true; + if(cameraData.requiresDepthTexture) + { + inputSummary.requiresDepthTexture = true; + + RenderPassEvent earliestDepth = RenderPassEvent.AfterRenderingTransparents; + switch (copyDepthMode){ + case CopyDepthMode.ForcePrepass: + earliestDepth = RenderPassEvent.AfterRenderingPrePasses; + break; + case CopyDepthMode.AfterOpaques: + earliestDepth = RenderPassEvent.AfterRenderingOpaques; + break; + } + + inputSummary.requiresDepthTextureEarliestEvent = (RenderPassEvent)Mathf.Min((int)earliestDepth, (int)inputSummary.requiresDepthTextureEarliestEvent); + } + + inputSummary.requiresColorTexture |= cameraData.requiresOpaqueTexture; + // Object motion blur requires motion vectors. if (postProcessingEnabled) { var motionBlur = VolumeManager.instance.stack.GetComponent(); - if(motionBlur != null && motionBlur.IsActive() && motionBlur.mode.value == MotionBlurMode.CameraAndObjects) + if (motionBlur != null && motionBlur.IsActive() && motionBlur.mode.value == MotionBlurMode.CameraAndObjects) inputSummary.requiresMotionVectors = true; + + if (cameraData.postProcessingRequiresDepthTexture) + { + inputSummary.requiresDepthTexture = true; + inputSummary.requiresDepthTextureEarliestEvent = (RenderPassEvent)Mathf.Min( (int)RenderPassEvent.BeforeRenderingPostProcessing, (int)inputSummary.requiresDepthTextureEarliestEvent); + } + } // Motion vectors imply depth @@ -654,16 +677,14 @@ static RenderPassInputSummary GetRenderPassInputs(bool isTemporalAAEnabled, bool } #if UNITY_EDITOR - if (ProbeReferenceVolume.instance.IsProbeSamplingDebugEnabled() && isSceneViewCamera) + if (ProbeReferenceVolume.instance.IsProbeSamplingDebugEnabled() && cameraData.isSceneViewCamera) inputSummary.requiresNormalsTexture = true; #endif if (renderingLayerProvidesByDepthNormalPass) inputSummary.requiresNormalsTexture = true; - - return inputSummary; } - + internal static bool PlatformRequiresExplicitMsaaResolve() { #if UNITY_EDITOR @@ -719,9 +740,11 @@ static bool RequiresIntermediateColorTexture(UniversalCameraData cameraData, in isCompatibleBackbufferTextureDimension = cameraData.xr.renderTargetDesc.dimension == cameraTargetDescriptor.dimension; } #endif - bool requiresOpaqueTexture = cameraData.requiresOpaqueTexture || renderPassInputs.requiresColorTexture; - bool requiresBlitForOffscreenCamera = applyPostProcessing || requiresOpaqueTexture || requiresExplicitMsaaResolve || !cameraData.isDefaultViewport; + bool requestedColorHistory = (cameraData.historyManager ==null)? false : cameraData.historyManager.IsAccessRequested(); + + bool requiresBlitForOffscreenCamera = applyPostProcessing || renderPassInputs.requiresColorTexture || requiresExplicitMsaaResolve || !cameraData.isDefaultViewport || requestedColorHistory; + if (isOffscreenRender) return requiresBlitForOffscreenCamera; diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRendererDebug.cs b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRendererDebug.cs index d094149219e..882a26bc82e 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRendererDebug.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRendererDebug.cs @@ -201,7 +201,7 @@ private void SetupRenderGraphFinalPassDebug(RenderGraph renderGraph, ContextCont { var debugSettings = DebugHandler.DebugDisplaySettings.gpuResidentDrawerSettings; - GPUResidentDrawer.RenderDebugOcclusionTestOverlay(renderGraph, debugSettings, cameraData.camera.GetInstanceID(), resourceData.activeColorTexture); + GPUResidentDrawer.RenderDebugOcclusionTestOverlay(renderGraph, debugSettings, cameraData.camera.GetEntityId(), resourceData.activeColorTexture); float screenWidth = (int)(cameraData.pixelHeight * cameraData.renderScale); float screenHeight = (int)(cameraData.pixelHeight * cameraData.renderScale); @@ -242,7 +242,7 @@ class CopyToDebugTexturePassData internal TextureHandle dest; } - private void BlitToDebugTexture(RenderGraph renderGraph, TextureHandle source, TextureHandle destination, bool isSourceTextureColor = false) + private void BlitToDebugTexture(RenderGraph renderGraph, in TextureHandle source, in TextureHandle destination, bool isSourceTextureColor = false) { if (source.IsValid()) { @@ -266,7 +266,7 @@ private void BlitToDebugTexture(RenderGraph renderGraph, TextureHandle source, T } } - private void BlitEmptyTexture(RenderGraph renderGraph, TextureHandle destination, string passName = "Copy To Debug Texture") + private void BlitEmptyTexture(RenderGraph renderGraph, in TextureHandle destination, string passName = "Copy To Debug Texture") { using (var builder = renderGraph.AddRasterRenderPass(passName, out var passData)) { @@ -275,7 +275,7 @@ private void BlitEmptyTexture(RenderGraph renderGraph, TextureHandle destination builder.SetRenderAttachment(destination, 0); builder.AllowPassCulling(false); - builder.SetRenderFunc((CopyToDebugTexturePassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (CopyToDebugTexturePassData data, RasterGraphContext context) => { Blitter.BlitTexture(context.cmd, data.src, new Vector4(1,1,0,0), 0, false); }); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRendererRenderGraph.cs b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRendererRenderGraph.cs index e9996c62851..1e462740a2a 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRendererRenderGraph.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRendererRenderGraph.cs @@ -306,8 +306,10 @@ bool RequiresIntermediateAttachments(UniversalCameraData cameraData, in RenderPa requireColorTexture |= HasPassesRequiringIntermediateTexture(activeRenderPassQueue); requireColorTexture |= RequiresIntermediateColorTexture(cameraData, in renderPassInputs, usesDeferredLighting, applyPostProcessing); + bool requestedDepthHistory = (cameraData.historyManager == null) ? false : cameraData.historyManager.IsAccessRequested(); + // Intermediate texture has different yflip state than backbuffer. In case we use intermediate texture, we must use both color and depth together. - return (requireColorTexture || requireCopyFromDepth); + return requireColorTexture || requireCopyFromDepth || requestedDepthHistory; } // Gather history render requests and manage camera history texture life-time. @@ -351,6 +353,7 @@ private void UpdateCameraHistory(UniversalCameraData cameraData) const string _SingleCameraTargetAttachmentName = "_CameraTargetAttachment"; const string _CameraDepthAttachmentName = "_CameraDepthAttachment"; + void CreateRenderGraphCameraRenderTargets(RenderGraph renderGraph, bool isCameraTargetOffscreenDepth, bool requireIntermediateAttachments, bool depthTextureIsDepthFormat) { UniversalResourceData resourceData = frameData.Get(); @@ -362,7 +365,7 @@ void CreateRenderGraphCameraRenderTargets(RenderGraph renderGraph, bool isCamera SetupTargetHandles(cameraData); // Gather render pass history requests and update history textures. - UpdateCameraHistory(cameraData); + UpdateCameraHistory(cameraData); // Import backbuffers to Render Graph ImportBackBuffers(renderGraph, cameraData, clearCameraParams.clearValue, isCameraTargetOffscreenDepth); @@ -372,7 +375,7 @@ void CreateRenderGraphCameraRenderTargets(RenderGraph renderGraph, bool isCamera cameraDescriptor.useMipMap = false; cameraDescriptor.autoGenerateMips = false; cameraDescriptor.mipMapBias = 0; - cameraDescriptor.anisoLevel = 0; + cameraDescriptor.anisoLevel = 1; if (requireIntermediateAttachments) { @@ -539,26 +542,28 @@ private void RenderRawColorDepthHistory(RenderGraph renderGraph, UniversalCamera } } - if (history.IsAccessRequested() && resourceData.cameraDepth.IsValid()) + if (history.IsAccessRequested() && resourceData.cameraDepth.IsValid() && CanCopyDepth(cameraData)) { var depthHistory = history.GetHistoryForWrite(); if (depthHistory != null) { - if (m_HistoryRawDepthCopyPass.CopyToDepth == false) + var tempColorDepthDesc = cameraData.cameraTargetDescriptor; + + //On GLES we don't support sampling the MSAA targets, so if auto depth resolve is not available, the only thing that works is rendering to a color target. + //This has been the behavior from at least 6.0. However, it results in the format mostly being color on the different graphics APIs, even when + //it could be a depth format if MSAA sampling for depht is allowed. + if (RenderingUtils.MultisampleDepthResolveSupported()) { - // Fall back to R32_Float if depth copy is disabled. - var tempColorDepthDesc = cameraData.cameraTargetDescriptor; - tempColorDepthDesc.graphicsFormat = GraphicsFormat.R32_SFloat; - tempColorDepthDesc.depthStencilFormat = GraphicsFormat.None; - depthHistory.Update(ref tempColorDepthDesc, xrMultipassEnabled); + tempColorDepthDesc.graphicsFormat = GraphicsFormat.None; } else { - var tempColorDepthDesc = cameraData.cameraTargetDescriptor; - tempColorDepthDesc.graphicsFormat = GraphicsFormat.None; - depthHistory.Update(ref tempColorDepthDesc, xrMultipassEnabled); + tempColorDepthDesc.graphicsFormat = GraphicsFormat.R32_SFloat; + tempColorDepthDesc.depthStencilFormat = GraphicsFormat.None; } + depthHistory.Update(ref tempColorDepthDesc, xrMultipassEnabled); + if (depthHistory.GetCurrentTexture(multipassId) != null) { var depthHistoryTarget = renderGraph.ImportTexture(depthHistory.GetCurrentTexture(multipassId)); @@ -598,21 +603,23 @@ internal override void OnRecordRenderGraph(RenderGraph renderGraph, ScriptableRe SetupRenderingLayers(cameraData.cameraTargetDescriptor.msaaSamples); bool isCameraTargetOffscreenDepth = cameraData.camera.targetTexture != null && cameraData.camera.targetTexture.format == RenderTextureFormat.Depth; + bool applyPostProcessing = cameraData.postProcessEnabled && m_PostProcess != null; - RenderPassInputSummary renderPassInputs = GetRenderPassInputs(cameraData.IsTemporalAAEnabled(), postProcessingData.isEnabled, cameraData.isSceneViewCamera, m_RenderingLayerProvidesByDepthNormalPass, activeRenderPassQueue, m_MotionVectorPass); + //First get the input requirements for the the ScriptableRenderPasses. These are all user passes plus potentially some that URP adds. + RenderPassInputSummary renderPassInputs = GetRenderPassInputs(activeRenderPassQueue); + //Then add all the requirements of internal features that are not implemented as ScriptableRenderPass's. After this call we have a complete view on the render pass input requirements for the entire frame. + AddRequirementsOfInternalFeatures(ref renderPassInputs, cameraData, applyPostProcessing, m_RenderingLayerProvidesByDepthNormalPass, m_MotionVectorPass, m_CopyDepthMode); - bool applyPostProcessing = cameraData.postProcessEnabled && m_PostProcess != null; - bool requireDepthTexture = RequireDepthTexture(cameraData, in renderPassInputs, applyPostProcessing); - bool requirePrepassForTextures = RequirePrepassForTextures(cameraData, renderPassInputs, requireDepthTexture); + bool requirePrepassForTextures = RequirePrepassForTextures(cameraData, in renderPassInputs); - useDepthPriming = IsDepthPrimingEnabledRenderGraph(cameraData, renderPassInputs, m_DepthPrimingMode, requireDepthTexture, requirePrepassForTextures, usesDeferredLighting); + useDepthPriming = IsDepthPrimingEnabledRenderGraph(cameraData, in renderPassInputs, m_DepthPrimingMode, requirePrepassForTextures, usesDeferredLighting); bool requirePrepass = requirePrepassForTextures || useDepthPriming; // Only use a depth format when we do a prepass directly the cameraDepthTexture. If we do depth priming (ie, prepass to the activeCameraDepth), we don't do a prepass to the texture. Instead, we do a copy from the primed attachment. - bool prepassToCameraDepthTexture = requirePrepass && !useDepthPriming; + bool prepassToCameraDepthTexture = requirePrepassForTextures && !usesDeferredLighting; bool depthTextureIsDepthFormat = prepassToCameraDepthTexture; - bool requireCopyFromDepth = requireDepthTexture && !prepassToCameraDepthTexture; + bool requireCopyFromDepth = renderPassInputs.requiresDepthTexture && !prepassToCameraDepthTexture; // We configure this for the first camera of the stack and overlay camera will reuse create color/depth var // to pick the correct target, as if there is an intermediate texture, overlay cam should use them @@ -631,7 +638,6 @@ internal override void OnRecordRenderGraph(RenderGraph renderGraph, ScriptableRe #if VISUAL_EFFECT_GRAPH_0_0_1_OR_NEWER ProcessVFXCameraCommand(renderGraph); #endif - cameraData.renderer.useDepthPriming = useDepthPriming; if (isCameraTargetOffscreenDepth) { @@ -643,7 +649,7 @@ internal override void OnRecordRenderGraph(RenderGraph renderGraph, ScriptableRe BeginRenderGraphXRRendering(renderGraph); - OnMainRendering(renderGraph, context, renderPassInputs, requirePrepass, requireDepthTexture); + OnMainRendering(renderGraph, context, in renderPassInputs, requirePrepass); OnAfterRendering(renderGraph, applyPostProcessing); @@ -778,7 +784,7 @@ private void UpdateInstanceOccluders(RenderGraph renderGraph, UniversalCameraDat int scaledWidth = (int)(cameraData.pixelWidth * cameraData.renderScale); int scaledHeight = (int)(cameraData.pixelHeight * cameraData.renderScale); bool isSinglePassXR = cameraData.xr.enabled && cameraData.xr.singlePassEnabled; - var occluderParams = new OccluderParameters(cameraData.camera.GetInstanceID()) + var occluderParams = new OccluderParameters(cameraData.camera.GetEntityId()) { subviewCount = isSinglePassXR ? 2 : 1, depthTexture = depthTexture, @@ -806,7 +812,7 @@ private void InstanceOcclusionTest(RenderGraph renderGraph, UniversalCameraData { bool isSinglePassXR = cameraData.xr.enabled && cameraData.xr.singlePassEnabled; int subviewCount = isSinglePassXR ? 2 : 1; - var settings = new OcclusionCullingSettings(cameraData.camera.GetInstanceID(), occlusionTest) + var settings = new OcclusionCullingSettings(cameraData.camera.GetEntityId(), occlusionTest) { instanceMultiplier = (isSinglePassXR && !SystemInfo.supportsMultiview) ? 2 : 1, }; @@ -844,10 +850,12 @@ private void RecordCustomPassesWithDepthCopyAndMotion(RenderGraph renderGraph, U // This produces a set of partial depth & normal buffers that must be completed by the gbuffer pass later in the frame. // This allows us to produce complete depth & normals data before lighting takes place, but it isn't valid when custom // passes require this data before the gbuffer pass finishes. - private static bool AllowPartialDepthNormalsPrepass(bool isDeferred, RenderPassEvent requiresDepthNormalEvent, bool useDepthPriming) + private static bool AllowPartialDepthNormalsPrepass(bool isDeferred, RenderPassInputSummary renderPassInputSummary, bool useDepthPriming) { - return isDeferred && ((RenderPassEvent.AfterRenderingGbuffer <= requiresDepthNormalEvent) && - (requiresDepthNormalEvent <= RenderPassEvent.BeforeRenderingOpaques)) && useDepthPriming; + bool requiresDepthAfterGbuffer = RenderPassEvent.AfterRenderingGbuffer <= renderPassInputSummary.requiresDepthTextureEarliestEvent; + bool requiresNormalAfterGbuffer = RenderPassEvent.AfterRenderingGbuffer <= renderPassInputSummary.requiresNormalTextureEarliestEvent; + + return isDeferred && requiresDepthAfterGbuffer && requiresNormalAfterGbuffer && !useDepthPriming; } // Enumeration of possible positions within the frame where the depth copy can occur @@ -866,15 +874,6 @@ private enum DepthCopySchedule None } - // Enumeration of possible positions within the frame where the color copy pass can be scheduled - private enum ColorCopySchedule - { - AfterSkybox, - - // None is always the last value so we can easily check if the color has already been copied in the current frame via comparison - None - } - /// /// Calculates where the depth copy pass should be scheduled within the frame. /// This function is only intended to be called in cases where we've determined that an explicit depth copy pass is required. @@ -883,85 +882,55 @@ private enum ColorCopySchedule /// The earliest render pass event in the frame that reads from the depth texture /// True if we've determined that the current frame will include a full prepass /// The position within the frame where the depth copy pass should be executed - private DepthCopySchedule CalculateDepthCopySchedule(RenderPassEvent earliestDepthReadEvent, bool hasFullPrepass) + static private DepthCopySchedule CalculateDepthCopySchedule(RenderPassEvent earliestDepthReadEvent, bool hasFullPrepass) { DepthCopySchedule schedule; - if ((earliestDepthReadEvent < RenderPassEvent.AfterRenderingOpaques) || (m_CopyDepthMode == CopyDepthMode.ForcePrepass)) + if(earliestDepthReadEvent < RenderPassEvent.AfterRenderingGbuffer) { - // The forward path never needs to copy depth this early in the frame unless we're using depth priming. - Debug.Assert(usesDeferredLighting || useDepthPriming); - - if (hasFullPrepass) - { - // If we have a full prepass, we can copy depth immediately after since a full prepass guarantees complete depth data. - schedule = DepthCopySchedule.AfterPrepass; - } - else - { - // If we have a partial prepass (or no prepass), we must finish rendering the gbuffer before complete depth data is available. - schedule = DepthCopySchedule.AfterGBuffer; + // If we have a full prepass, we can copy depth immediately after since a full prepass guarantees complete depth data. + schedule = DepthCopySchedule.AfterPrepass; - // Make sure we aren't scheduling the depth copy later than the event reading depth. - // The only way this could happen is if we executed a partial prepass in a case where we should have done a full prepass. - Debug.Assert(earliestDepthReadEvent >= RenderPassEvent.AfterRenderingGbuffer); - } + // Make sure we aren't scheduling the depth copy later than the event reading depth. + // The only way this could happen is if we executed a partial prepass in a case where we should have done a full prepass. + Debug.Assert(hasFullPrepass, "Doing a partial prepass when the full depth data is needed before 'AfterRenderingGBuffer'"); } - else if ((earliestDepthReadEvent < RenderPassEvent.AfterRenderingTransparents) || (m_CopyDepthMode == CopyDepthMode.AfterOpaques)) + else if ((earliestDepthReadEvent < RenderPassEvent.AfterRenderingOpaques)) { - if (earliestDepthReadEvent < RenderPassEvent.AfterRenderingSkybox) - schedule = DepthCopySchedule.AfterOpaques; - else - schedule = DepthCopySchedule.AfterSkybox; + // If we have a partial prepass (or no prepass), we must finish rendering the gbuffer before complete depth data is available. + schedule = DepthCopySchedule.AfterGBuffer; } - else if ((earliestDepthReadEvent < RenderPassEvent.BeforeRenderingPostProcessing) || (m_CopyDepthMode == CopyDepthMode.AfterTransparents)) + else if (earliestDepthReadEvent < RenderPassEvent.AfterRenderingSkybox) { - schedule = DepthCopySchedule.AfterTransparents; + schedule = DepthCopySchedule.AfterOpaques; } - else + else if ((earliestDepthReadEvent < RenderPassEvent.AfterRenderingTransparents)) { - // If we hit this case, there's a case we didn't handle properly in the scheduling logic. - Debug.Assert(false); - - schedule = DepthCopySchedule.None; + schedule = DepthCopySchedule.AfterSkybox; + } + else + { + schedule = DepthCopySchedule.AfterTransparents; } return schedule; } - private struct TextureCopySchedules - { - internal DepthCopySchedule depth; - internal ColorCopySchedule color; - } - - private TextureCopySchedules CalculateTextureCopySchedules(UniversalCameraData cameraData, in RenderPassInputSummary renderPassInputs, bool requiresDepthPrepass, bool hasFullPrepass, bool requireDepthTexture) + private DepthCopySchedule CalculateDepthCopySchedules(UniversalCameraData cameraData, in RenderPassInputSummary renderPassInputs, bool isDeferred, bool requiresDepthPrepass, bool hasFullPrepass) { // Assume the depth texture is unused and no copy is needed until we determine otherwise DepthCopySchedule depth = DepthCopySchedule.None; // If the depth texture is read during the frame, determine when the copy should occur - if (requireDepthTexture) + if (renderPassInputs.requiresDepthTexture) { //The prepass will render directly to the depthTexture when not using depth priming. Therefore we don't need a copy in that case. - bool depthTextureRequiresCopy = (!requiresDepthPrepass || useDepthPriming); + bool depthTextureRequiresCopy = isDeferred || (!requiresDepthPrepass || useDepthPriming); depth = depthTextureRequiresCopy ? CalculateDepthCopySchedule(renderPassInputs.requiresDepthTextureEarliestEvent, hasFullPrepass) : DepthCopySchedule.DuringPrepass; } - - bool requiresColorCopyPass = cameraData.requiresOpaqueTexture || renderPassInputs.requiresColorTexture; - - // Schedule a color copy pass if required - ColorCopySchedule color = requiresColorCopyPass ? ColorCopySchedule.AfterSkybox - : ColorCopySchedule.None; - - TextureCopySchedules schedules; - - schedules.depth = depth; - schedules.color = color; - - return schedules; + return depth; } private void CopyDepthToDepthTexture(RenderGraph renderGraph, UniversalResourceData resourceData) @@ -982,7 +951,7 @@ private void ExecuteScheduledDepthCopyWithMotion(RenderGraph renderGraph, Univer RenderMotionVectors(renderGraph, resourceData); } - private void OnMainRendering(RenderGraph renderGraph, ScriptableRenderContext context, in RenderPassInputSummary renderPassInputs, bool requiresPrepass, bool requireDepthTexture) + private void OnMainRendering(RenderGraph renderGraph, ScriptableRenderContext context, in RenderPassInputSummary renderPassInputs, bool requiresPrepass) { UniversalRenderingData renderingData = frameData.Get(); UniversalResourceData resourceData = frameData.Get(); @@ -1009,15 +978,15 @@ private void OnMainRendering(RenderGraph renderGraph, ScriptableRenderContext co // The depth prepass is considered "full" (renders the entire scene, not a partial subset), when we either: // - Have a depth only prepass (URP always renders the full scene in depth only mode) // - Have a depth normals prepass that does not allow the partial prepass optimization - bool hasFullPrepass = isDepthOnlyPrepass || (isDepthNormalPrepass && !AllowPartialDepthNormalsPrepass(usesDeferredLighting, renderPassInputs.requiresDepthNormalAtEvent, useDepthPriming)); + bool hasFullPrepass = isDepthOnlyPrepass || (isDepthNormalPrepass && !AllowPartialDepthNormalsPrepass(usesDeferredLighting, renderPassInputs, useDepthPriming)); - TextureCopySchedules copySchedules = CalculateTextureCopySchedules(cameraData, renderPassInputs, requiresPrepass, hasFullPrepass, requireDepthTexture); + var depthCopySchedule = CalculateDepthCopySchedules(cameraData, renderPassInputs, usesDeferredLighting, requiresPrepass, hasFullPrepass); // Decide if & when to use GPU Occlusion Culling. // In deferred, do it during gbuffer laydown unless we are forced to do a *full* prepass by a render pass. // In forward, if there's a depth prepass, we prefer to do it there, otherwise we do it during the opaque pass. - bool requiresDepthAfterGbuffer = RenderPassEvent.AfterRenderingGbuffer <= renderPassInputs.requiresDepthNormalAtEvent - && renderPassInputs.requiresDepthNormalAtEvent <= RenderPassEvent.BeforeRenderingOpaques; + bool requiresDepthAfterGbuffer = RenderPassEvent.AfterRenderingGbuffer <= renderPassInputs.requiresDepthTextureEarliestEvent + && renderPassInputs.requiresDepthTextureEarliestEvent <= RenderPassEvent.BeforeRenderingOpaques; bool occlusionTestDuringPrepass = requiresPrepass && (!usesDeferredLighting || !requiresDepthAfterGbuffer); OccluderPass occluderPass = OccluderPass.None; @@ -1047,10 +1016,13 @@ private void OnMainRendering(RenderGraph renderGraph, ScriptableRenderContext co if (requiresPrepass) { - TextureHandle depthTarget = useDepthPriming ? resourceData.activeDepthTexture : resourceData.cameraDepthTexture; + // If we're in deferred mode, prepasses always render directly to the depth attachment rather than the camera depth texture. + // In non-deferred mode, we only render to the depth attachment directly when depth priming is enabled and we're starting with an empty depth buffer. + bool renderToAttachment = (usesDeferredLighting || useDepthPriming); + TextureHandle depthTarget = renderToAttachment ? resourceData.activeDepthTexture : resourceData.cameraDepthTexture; // Prepare stencil buffer for stencil-based cross-fade lod in depth normal prepass. Depth prepass doesn't use stencil test (same as shadow). - if (renderingData.stencilLodCrossFadeEnabled && isDepthNormalPrepass && !useDepthPriming) + if (renderingData.stencilLodCrossFadeEnabled && isDepthNormalPrepass && !renderToAttachment) m_StencilCrossFadeRenderPass.Render(renderGraph, context, resourceData.cameraDepthTexture); bool needsOccluderUpdate = occluderPass == OccluderPass.DepthPrepass; @@ -1073,7 +1045,7 @@ private void OnMainRendering(RenderGraph renderGraph, ScriptableRenderContext co // When we render to the depth attachment, a copy must happen later to populate the camera depth texture and the copy will handle setting globals. // If we're rendering to the camera depth texture, we can set the globals immediately. - bool setGlobalDepth = isLastPass && !useDepthPriming; + bool setGlobalDepth = isLastPass && !renderToAttachment; // There's no special copy logic for the camera normals texture, so we can set the global as long as we're not performing a partial prepass. // In the case of a partial prepass, the global will be set later by the gbuffer pass once it completes the data in the texture. @@ -1088,7 +1060,7 @@ private void OnMainRendering(RenderGraph renderGraph, ScriptableRenderContext co { SetupRenderGraphCameraProperties(renderGraph, depthTarget); } - DepthNormalPrepassRender(renderGraph, renderPassInputs, depthTarget, batchLayerMask, setGlobalDepth, setGlobalTextures); + DepthNormalPrepassRender(renderGraph, renderPassInputs, depthTarget, batchLayerMask, setGlobalDepth, setGlobalTextures, !hasFullPrepass); // Restore camera properties for the rest of the render graph execution. if (resourceData.isActiveTargetBackBuffer) { @@ -1096,7 +1068,7 @@ private void OnMainRendering(RenderGraph renderGraph, ScriptableRenderContext co } } else - m_DepthPrepass.Render(renderGraph, frameData, ref depthTarget, batchLayerMask, setGlobalDepth); + m_DepthPrepass.Render(renderGraph, frameData, in depthTarget, batchLayerMask, setGlobalDepth); if (needsOccluderUpdate) { @@ -1112,9 +1084,9 @@ private void OnMainRendering(RenderGraph renderGraph, ScriptableRenderContext co // After the prepass completes, we should copy depth if necessary and also render motion vectors. (they're expected to be available whenever depth is) // In the case where depth is rendered as part of the prepass and no copy is necessary, we still need to render motion vectors here to ensure they're available // with depth before any user passes are executed. - if (copySchedules.depth == DepthCopySchedule.AfterPrepass) + if (depthCopySchedule == DepthCopySchedule.AfterPrepass) ExecuteScheduledDepthCopyWithMotion(renderGraph, resourceData, renderPassInputs.requiresMotionVectors); - else if ((copySchedules.depth == DepthCopySchedule.DuringPrepass) && renderPassInputs.requiresMotionVectors) + else if ((depthCopySchedule == DepthCopySchedule.DuringPrepass) && renderPassInputs.requiresMotionVectors) RenderMotionVectors(renderGraph, resourceData); RecordCustomRenderGraphPasses(renderGraph, RenderPassEvent.AfterRenderingPrePasses); @@ -1130,13 +1102,11 @@ private void OnMainRendering(RenderGraph renderGraph, ScriptableRenderContext co // We need to be sure there are no custom passes in between GBuffer/Deferred passes, if there are - we disable fb fetch just to be safe` m_DeferredLights.UseFramebufferFetch = renderGraph.nativeRenderPassesEnabled; - m_DeferredLights.HasNormalPrepass = isDepthNormalPrepass; - m_DeferredLights.HasDepthPrepass = requiresPrepass; + m_DeferredLights.ResolveMixedLightingMode(lightData); // Once the mixed lighting mode has been discovered, we know how many MRTs we need for the gbuffer. // Subtractive mixed lighting requires shadowMask output, which is actually used to store unity_ProbesOcclusion values. - m_DeferredLights.CreateGbufferResourcesRenderGraph(renderGraph, resourceData); - resourceData.gBuffer = m_DeferredLights.GbufferTextureHandles; + m_DeferredLights.CreateGbufferTextures(renderGraph, resourceData, isDepthNormalPrepass); RecordCustomRenderGraphPasses(renderGraph, RenderPassEvent.BeforeRenderingGbuffer); @@ -1158,7 +1128,7 @@ private void OnMainRendering(RenderGraph renderGraph, ScriptableRenderContext co // When we have a partial depth normals prepass, we must wait until the gbuffer pass to set global textures. // In this case, the incoming global texture data is incomplete and the gbuffer pass is required to complete it. bool setGlobalTextures = isDepthNormalPrepass && !hasFullPrepass; - m_GBufferPass.Render(renderGraph, frameData, resourceData.activeColorTexture, resourceData.activeDepthTexture, setGlobalTextures, batchLayerMask); + m_GBufferPass.Render(renderGraph, frameData, setGlobalTextures, batchLayerMask); if (needsOccluderUpdate) { @@ -1173,14 +1143,12 @@ private void OnMainRendering(RenderGraph renderGraph, ScriptableRenderContext co // In addition to regularly scheduled depth copies here, we also need to copy depth when native render passes aren't available. // This is required because deferred lighting must read depth as a texture, but it must also bind depth as a depth write attachment at the same time. // When native render passes are available, we write depth into an internal gbuffer slice and read via framebuffer fetch so a depth copy is no longer required. - if (copySchedules.depth == DepthCopySchedule.AfterGBuffer) + if (depthCopySchedule == DepthCopySchedule.AfterGBuffer) ExecuteScheduledDepthCopyWithMotion(renderGraph, resourceData, renderPassInputs.requiresMotionVectors); - else if (!renderGraph.nativeRenderPassesEnabled) - CopyDepthToDepthTexture(renderGraph, resourceData); RecordCustomRenderGraphPasses(renderGraph, RenderPassEvent.AfterRenderingGbuffer, RenderPassEvent.BeforeRenderingDeferredLights); - m_DeferredPass.Render(renderGraph, frameData, resourceData.activeColorTexture, resourceData.activeDepthTexture, resourceData.gBuffer); + m_DeferredPass.RecordRenderGraph(renderGraph, frameData); RecordCustomRenderGraphPasses(renderGraph, RenderPassEvent.AfterRenderingDeferredLights, RenderPassEvent.BeforeRenderingOpaques); @@ -1244,7 +1212,7 @@ private void OnMainRendering(RenderGraph renderGraph, ScriptableRenderContext co } } - if (copySchedules.depth == DepthCopySchedule.AfterOpaques) + if (depthCopySchedule == DepthCopySchedule.AfterOpaques) RecordCustomPassesWithDepthCopyAndMotion(renderGraph, resourceData, renderPassInputs.requiresDepthTextureEarliestEvent, RenderPassEvent.AfterRenderingOpaques, renderPassInputs.requiresMotionVectors); else RecordCustomRenderGraphPasses(renderGraph, RenderPassEvent.AfterRenderingOpaques); @@ -1259,12 +1227,12 @@ private void OnMainRendering(RenderGraph renderGraph, ScriptableRenderContext co m_DrawSkyboxPass.Render(renderGraph, frameData, context, resourceData.activeColorTexture, resourceData.activeDepthTexture, skyboxMaterial); } - if (copySchedules.depth == DepthCopySchedule.AfterSkybox) + if (depthCopySchedule == DepthCopySchedule.AfterSkybox) ExecuteScheduledDepthCopyWithMotion(renderGraph, resourceData, renderPassInputs.requiresMotionVectors); RecordCustomRenderGraphPasses(renderGraph, RenderPassEvent.AfterRenderingSkybox); - if (copySchedules.color == ColorCopySchedule.AfterSkybox) + if (renderPassInputs.requiresColorTexture) { TextureHandle cameraColor = resourceData.cameraColor; Debug.Assert(cameraColor.IsValid()); @@ -1284,7 +1252,6 @@ private void OnMainRendering(RenderGraph renderGraph, ScriptableRenderContext co } #endif - // TODO RENDERGRAPH: bind _CameraOpaqueTexture, _CameraDepthTexture in transparent pass? #if ENABLE_ADAPTIVE_PERFORMANCE if (needTransparencyPass) #endif @@ -1299,7 +1266,7 @@ private void OnMainRendering(RenderGraph renderGraph, ScriptableRenderContext co resourceData.additionalShadowsTexture); } - if (copySchedules.depth == DepthCopySchedule.AfterTransparents) + if (depthCopySchedule == DepthCopySchedule.AfterTransparents) RecordCustomPassesWithDepthCopyAndMotion(renderGraph, resourceData, renderPassInputs.requiresDepthTextureEarliestEvent, RenderPassEvent.AfterRenderingTransparents, renderPassInputs.requiresMotionVectors); else RecordCustomRenderGraphPasses(renderGraph, RenderPassEvent.AfterRenderingTransparents); @@ -1468,7 +1435,6 @@ private void OnAfterRendering(RenderGraph renderGraph, bool applyPostProcessing) if (!xrDepthTargetResolved && cameraData.xr.copyDepth) { m_XRCopyDepthPass.CopyToDepthXR = true; - m_XRCopyDepthPass.MsaaSamples = 1; m_XRCopyDepthPass.Render(renderGraph, frameData, resourceData.backBufferDepth, resourceData.cameraDepth, bindAsCameraDepth: false, "XR Depth Copy"); } } @@ -1494,8 +1460,6 @@ private void OnAfterRendering(RenderGraph renderGraph, bool applyPostProcessing) bool backbufferDepthRequired = (cameraData.isSceneViewCamera || cameraData.isPreviewCamera || UnityEditor.Handles.ShouldRenderGizmos()); if (s_RequiresIntermediateAttachments && backbufferDepthRequired) { - m_FinalDepthCopyPass.MsaaSamples = 0; - m_FinalDepthCopyPass.CopyToBackbuffer = cameraData.isGameCamera; m_FinalDepthCopyPass.Render(renderGraph, frameData, resourceData.backBufferDepth, resourceData.cameraDepth, false, "Final Depth Copy"); } #endif @@ -1508,35 +1472,28 @@ private void OnAfterRendering(RenderGraph renderGraph, bool applyPostProcessing) } //Require Depth Prepass for depth, normals or layer texture - bool RequirePrepassForTextures(UniversalCameraData cameraData, in RenderPassInputSummary renderPassInputs, bool requireDepthTexture) + bool RequirePrepassForTextures(UniversalCameraData cameraData, in RenderPassInputSummary renderPassInputs) { - bool requiresDepthTexturePrepass = requireDepthTexture && !CanCopyDepth(cameraData); - requiresDepthTexturePrepass |= cameraData.requiresDepthTexture && m_CopyDepthMode == CopyDepthMode.ForcePrepass; - requiresDepthTexturePrepass |= renderPassInputs.requiresDepthPrepass; - requiresDepthTexturePrepass |= DebugHandlerRequireDepthPass(cameraData); - requiresDepthTexturePrepass |= renderPassInputs.requiresNormalsTexture; // This must be checked explicitly because some features inject normal requirements later in the frame - return requiresDepthTexturePrepass; - } + bool requiresDepthTexturePrepass = renderPassInputs.requiresDepthTexture && !CanCopyDepth(cameraData); - //Check if _CameraDepthTexture (the copy) is required. This is not the depth attachment (ie, the intermediate texture). - static bool RequireDepthTexture(UniversalCameraData cameraData, in RenderPassInputSummary renderPassInputs, bool applyPostProcessing) - { - bool requiresDepthTexture = cameraData.requiresDepthTexture || renderPassInputs.requiresDepthTexture; - bool cameraHasPostProcessingWithDepth = applyPostProcessing && cameraData.postProcessingRequiresDepthTexture; + // A depth prepass is always required when normals are needed because URP's forward passes don't support rendering into the normals texture + // If depth is needed without normals, we only need a prepass when the event consuming depth occurs before opaque rendering is completed. + requiresDepthTexturePrepass |= renderPassInputs.requiresNormalsTexture; + requiresDepthTexturePrepass |= (renderPassInputs.requiresDepthTexture && renderPassInputs.requiresDepthTextureEarliestEvent < RenderPassEvent.AfterRenderingOpaques); - var createDepthTexture = requiresDepthTexture || cameraHasPostProcessingWithDepth; + requiresDepthTexturePrepass |= DebugHandlerRequireDepthPass(cameraData); - return createDepthTexture; + return requiresDepthTexturePrepass; } /// - /// When true the pipeline needs to add a prepass that renders depth to the currentCameraDepth. + /// When true the pipeline needs to add a full prepass that renders depth to the currentCameraDepth. /// Depth priming is an optimization (on certain devices/platforms). Features that want to leverage this as an optimization /// need to check UniversalRender.useDepthPriming (which equal to the result of this function) /// to ensure that the pipeline will actually do depth priming. - /// When this is true then we are sure that after RenderPassEvent.AfterRenderingPrePasses the currentCameraDepth has been primed. + /// When this is true then we are sure that after RenderPassEvent.AfterRenderingPrePasses the currentCameraDepth has been primed with the full depth. /// - static bool IsDepthPrimingEnabledRenderGraph(UniversalCameraData cameraData, in RenderPassInputSummary renderPassInputs, DepthPrimingMode depthPrimingMode, bool requireDepthTexture, bool requirePrepassForTextures, bool usesDeferredLighting) + static bool IsDepthPrimingEnabledRenderGraph(UniversalCameraData cameraData, in RenderPassInputSummary renderPassInputs, DepthPrimingMode depthPrimingMode, bool requirePrepassForTextures, bool usesDeferredLighting) { #if UNITY_EDITOR // We need to disable depth-priming for DrawCameraMode.Wireframe, since depth-priming forces ZTest to Equal @@ -1566,7 +1523,7 @@ static bool IsDepthPrimingEnabledRenderGraph(UniversalCameraData cameraData, in // However, some platforms don't support this copy (like GLES when MSAA is on). When a copy is not supported we turn off priming so the prepass will target the cameraDepthTexture, avoiding the copy. // Note: From Unity 2021 to Unity 6.3, depth priming was disabled in renders for reflections probes as a brute-force bugfix for artefacts appearing in reflection probes when screen space shadows are enabled. // Depth priming has now been restored in reflection probe renders. Please consider a more targeted fix if issues with screen space shadows resurface again. (See UUM-99152 and UUM-12397) - if (requireDepthTexture && !CanCopyDepth(cameraData)) + if (renderPassInputs.requiresDepthTexture && !CanCopyDepth(cameraData)) return false; // Depth Priming causes rendering errors with WebGL and WebGPU on Apple Arm64 GPUs. @@ -1574,19 +1531,6 @@ static bool IsDepthPrimingEnabledRenderGraph(UniversalCameraData cameraData, in bool depthPrimingRequested = (depthPrimingRecommended && depthPrimingMode == DepthPrimingMode.Auto) || depthPrimingMode == DepthPrimingMode.Forced; bool isNotMSAA = cameraData.cameraTargetDescriptor.msaaSamples == 1; - { - //TODO this need to be further investigated. This moved here from the MainRendering to consolidate all the depth priming logic in one place. The PR that landed this aimed to refactor without unnecessarily changing behavior. - //The prepass and gbuffer logic should have an alternative path that can handle depth priming off. This way, we can respect the user setting Never and Forced. - //Priming is bad for performance when using deferred so we don't allow it. However, when a prepass for textures is required, the gbuffer pass currently - //relies on the prepass writing the same (activeCameraDepth) depth resource. - bool needsPrimingForDeferredWithPartialPrepass = usesDeferredLighting - && ((RenderPassEvent.AfterRenderingGbuffer <= renderPassInputs.requiresDepthNormalAtEvent) && - (renderPassInputs.requiresDepthNormalAtEvent <= RenderPassEvent.BeforeRenderingOpaques)) - && requirePrepassForTextures; - if (needsPrimingForDeferredWithPartialPrepass) - return true; - } - bool isFirstCameraToWriteDepth = cameraData.renderType == CameraRenderType.Base || cameraData.clearDepth; // Depth is not rendered in a depth-only camera setup with depth priming (UUM-38158) bool isNotOffscreenDepthTexture = !IsOffscreenDepthTexture(cameraData); @@ -1788,15 +1732,9 @@ void CreateIntermediateCameraDepthAttachment(RenderGraph renderGraph, UniversalC desc.autoGenerateMips = false; bool hasMSAA = desc.msaaSamples != MSAASamples.None; - bool resolveDepth = RenderingUtils.MultisampleDepthResolveSupported() && renderGraph.nativeRenderPassesEnabled; // If we aren't using hardware depth resolves and we have MSAA, we need to resolve depth manually by binding as an MSAA texture. - desc.bindTextureMS = !resolveDepth && hasMSAA; - - // binding MS surfaces is not supported by the GLES backend, and it won't be fixed after investigating - // the high performance impact of potential fixes, which would make it more expensive than depth prepass (fogbugz 1339401 for more info) - if (IsGLESDevice()) - desc.bindTextureMS = false; + desc.bindTextureMS = hasMSAA && RenderingUtils.ShouldDepthAttachmentBindMS(); desc.format = cameraDepthAttachmentFormat; desc.filterMode = FilterMode.Point; @@ -1830,17 +1768,6 @@ void CreateIntermediateCameraDepthAttachment(RenderGraph renderGraph, UniversalC } resourceData.activeDepthID = UniversalResourceData.ActiveID.Camera; - - // Configure the copy depth pass based on the allocated depth texture - m_CopyDepthPass.MsaaSamples = (int) desc.msaaSamples; - m_CopyDepthPass.CopyToDepth = depthTextureIsDepthFormat; - - var copyResolvedDepth = !desc.bindTextureMS; - m_CopyDepthPass.m_CopyResolvedDepth = copyResolvedDepth; - -#if ENABLE_VR && ENABLE_XR_MODULE - m_XRCopyDepthPass.m_CopyResolvedDepth = copyResolvedDepth; -#endif } void CreateCameraDepthCopyTexture(RenderGraph renderGraph, TextureDesc descriptor, bool isDepthTexture, Color clearColor) @@ -1921,7 +1848,7 @@ void CreateRenderingLayersTexture(RenderGraph renderGraph, TextureDesc descripto } } - void DepthNormalPrepassRender(RenderGraph renderGraph, RenderPassInputSummary renderPassInputs, TextureHandle depthTarget, uint batchLayerMask, bool setGlobalDepth, bool setGlobalTextures) + void DepthNormalPrepassRender(RenderGraph renderGraph, RenderPassInputSummary renderPassInputs, in TextureHandle depthTarget, uint batchLayerMask, bool setGlobalDepth, bool setGlobalTextures, bool partialPass) { UniversalResourceData resourceData = frameData.Get(); @@ -1935,20 +1862,7 @@ void DepthNormalPrepassRender(RenderGraph renderGraph, RenderPassInputSummary re m_DepthNormalPrepass.enableRenderingLayers = false; } - if (usesDeferredLighting) - { - // Only render forward-only geometry, as standard geometry will be rendered as normal into the gbuffer. - if (AllowPartialDepthNormalsPrepass(usesDeferredLighting, renderPassInputs.requiresDepthNormalAtEvent, useDepthPriming)) - m_DepthNormalPrepass.shaderTagIds = k_DepthNormalsOnly; - - // TODO RENDERGRAPH: commented this out since would be equivalent to the current behaviour? Double check - //if (!m_RenderingLayerProvidesByDepthNormalPass) - // renderingLayersTexture = resourceData.gbuffer[m_DeferredLights.GBufferRenderingLayers]; // GBUffer texture here - } - - TextureHandle normalsTexture = resourceData.cameraNormalsTexture; - TextureHandle renderingLayersTexture = resourceData.renderingLayersTexture; - m_DepthNormalPrepass.Render(renderGraph, frameData, normalsTexture, depthTarget, renderingLayersTexture, batchLayerMask, setGlobalDepth, setGlobalTextures); + m_DepthNormalPrepass.Render(renderGraph, frameData, resourceData.cameraNormalsTexture, in depthTarget, resourceData.renderingLayersTexture, batchLayerMask, setGlobalDepth, setGlobalTextures, partialPass); if (m_RequiresRenderingLayer) SetRenderingLayersGlobalTextures(renderGraph); @@ -1993,7 +1907,7 @@ public static void SetGlobalTexture(RenderGraph graph, int nameId, TextureHandle builder.SetGlobalTextureAfterPass(handle, nameId); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { }); } @@ -2047,7 +1961,7 @@ internal static void Render(RenderGraph graph, TextureHandle colorHandle, Textur builder.AllowPassCulling(false); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { context.cmd.ClearRenderTarget(data.clearFlags, data.clearColor, 1, 0); }); diff --git a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/CameraStacking/MixedFOV/MixedFOV.unity b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/CameraStacking/MixedFOV/MixedFOV.unity index 15f0a2c0b82..e403a02cb7f 100644 --- a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/CameraStacking/MixedFOV/MixedFOV.unity +++ b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/CameraStacking/MixedFOV/MixedFOV.unity @@ -207,6 +207,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &15946185 MeshFilter: @@ -319,6 +320,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &67584135 MeshFilter: @@ -447,6 +449,7 @@ Canvas: m_OverridePixelPerfect: 0 m_SortingBucketNormalizedSize: 0 m_VertexColorAlwaysGammaSpace: 1 + m_UseReflectionProbes: 0 m_AdditionalShaderChannelsFlag: 1 m_UpdateRectTransformForStandalone: 0 m_SortingLayerID: 0 @@ -561,6 +564,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &156759407 MeshFilter: @@ -700,6 +704,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &164721799 MeshFilter: @@ -831,6 +836,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &194942086 MeshFilter: @@ -928,6 +934,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &385566022 MeshFilter: @@ -987,6 +994,10 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 131481531} m_Modifications: + - target: {fileID: 1028709304226404832, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} - target: {fileID: 6308746673132675046, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_Name value: CheckAssignedRenderPipelineAsset @@ -1147,7 +1158,7 @@ Light: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 705507993} m_Enabled: 1 - serializedVersion: 12 + serializedVersion: 13 m_Type: 1 m_Color: {r: 1, g: 1, b: 1, a: 1} m_Intensity: 1 @@ -1199,7 +1210,7 @@ Light: m_UseBoundingSphereOverride: 0 m_UseViewFrustumForShadowCasterCull: 1 m_ForceVisible: 0 - m_ShadowRadius: 0 + m_ShapeRadius: 0 m_ShadowAngle: 0 m_LightUnit: 1 m_LuxAtDistance: 1 @@ -1336,6 +1347,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &742501542 MeshFilter: @@ -1475,6 +1487,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &922637797 MeshFilter: @@ -1526,6 +1539,159 @@ Rigidbody: m_Interpolate: 0 m_Constraints: 16 m_CollisionDetection: 0 +--- !u!1 &935640735 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 2148271877166492642, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} + m_PrefabInstance: {fileID: 8282558930070009747} + m_PrefabAsset: {fileID: 0} +--- !u!114 &935640739 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 935640735} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1b63a52c6229a7d48944998a4fcad092, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::NewFirstPersonControler + moveSpeed: 5 + gravity: -9.81 + lookSensitivity: 1 + baseCamera: {fileID: 8282558930070009751} +--- !u!114 &935640740 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 935640735} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 62899f850307741f2a39c98a8b639597, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.InputSystem::UnityEngine.InputSystem.PlayerInput + m_Actions: {fileID: -944628639613478452, guid: f426eb113dac7124d897c338662b4024, type: 3} + m_NotificationBehavior: 0 + m_UIInputModule: {fileID: 0} + m_DeviceLostEvent: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 11500000, guid: 1b63a52c6229a7d48944998a4fcad092, type: 3} + m_TargetAssemblyTypeName: UnityEditor.MonoScript, UnityEditor.CoreModule + m_MethodName: set_name + m_Mode: 5 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: Onlook + m_BoolArgument: 0 + m_CallState: 2 + - m_Target: {fileID: 11500000, guid: 1b63a52c6229a7d48944998a4fcad092, type: 3} + m_TargetAssemblyTypeName: UnityEditor.MonoScript, UnityEditor.CoreModule + m_MethodName: set_name + m_Mode: 5 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: OnMove + m_BoolArgument: 0 + m_CallState: 2 + - m_Target: {fileID: 11500000, guid: 1b63a52c6229a7d48944998a4fcad092, type: 3} + m_TargetAssemblyTypeName: UnityEditor.MonoScript, UnityEditor.CoreModule + m_MethodName: set_name + m_Mode: 5 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: OnFire + m_BoolArgument: 0 + m_CallState: 2 + m_DeviceRegainedEvent: + m_PersistentCalls: + m_Calls: [] + m_ControlsChangedEvent: + m_PersistentCalls: + m_Calls: [] + m_ActionEvents: + - m_PersistentCalls: + m_Calls: [] + m_ActionId: 68156268-5c1f-4acc-955e-d121992f8ad5 + m_ActionName: 'Player/Move[/Keyboard/w,/Keyboard/upArrow,/Keyboard/s,/Keyboard/downArrow,/Keyboard/a,/Keyboard/leftArrow,/Keyboard/d,/Keyboard/rightArrow,/46D-C2AB/stick]' + - m_PersistentCalls: + m_Calls: [] + m_ActionId: e2f24dfb-116f-4941-8f88-cf0a20903c6a + m_ActionName: 'Player/Look[/Mouse/delta,/Touchscreen/delta,/Pen/delta]' + - m_PersistentCalls: + m_Calls: [] + m_ActionId: 75aea007-8293-456a-9d47-5442fc0f5e68 + m_ActionName: 'Player/Fire[/Mouse/leftButton,/Touchscreen/primaryTouch/tap,/46D-C2AB/trigger]' + - m_PersistentCalls: + m_Calls: [] + m_ActionId: 11b2185d-2fb4-4c89-aafd-748da443e2dc + m_ActionName: 'UI/Navigate[/46D-C2AB/stick/up,/46D-C2AB/stick/down,/46D-C2AB/stick/left,/46D-C2AB/stick/right,/Keyboard/w,/Keyboard/upArrow,/Keyboard/s,/Keyboard/downArrow,/Keyboard/a,/Keyboard/leftArrow,/Keyboard/d,/Keyboard/rightArrow]' + - m_PersistentCalls: + m_Calls: [] + m_ActionId: d587f992-6a9d-4333-a252-7293b674fd36 + m_ActionName: 'UI/Submit[/Keyboard/enter]' + - m_PersistentCalls: + m_Calls: [] + m_ActionId: 86ee9931-c691-4e12-a075-6a5bc7be2520 + m_ActionName: 'UI/Cancel[/Keyboard/escape]' + - m_PersistentCalls: + m_Calls: [] + m_ActionId: e49d4a8d-a0ca-4893-bc77-263954f4eb13 + m_ActionName: 'UI/Point[/Mouse/position,/Pen/position,/Touchscreen/touch0/position,/Touchscreen/touch1/position,/Touchscreen/touch2/position,/Touchscreen/touch3/position,/Touchscreen/touch4/position,/Touchscreen/touch5/position,/Touchscreen/touch6/position,/Touchscreen/touch7/position,/Touchscreen/touch8/position,/Touchscreen/touch9/position]' + - m_PersistentCalls: + m_Calls: [] + m_ActionId: 05a94944-eece-456c-a514-3c74d0b37a64 + m_ActionName: 'UI/Click[/Mouse/leftButton,/Pen/tip,/Touchscreen/touch0/press,/Touchscreen/touch1/press,/Touchscreen/touch2/press,/Touchscreen/touch3/press,/Touchscreen/touch4/press,/Touchscreen/touch5/press,/Touchscreen/touch6/press,/Touchscreen/touch7/press,/Touchscreen/touch8/press,/Touchscreen/touch9/press]' + - m_PersistentCalls: + m_Calls: [] + m_ActionId: 8334b98a-d9f5-4295-8292-7d83bbc450ea + m_ActionName: 'UI/ScrollWheel[/Mouse/scroll]' + - m_PersistentCalls: + m_Calls: [] + m_ActionId: 0862ed31-cb59-4cb8-b655-58f1fcc629e2 + m_ActionName: 'UI/MiddleClick[/Mouse/middleButton]' + - m_PersistentCalls: + m_Calls: [] + m_ActionId: 6f006a1f-a75d-47a8-a238-82d8b73cb7bc + m_ActionName: 'UI/RightClick[/Mouse/rightButton]' + - m_PersistentCalls: + m_Calls: [] + m_ActionId: 09be00e8-57eb-45df-a37e-77e4e01d7239 + m_ActionName: UI/TrackedDevicePosition + - m_PersistentCalls: + m_Calls: [] + m_ActionId: ac15ba30-53c8-49bc-a859-98024bf21458 + m_ActionName: UI/TrackedDeviceOrientation + m_NeverAutoSwitchControlSchemes: 0 + m_DefaultControlScheme: + m_DefaultActionMap: Player + m_SplitScreenIndex: -1 + m_Camera: {fileID: 8282558930070009751} +--- !u!114 &935640743 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 935640735} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e2ca254cf5a4eb443bba3eb4c9b3035b, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::CameraManagement + baseCamera: {fileID: 8282558930070009751} + overlayCamera: {fileID: 1434764562} --- !u!1 &1062089488 GameObject: m_ObjectHideFlags: 0 @@ -1614,6 +1780,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &1062089491 MeshFilter: @@ -1745,6 +1912,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &1188625086 MeshFilter: @@ -1842,6 +2010,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &1402436728 MeshFilter: @@ -2148,6 +2317,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &1490055368 MeshFilter: @@ -2157,85 +2327,6 @@ MeshFilter: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1490055364} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!1 &1574701474 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1574701477} - - component: {fileID: 1574701476} - - component: {fileID: 1574701478} - m_Layer: 0 - m_Name: EventSystem - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &1574701476 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1574701474} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} - m_Name: - m_EditorClassIdentifier: - m_FirstSelected: {fileID: 0} - m_sendNavigationEvents: 1 - m_DragThreshold: 10 ---- !u!4 &1574701477 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1574701474} - serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 0} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &1574701478 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1574701474} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 01614664b831546d2ae94a42149d80ac, type: 3} - m_Name: - m_EditorClassIdentifier: Unity.InputSystem::UnityEngine.InputSystem.UI.InputSystemUIInputModule - m_SendPointerHoverToParent: 1 - m_MoveRepeatDelay: 0.5 - m_MoveRepeatRate: 0.1 - m_XRTrackingOrigin: {fileID: 0} - m_ActionsAsset: {fileID: -944628639613478452, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_PointAction: {fileID: -1654692200621890270, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_MoveAction: {fileID: -8784545083839296357, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_SubmitAction: {fileID: 392368643174621059, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_CancelAction: {fileID: 7727032971491509709, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_LeftClickAction: {fileID: 3001919216989983466, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_MiddleClickAction: {fileID: -2185481485913320682, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_RightClickAction: {fileID: -4090225696740746782, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_ScrollWheelAction: {fileID: 6240969308177333660, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_TrackedDevicePositionAction: {fileID: 6564999863303420839, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_TrackedDeviceOrientationAction: {fileID: 7970375526676320489, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_DeselectOnBackgroundClick: 1 - m_PointerBehavior: 0 - m_CursorLockBehavior: 0 - m_ScrollDeltaPerTick: 6 --- !u!1 &1592661739 GameObject: m_ObjectHideFlags: 0 @@ -2324,6 +2415,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &1592661742 MeshFilter: @@ -2436,6 +2528,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &1667562488 MeshFilter: @@ -2575,6 +2668,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &1675440457 MeshFilter: @@ -2704,6 +2798,11 @@ PrefabInstance: value: This sample shows how Camera Stacking can be used in an FPS game to prevent the gun from clipping into walls. This setup also makes it possible to have different Field of Views for the "Level" camera and the "Gun" camera. + Use the fire button to switch between cameras. + objectReference: {fileID: 0} + - target: {fileID: 8490861713229784074, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} + propertyPath: m_SizeDelta.y + value: 75 objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] @@ -2803,6 +2902,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &1823617475 MeshFilter: @@ -2915,6 +3015,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &1856286181 MeshFilter: @@ -3046,6 +3147,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &1857608333 MeshFilter: @@ -3081,7 +3183,7 @@ Light: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1862309426} m_Enabled: 1 - serializedVersion: 12 + serializedVersion: 13 m_Type: 1 m_Color: {r: 1, g: 1, b: 1, a: 1} m_Intensity: 0.5 @@ -3133,7 +3235,7 @@ Light: m_UseBoundingSphereOverride: 0 m_UseViewFrustumForShadowCasterCull: 1 m_ForceVisible: 0 - m_ShadowRadius: 0 + m_ShapeRadius: 0 m_ShadowAngle: 0 m_LightUnit: 1 m_LuxAtDistance: 1 @@ -3270,6 +3372,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &1913427153 MeshFilter: @@ -3382,6 +3485,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &2042961014 MeshFilter: @@ -3601,7 +3705,7 @@ PrefabInstance: m_Modifications: - target: {fileID: 2148271877166492642, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_Name - value: Cameras + value: Player objectReference: {fileID: 0} - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_RootOrder @@ -3667,6 +3771,10 @@ PrefabInstance: propertyPath: m_Name value: Level Camera objectReference: {fileID: 0} + - target: {fileID: 8509898242313118626, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} + propertyPath: m_Enabled + value: 0 + objectReference: {fileID: 0} - target: {fileID: 8509898242313118626, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_MoveWithMouse value: 1 @@ -3676,24 +3784,39 @@ PrefabInstance: value: 100 objectReference: {fileID: 0} m_RemovedComponents: + - {fileID: 0} - {fileID: 8900132868616544278, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} + - {fileID: 8509898242313118626, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} m_RemovedGameObjects: [] m_AddedGameObjects: - targetCorrespondingSourceObject: {fileID: 3363522893988168260, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} insertIndex: -1 addedObject: {fileID: 1434764559} - m_AddedComponents: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 2148271877166492642, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} + insertIndex: -1 + addedObject: {fileID: 935640739} + - targetCorrespondingSourceObject: {fileID: 2148271877166492642, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} + insertIndex: -1 + addedObject: {fileID: 935640740} + - targetCorrespondingSourceObject: {fileID: 2148271877166492642, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} + insertIndex: -1 + addedObject: {fileID: 935640743} m_SourcePrefab: {fileID: 100100000, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} --- !u!4 &8282558930070009748 stripped Transform: m_CorrespondingSourceObject: {fileID: 3363522893988168260, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} m_PrefabInstance: {fileID: 8282558930070009747} m_PrefabAsset: {fileID: 0} +--- !u!20 &8282558930070009751 stripped +Camera: + m_CorrespondingSourceObject: {fileID: 1104701761066559480, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} + m_PrefabInstance: {fileID: 8282558930070009747} + m_PrefabAsset: {fileID: 0} --- !u!1660057539 &9223372036854775807 SceneRoots: m_ObjectHideFlags: 0 m_Roots: - {fileID: 131481531} - - {fileID: 1574701477} - {fileID: 567206876} - {fileID: 8282558930070009747} diff --git a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/Shaders/Lit/Lit.unity b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/Shaders/Lit/Lit.unity index 26c68993549..9847801549a 100644 --- a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/Shaders/Lit/Lit.unity +++ b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/Shaders/Lit/Lit.unity @@ -38,12 +38,12 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 1090784526} - m_IndirectSpecularColor: {r: 0.18098786, g: 0.22654998, b: 0.3072675, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: m_ObjectHideFlags: 0 - serializedVersion: 12 + serializedVersion: 13 + m_BakeOnSceneLoad: 0 m_GISettings: serializedVersion: 2 m_BounceScale: 1 @@ -93,10 +93,8 @@ LightmapSettings: m_ExportTrainingData: 0 m_TrainingDataDestination: TrainingData m_LightProbeSampleCountMultiplier: 4 - m_LightingDataAsset: {fileID: 112000000, guid: 7632e9382edaf42eea71fffda301b7e4, - type: 2} - m_LightingSettings: {fileID: 4890085278179872738, guid: cce5fc22d530544e9baddea9febf9776, - type: 2} + m_LightingDataAsset: {fileID: 112000000, guid: 7632e9382edaf42eea71fffda301b7e4, type: 2} + m_LightingSettings: {fileID: 4890085278179872738, guid: cce5fc22d530544e9baddea9febf9776, type: 2} --- !u!196 &4 NavMeshSettings: serializedVersion: 2 @@ -129,164 +127,131 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 0} m_Modifications: - - target: {fileID: 363678494143714049, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 363678494143714049, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 2325730147888387742, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 2325730147888387742, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: NoMapText objectReference: {fileID: 0} - - target: {fileID: 2984202550618798972, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 2984202550618798972, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: ba4db6da9324f499ab79a4b3c8e476d1, type: 2} - - target: {fileID: 3158804035374670811, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 3158804035374670811, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: MappedSphere objectReference: {fileID: 0} - - target: {fileID: 3519193640892908046, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 3519193640892908046, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 673fd4308d68a4e6eb452d59b21ff3d4, type: 2} - - target: {fileID: 3632988833837816489, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 3632988833837816489, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: NoMapSphere objectReference: {fileID: 0} - - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Text value: 'Normal Map With Height Map' objectReference: {fileID: 0} - - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_CharacterSize value: 0.03 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_RootOrder value: 8 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalPosition.x value: 12.6 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalPosition.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalPosition.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalRotation.w value: 1 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalRotation.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalRotation.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalRotation.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalEulerAnglesHint.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalEulerAnglesHint.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757497, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757497, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: HeightMap objectReference: {fileID: 0} - - target: {fileID: 4515863344285757497, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757497, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 4515863345698722662, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863345698722662, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 673fd4308d68a4e6eb452d59b21ff3d4, type: 2} - - target: {fileID: 4515863345698722664, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863345698722664, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: MappedQuad objectReference: {fileID: 0} - - target: {fileID: 4515863345714478689, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863345714478689, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: ba4db6da9324f499ab79a4b3c8e476d1, type: 2} - - target: {fileID: 4515863345714478691, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863345714478691, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: NoMapQuad objectReference: {fileID: 0} - - target: {fileID: 5084966873698575717, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 5084966873698575717, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 6328839550329180593, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 6328839550329180593, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: MappedText objectReference: {fileID: 0} - - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Text value: 'Normal Map No Height Map' objectReference: {fileID: 0} - - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_CharacterSize value: 0.03 objectReference: {fileID: 0} @@ -303,359 +268,283 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 0} m_Modifications: - - target: {fileID: 175851581590636847, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 175851581590636847, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 81a7b3fb99e984cb0a7a85e94d32a98e, type: 2} - - target: {fileID: 363678494143714049, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 363678494143714049, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 703742556405561692, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 703742556405561692, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 703742556405561692, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 703742556405561692, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Text value: Metallic Map objectReference: {fileID: 0} - - target: {fileID: 703742556405561692, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 703742556405561692, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_CharacterSize value: 0.03 objectReference: {fileID: 0} - - target: {fileID: 707564616722749779, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 707564616722749779, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_LocalRotation.w value: -0.37843886 objectReference: {fileID: 0} - - target: {fileID: 707564616722749779, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 707564616722749779, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_LocalRotation.y value: 0.92562634 objectReference: {fileID: 0} - - target: {fileID: 707564616722749779, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 707564616722749779, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_LocalEulerAnglesHint.y value: 224.474 objectReference: {fileID: 0} - - target: {fileID: 792100534224308606, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 792100534224308606, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: c2809691a61fc4a43b6483eee535d786, type: 2} - - target: {fileID: 1579627784970439916, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 1579627784970439916, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: MetallicText objectReference: {fileID: 0} - - target: {fileID: 1700924697434049057, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 1700924697434049057, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: c2809691a61fc4a43b6483eee535d786, type: 2} - - target: {fileID: 1856864314734137278, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 1856864314734137278, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: EmisisonSphere objectReference: {fileID: 0} - - target: {fileID: 2325730147888387742, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 2325730147888387742, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: NormalText objectReference: {fileID: 0} - - target: {fileID: 2384831340507027100, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 2384831340507027100, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 2516708741707952774, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 2516708741707952774, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 3e2d3ad60e29e404da68fa903eaff772, type: 2} - - target: {fileID: 2984202550618798972, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 2984202550618798972, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 3e1368ee81423418da8a693099ce68c0, type: 2} - - target: {fileID: 3158804035374670811, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 3158804035374670811, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: HeightSphere objectReference: {fileID: 0} - - target: {fileID: 3432419910411265175, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 3432419910411265175, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 3519193640892908046, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 3519193640892908046, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: db2f9e1b0d51c4244972d007409c5d1a, type: 2} - - target: {fileID: 3632988833837816489, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 3632988833837816489, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: NormalSphere objectReference: {fileID: 0} - - target: {fileID: 3639366238018879424, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 3639366238018879424, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 3639366238018879424, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 3639366238018879424, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Text value: Height Map objectReference: {fileID: 0} - - target: {fileID: 3639366238018879424, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 3639366238018879424, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_CharacterSize value: 0.03 objectReference: {fileID: 0} - - target: {fileID: 3690115919084241155, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 3690115919084241155, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: EmissionText objectReference: {fileID: 0} - - target: {fileID: 3903542586167764489, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 3903542586167764489, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 4466141343835727266, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4466141343835727266, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: OcclusionText objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_RootOrder value: 11 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_LocalPosition.x value: 26.3 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_LocalPosition.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_LocalPosition.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_LocalRotation.w value: 1 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_LocalRotation.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_LocalRotation.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_LocalRotation.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_LocalEulerAnglesHint.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_LocalEulerAnglesHint.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757497, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863344285757497, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: Texture Maps objectReference: {fileID: 0} - - target: {fileID: 4515863344285757497, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863344285757497, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 4515863345698722662, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863345698722662, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: db2f9e1b0d51c4244972d007409c5d1a, type: 2} - - target: {fileID: 4515863345698722664, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863345698722664, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: HeightQuad objectReference: {fileID: 0} - - target: {fileID: 4515863345714478689, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863345714478689, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 3e1368ee81423418da8a693099ce68c0, type: 2} - - target: {fileID: 4515863345714478691, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863345714478691, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: NormalQuad objectReference: {fileID: 0} - - target: {fileID: 4519952585507003653, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4519952585507003653, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: BaseQuad objectReference: {fileID: 0} - - target: {fileID: 4868844637098708737, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4868844637098708737, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: OcclusionSphere objectReference: {fileID: 0} - - target: {fileID: 5084966873698575717, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 5084966873698575717, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 5838474508579879326, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 5838474508579879326, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 81a7b3fb99e984cb0a7a85e94d32a98e, type: 2} - - target: {fileID: 5982961926340784712, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 5982961926340784712, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: EmisisonQuad objectReference: {fileID: 0} - - target: {fileID: 6328839550329180593, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 6328839550329180593, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: HeightText objectReference: {fileID: 0} - - target: {fileID: 6329929520080556972, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 6329929520080556972, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 6329929520080556972, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 6329929520080556972, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Text value: Normal Map objectReference: {fileID: 0} - - target: {fileID: 6329929520080556972, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 6329929520080556972, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_CharacterSize value: 0.03 objectReference: {fileID: 0} - - target: {fileID: 6381987796755295956, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 6381987796755295956, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 71d0ae4a494e24fc8842080c57cdeee7, type: 2} - - target: {fileID: 7176882605897474993, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 7176882605897474993, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 7422092480594011468, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 7422092480594011468, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: OcclusionQuad objectReference: {fileID: 0} - - target: {fileID: 7444712557463921412, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 7444712557463921412, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: BaseText objectReference: {fileID: 0} - - target: {fileID: 7499780522273572509, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 7499780522273572509, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 7499780522273572509, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 7499780522273572509, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Text value: Base Map objectReference: {fileID: 0} - - target: {fileID: 7499780522273572509, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 7499780522273572509, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_CharacterSize value: 0.03 objectReference: {fileID: 0} - - target: {fileID: 7594455542058088936, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 7594455542058088936, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: MetallicQuad objectReference: {fileID: 0} - - target: {fileID: 7992821393818068015, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 7992821393818068015, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 7992821393818068015, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 7992821393818068015, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Text value: Emission Map objectReference: {fileID: 0} - - target: {fileID: 7992821393818068015, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 7992821393818068015, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_CharacterSize value: 0.03 objectReference: {fileID: 0} - - target: {fileID: 8078821430268539671, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 8078821430268539671, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: MetallicSphere objectReference: {fileID: 0} - - target: {fileID: 8220988234712831962, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 8220988234712831962, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 3e2d3ad60e29e404da68fa903eaff772, type: 2} - - target: {fileID: 8492668814307491323, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 8492668814307491323, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: BaseSphere objectReference: {fileID: 0} - - target: {fileID: 9066520212796099257, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 9066520212796099257, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 71d0ae4a494e24fc8842080c57cdeee7, type: 2} - - target: {fileID: 9205124857158510153, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 9205124857158510153, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 9205124857158510153, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 9205124857158510153, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Text value: Occlusion Map objectReference: {fileID: 0} - - target: {fileID: 9205124857158510153, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 9205124857158510153, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_CharacterSize value: 0.03 objectReference: {fileID: 0} @@ -672,164 +561,131 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 0} m_Modifications: - - target: {fileID: 363678494143714049, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 363678494143714049, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 2325730147888387742, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 2325730147888387742, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: NoMapText objectReference: {fileID: 0} - - target: {fileID: 2984202550618798972, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 2984202550618798972, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 92b3aa099ecb9483381c91aba9894aad, type: 2} - - target: {fileID: 3158804035374670811, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 3158804035374670811, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: MappedSphere objectReference: {fileID: 0} - - target: {fileID: 3519193640892908046, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 3519193640892908046, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: ba4db6da9324f499ab79a4b3c8e476d1, type: 2} - - target: {fileID: 3632988833837816489, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 3632988833837816489, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: NoMapSphere objectReference: {fileID: 0} - - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Text value: 'With Normal Map' objectReference: {fileID: 0} - - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_CharacterSize value: 0.03 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_RootOrder value: 7 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalPosition.x value: 9.4 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalPosition.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalPosition.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalRotation.w value: 1 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalRotation.x value: -0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalRotation.y value: -0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalRotation.z value: -0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalEulerAnglesHint.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalEulerAnglesHint.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757497, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757497, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: NormalMap objectReference: {fileID: 0} - - target: {fileID: 4515863344285757497, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757497, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 4515863345698722662, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863345698722662, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: ba4db6da9324f499ab79a4b3c8e476d1, type: 2} - - target: {fileID: 4515863345698722664, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863345698722664, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: MappedQuad objectReference: {fileID: 0} - - target: {fileID: 4515863345714478689, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863345714478689, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 92b3aa099ecb9483381c91aba9894aad, type: 2} - - target: {fileID: 4515863345714478691, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863345714478691, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: NoMapQuad objectReference: {fileID: 0} - - target: {fileID: 5084966873698575717, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 5084966873698575717, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 6328839550329180593, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 6328839550329180593, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: MappedText objectReference: {fileID: 0} - - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Text value: 'Without Normal Map' objectReference: {fileID: 0} - - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_CharacterSize value: 0.03 objectReference: {fileID: 0} @@ -838,6 +694,57 @@ PrefabInstance: m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: b350d0ee6adff493c954545853ab9922, type: 3} +--- !u!1 &671775837 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 2148271877166492642, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} + m_PrefabInstance: {fileID: 1925206219} + m_PrefabAsset: {fileID: 0} +--- !u!114 &671775840 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 671775837} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1b63a52c6229a7d48944998a4fcad092, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::FirstPersonController + moveSpeed: 5 + gravity: -9.81 + lookSensitivity: 0.5 + baseCamera: {fileID: 1703775717} +--- !u!114 &671775841 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 671775837} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 62899f850307741f2a39c98a8b639597, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.InputSystem::UnityEngine.InputSystem.PlayerInput + m_Actions: {fileID: -944628639613478452, guid: f426eb113dac7124d897c338662b4024, type: 3} + m_NotificationBehavior: 0 + m_UIInputModule: {fileID: 0} + m_DeviceLostEvent: + m_PersistentCalls: + m_Calls: [] + m_DeviceRegainedEvent: + m_PersistentCalls: + m_Calls: [] + m_ControlsChangedEvent: + m_PersistentCalls: + m_Calls: [] + m_ActionEvents: [] + m_NeverAutoSwitchControlSchemes: 0 + m_DefaultControlScheme: + m_DefaultActionMap: + m_SplitScreenIndex: -1 + m_Camera: {fileID: 1703775717} --- !u!1001 &734120777 PrefabInstance: m_ObjectHideFlags: 0 @@ -846,198 +753,157 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 0} m_Modifications: - - target: {fileID: 605078736972206957, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 605078736972206957, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 965276579647584521, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 965276579647584521, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: MappedSphere objectReference: {fileID: 0} - - target: {fileID: 1613878145432836316, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 1613878145432836316, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: ba07f5ddfe8f94c61ac3c22a32d15fc4, type: 2} - - target: {fileID: 1810530080357623737, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 1810530080357623737, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: BlueEmissionText objectReference: {fileID: 0} - - target: {fileID: 1814010385164494244, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 1814010385164494244, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 1814010385164494244, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 1814010385164494244, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Text value: No Emission objectReference: {fileID: 0} - - target: {fileID: 1814010385164494244, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 1814010385164494244, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_CharacterSize value: 0.04 objectReference: {fileID: 0} - - target: {fileID: 3023133885351793476, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 3023133885351793476, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: MappedQuad objectReference: {fileID: 0} - - target: {fileID: 3273462983484937657, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 3273462983484937657, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 3552189744290811969, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 3552189744290811969, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 3552189744290811969, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 3552189744290811969, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Text value: Emission Map objectReference: {fileID: 0} - - target: {fileID: 3552189744290811969, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 3552189744290811969, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_CharacterSize value: 0.04 objectReference: {fileID: 0} - - target: {fileID: 3685639466378869937, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 3685639466378869937, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: ba07f5ddfe8f94c61ac3c22a32d15fc4, type: 2} - - target: {fileID: 5474351984923567369, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 5474351984923567369, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 7287552079565133267, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 7287552079565133267, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: BlueEmissionSphere objectReference: {fileID: 0} - - target: {fileID: 7976546426794385558, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 7976546426794385558, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: NoEmissionText objectReference: {fileID: 0} - - target: {fileID: 8097283291250739307, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283291250739307, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: NoEmissionQuad objectReference: {fileID: 0} - - target: {fileID: 8097283291266426208, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283291266426208, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: BlueEmissionQuad objectReference: {fileID: 0} - - target: {fileID: 8097283291266426222, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283291266426222, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 0c32055e4135a484b913cc24d7fd1be5, type: 2} - - target: {fileID: 8097283293074703921, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703921, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: Emission objectReference: {fileID: 0} - - target: {fileID: 8097283293074703921, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703921, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_RootOrder value: 10 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalPosition.x value: 19.6 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalPosition.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalPosition.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalRotation.w value: 1 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalRotation.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalRotation.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalRotation.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalEulerAnglesHint.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalEulerAnglesHint.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 8290614998434304938, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8290614998434304938, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: MappedText objectReference: {fileID: 0} - - target: {fileID: 8968186135458761160, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8968186135458761160, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 8968186135458761160, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 8968186135458761160, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Text value: 'Bright blue Emission' objectReference: {fileID: 0} - - target: {fileID: 8968186135458761160, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8968186135458761160, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_CharacterSize value: 0.04 objectReference: {fileID: 0} - - target: {fileID: 8979682401931062433, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8979682401931062433, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: NoEmissionSphere objectReference: {fileID: 0} - - target: {fileID: 9088944033397224454, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 9088944033397224454, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 0c32055e4135a484b913cc24d7fd1be5, type: 2} @@ -1057,6 +923,11 @@ GameObject: - component: {fileID: 902575298} - component: {fileID: 902575297} - component: {fileID: 902575296} + - component: {fileID: 902575299} + - component: {fileID: 902575303} + - component: {fileID: 902575302} + - component: {fileID: 902575301} + - component: {fileID: 902575300} m_Layer: 0 m_Name: Floor m_TagString: Untagged @@ -1083,6 +954,9 @@ MeshRenderer: m_RayTraceProcedural: 0 m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 + m_ForceMeshLod: -1 + m_MeshLodSelectionBias: 0 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: @@ -1104,9 +978,11 @@ MeshRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &902575297 MeshFilter: @@ -1131,6 +1007,112 @@ Transform: m_Children: [] m_Father: {fileID: 909040152} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!64 &902575299 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 902575294} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 5 + m_Convex: 0 + m_CookingOptions: 30 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!65 &902575300 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 902575294} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 0.015852813, y: 0.09999999, z: 0.62597126} + m_Center: {x: -0.38, y: 0.049999993, z: -0.00012832641} +--- !u!65 &902575301 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 902575294} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 0.015852813, y: 0.09999999, z: 0.62597126} + m_Center: {x: 0.99026203, y: 0.049999993, z: -0.00012832641} +--- !u!65 &902575302 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 902575294} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 1.3748568, y: 0.09999999, z: 0.01} + m_Center: {x: 0.3107637, y: 0.049999993, z: -0.31} +--- !u!65 &902575303 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 902575294} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 1.3748568, y: 0.09999999, z: 0.01} + m_Center: {x: 0.3107637, y: 0.049999993, z: 0.31} --- !u!1 &909040151 GameObject: m_ObjectHideFlags: 0 @@ -1193,14 +1175,14 @@ Light: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1090784525} m_Enabled: 1 - serializedVersion: 11 + serializedVersion: 13 m_Type: 1 m_Color: {r: 1, g: 0.9909949, b: 0.9669811, a: 1} m_Intensity: 1 m_Range: 10 m_SpotAngle: 30 m_InnerSpotAngle: 21.80208 - m_CookieSize: 10 + m_CookieSize2D: {x: 10, y: 10} m_Shadows: m_Type: 2 m_Resolution: -1 @@ -1244,8 +1226,12 @@ Light: m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} m_UseBoundingSphereOverride: 0 m_UseViewFrustumForShadowCasterCull: 1 - m_ShadowRadius: 0 + m_ForceVisible: 0 + m_ShapeRadius: 0 m_ShadowAngle: 0 + m_LightUnit: 1 + m_LuxAtDistance: 1 + m_EnableSpotReflector: 1 --- !u!4 &1090784527 Transform: m_ObjectHideFlags: 0 @@ -1273,17 +1259,23 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 474bcb49853aa07438625e644c072ee6, type: 3} m_Name: m_EditorClassIdentifier: - m_Version: 3 m_UsePipelineSettings: 1 m_AdditionalLightsShadowResolutionTier: 2 - m_LightLayerMask: 1 - m_RenderingLayers: 1 m_CustomShadowLayers: 0 - m_ShadowLayerMask: 1 - m_ShadowRenderingLayers: 1 m_LightCookieSize: {x: 1, y: 1} m_LightCookieOffset: {x: 0, y: 0} m_SoftShadowQuality: 1 + m_RenderingLayersMask: + serializedVersion: 0 + m_Bits: 1 + m_ShadowRenderingLayersMask: + serializedVersion: 0 + m_Bits: 1 + m_Version: 4 + m_LightLayerMask: 1 + m_ShadowLayerMask: 1 + m_RenderingLayers: 1 + m_ShadowRenderingLayers: 1 --- !u!1 &1157374852 GameObject: m_ObjectHideFlags: 0 @@ -1341,164 +1333,131 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 0} m_Modifications: - - target: {fileID: 363678494143714049, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 363678494143714049, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 2325730147888387742, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 2325730147888387742, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: NoMapText objectReference: {fileID: 0} - - target: {fileID: 2984202550618798972, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 2984202550618798972, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: ba4db6da9324f499ab79a4b3c8e476d1, type: 2} - - target: {fileID: 3158804035374670811, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 3158804035374670811, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: MappedSphere objectReference: {fileID: 0} - - target: {fileID: 3519193640892908046, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 3519193640892908046, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 615945db2db8246c39b806c45ece2fa7, type: 2} - - target: {fileID: 3632988833837816489, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 3632988833837816489, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: NoMapSphere objectReference: {fileID: 0} - - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Text value: 'Normap Map With Occlusion Map' objectReference: {fileID: 0} - - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_CharacterSize value: 0.025 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_RootOrder value: 9 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalPosition.x value: 15.8 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalPosition.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalPosition.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalRotation.w value: 1 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalRotation.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalRotation.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalRotation.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalEulerAnglesHint.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalEulerAnglesHint.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757497, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757497, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: Occlusion objectReference: {fileID: 0} - - target: {fileID: 4515863344285757497, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757497, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 4515863345698722662, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863345698722662, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 615945db2db8246c39b806c45ece2fa7, type: 2} - - target: {fileID: 4515863345698722664, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863345698722664, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: MappedQuad objectReference: {fileID: 0} - - target: {fileID: 4515863345714478689, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863345714478689, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: ba4db6da9324f499ab79a4b3c8e476d1, type: 2} - - target: {fileID: 4515863345714478691, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863345714478691, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: NoMapQuad objectReference: {fileID: 0} - - target: {fileID: 5084966873698575717, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 5084966873698575717, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 6328839550329180593, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 6328839550329180593, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: MappedText objectReference: {fileID: 0} - - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Text value: 'Normal Map No Occlusion Map' objectReference: {fileID: 0} - - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_CharacterSize value: 0.025 objectReference: {fileID: 0} @@ -1548,14 +1507,14 @@ Light: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1647640623} m_Enabled: 1 - serializedVersion: 11 + serializedVersion: 13 m_Type: 1 m_Color: {r: 1, g: 0.944407, b: 0.8443396, a: 1} m_Intensity: 0.2 m_Range: 10 m_SpotAngle: 30 m_InnerSpotAngle: 21.80208 - m_CookieSize: 10 + m_CookieSize2D: {x: 10, y: 10} m_Shadows: m_Type: 2 m_Resolution: -1 @@ -1599,8 +1558,12 @@ Light: m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} m_UseBoundingSphereOverride: 0 m_UseViewFrustumForShadowCasterCull: 1 - m_ShadowRadius: 0 + m_ForceVisible: 0 + m_ShapeRadius: 0 m_ShadowAngle: 0 + m_LightUnit: 1 + m_LuxAtDistance: 1 + m_EnableSpotReflector: 1 --- !u!114 &1647640626 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1613,85 +1576,28 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 474bcb49853aa07438625e644c072ee6, type: 3} m_Name: m_EditorClassIdentifier: - m_Version: 3 m_UsePipelineSettings: 1 m_AdditionalLightsShadowResolutionTier: 2 - m_LightLayerMask: 1 - m_RenderingLayers: 1 m_CustomShadowLayers: 0 - m_ShadowLayerMask: 1 - m_ShadowRenderingLayers: 1 m_LightCookieSize: {x: 1, y: 1} m_LightCookieOffset: {x: 0, y: 0} m_SoftShadowQuality: 1 ---- !u!1 &1720569094 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1720569097} - - component: {fileID: 1720569096} - - component: {fileID: 1720569095} - m_Layer: 0 - m_Name: EventSystem - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &1720569095 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1720569094} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} - m_Name: - m_EditorClassIdentifier: - m_SendPointerHoverToParent: 1 - m_HorizontalAxis: Horizontal - m_VerticalAxis: Vertical - m_SubmitButton: Submit - m_CancelButton: Cancel - m_InputActionsPerSecond: 10 - m_RepeatDelay: 0.5 - m_ForceModuleActive: 0 ---- !u!114 &1720569096 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1720569094} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} - m_Name: - m_EditorClassIdentifier: - m_FirstSelected: {fileID: 0} - m_sendNavigationEvents: 1 - m_DragThreshold: 10 ---- !u!4 &1720569097 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} + m_RenderingLayersMask: + serializedVersion: 0 + m_Bits: 1 + m_ShadowRenderingLayersMask: + serializedVersion: 0 + m_Bits: 1 + m_Version: 4 + m_LightLayerMask: 1 + m_ShadowLayerMask: 1 + m_RenderingLayers: 1 + m_ShadowRenderingLayers: 1 +--- !u!20 &1703775717 stripped +Camera: + m_CorrespondingSourceObject: {fileID: 1104701761066559480, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} + m_PrefabInstance: {fileID: 1925206219} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1720569094} - serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 0} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &1925206219 PrefabInstance: m_ObjectHideFlags: 0 @@ -1700,93 +1606,75 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 0} m_Modifications: - - target: {fileID: 1104701761066559480, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 1104701761066559480, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_ClearFlags value: 1 objectReference: {fileID: 0} - - target: {fileID: 2148271877166492642, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 2148271877166492642, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_Name value: FirstPersonPlayer objectReference: {fileID: 0} - - target: {fileID: 2148271877166492642, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 2148271877166492642, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_RootOrder value: 1 objectReference: {fileID: 0} - - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_LocalPosition.x value: -2.5 objectReference: {fileID: 0} - - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_LocalPosition.y value: 1 objectReference: {fileID: 0} - - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_LocalPosition.z value: -3 objectReference: {fileID: 0} - - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_LocalRotation.w value: 0.9273146 objectReference: {fileID: 0} - - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_LocalRotation.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_LocalRotation.y value: 0.3742829 objectReference: {fileID: 0} - - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_LocalRotation.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_LocalEulerAnglesHint.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_LocalEulerAnglesHint.y value: 43.96 objectReference: {fileID: 0} - - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 6350239021526260069, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 6350239021526260069, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_Antialiasing value: 2 objectReference: {fileID: 0} - - target: {fileID: 6350239021526260069, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 6350239021526260069, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_RendererIndex value: 0 objectReference: {fileID: 0} - - target: {fileID: 6350239021526260069, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 6350239021526260069, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_RenderPostProcessing value: 1 objectReference: {fileID: 0} - - target: {fileID: 8509898242313118626, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 8509898242313118626, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_MovementSpeed value: 4 objectReference: {fileID: 0} @@ -1794,7 +1682,13 @@ PrefabInstance: - {fileID: 8900132868616544278, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} m_RemovedGameObjects: [] m_AddedGameObjects: [] - m_AddedComponents: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 2148271877166492642, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} + insertIndex: -1 + addedObject: {fileID: 671775841} + - targetCorrespondingSourceObject: {fileID: 2148271877166492642, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} + insertIndex: -1 + addedObject: {fileID: 671775840} m_SourcePrefab: {fileID: 100100000, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} --- !u!1001 &1932534512 PrefabInstance: @@ -1804,108 +1698,87 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 222607664510397816} m_Modifications: - - target: {fileID: 6308746673132675046, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6308746673132675046, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_Name value: CheckAssignedRenderPipelineAsset objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_Pivot.x value: 0.5 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_Pivot.y value: 0.5 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_AnchorMax.x value: 0.5 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_AnchorMax.y value: 0.5 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_AnchorMin.x value: 0.5 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_AnchorMin.y value: 0.5 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_SizeDelta.x value: 100 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_SizeDelta.y value: 100 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_LocalPosition.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_LocalPosition.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_LocalPosition.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_LocalRotation.w value: 1 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_LocalRotation.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_LocalRotation.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_LocalRotation.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_AnchoredPosition.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_LocalEulerAnglesHint.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_LocalEulerAnglesHint.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} @@ -1916,8 +1789,7 @@ PrefabInstance: m_SourcePrefab: {fileID: 100100000, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} --- !u!224 &1932534513 stripped RectTransform: - m_CorrespondingSourceObject: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + m_CorrespondingSourceObject: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} m_PrefabInstance: {fileID: 1932534512} m_PrefabAsset: {fileID: 0} --- !u!1001 &1951643861 @@ -1928,266 +1800,211 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 0} m_Modifications: - - target: {fileID: 175851581590636847, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 175851581590636847, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 7e1dd3465110745d9820dc9c8a97152e, type: 2} - - target: {fileID: 363678494143714049, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 363678494143714049, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 2325730147888387742, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 2325730147888387742, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Name value: MetallicText objectReference: {fileID: 0} - - target: {fileID: 2384831340507027100, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 2384831340507027100, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 2984202550618798972, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 2984202550618798972, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 3e58fe99dbdc941fbb127782a5413890, type: 2} - - target: {fileID: 3158804035374670811, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 3158804035374670811, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Name value: SmoothSphere objectReference: {fileID: 0} - - target: {fileID: 3158804035374670811, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 3158804035374670811, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_StaticEditorFlags value: 64 objectReference: {fileID: 0} - - target: {fileID: 3519193640892908046, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 3519193640892908046, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: cd8dde816b1e341aa9dd9afca2da9937, type: 2} - - target: {fileID: 3632988833837816489, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 3632988833837816489, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Name value: MetallicSphere objectReference: {fileID: 0} - - target: {fileID: 3639366238018879424, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 3639366238018879424, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 3639366238018879424, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 3639366238018879424, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Text value: 'Smoothness One' objectReference: {fileID: 0} - - target: {fileID: 3639366238018879424, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 3639366238018879424, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_CharacterSize value: 0.03 objectReference: {fileID: 0} - - target: {fileID: 4466141343835727266, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4466141343835727266, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Name value: MappedText objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_RootOrder value: 6 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_LocalPosition.x value: 5 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_LocalPosition.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_LocalPosition.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_LocalRotation.w value: 1 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_LocalRotation.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_LocalRotation.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_LocalRotation.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_LocalEulerAnglesHint.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_LocalEulerAnglesHint.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757497, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863344285757497, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Name value: Metallic/Smoothness objectReference: {fileID: 0} - - target: {fileID: 4515863344285757497, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863344285757497, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 4515863345698722662, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863345698722662, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: cd8dde816b1e341aa9dd9afca2da9937, type: 2} - - target: {fileID: 4515863345698722664, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863345698722664, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Name value: SmoothQuad objectReference: {fileID: 0} - - target: {fileID: 4515863345714478689, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863345714478689, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 3e58fe99dbdc941fbb127782a5413890, type: 2} - - target: {fileID: 4515863345714478691, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863345714478691, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Name value: MetallicQuad objectReference: {fileID: 0} - - target: {fileID: 4519952585507003653, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4519952585507003653, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Name value: ZeroQuad objectReference: {fileID: 0} - - target: {fileID: 4868844637098708737, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4868844637098708737, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Name value: MappedSphere objectReference: {fileID: 0} - - target: {fileID: 5084966873698575717, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 5084966873698575717, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 5838474508579879326, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 5838474508579879326, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 7e1dd3465110745d9820dc9c8a97152e, type: 2} - - target: {fileID: 6328839550329180593, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 6328839550329180593, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Name value: SmoothText objectReference: {fileID: 0} - - target: {fileID: 6329929520080556972, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 6329929520080556972, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 6329929520080556972, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 6329929520080556972, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Text value: "Metallic \nOne" objectReference: {fileID: 0} - - target: {fileID: 6329929520080556972, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 6329929520080556972, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_CharacterSize value: 0.03 objectReference: {fileID: 0} - - target: {fileID: 6381987796755295956, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 6381987796755295956, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: bfe840013b1e840cdbc00d83632179e8, type: 2} - - target: {fileID: 7176882605897474993, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 7176882605897474993, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 7422092480594011468, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 7422092480594011468, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Name value: MappedQuad objectReference: {fileID: 0} - - target: {fileID: 7444712557463921412, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 7444712557463921412, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Name value: ZeroText objectReference: {fileID: 0} - - target: {fileID: 7499780522273572509, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 7499780522273572509, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 7499780522273572509, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 7499780522273572509, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Text value: 'Metallic/Smoothness Zero' objectReference: {fileID: 0} - - target: {fileID: 7499780522273572509, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 7499780522273572509, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_CharacterSize value: 0.03 objectReference: {fileID: 0} - - target: {fileID: 8492668814307491323, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 8492668814307491323, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Name value: ZeroSphere objectReference: {fileID: 0} - - target: {fileID: 8492668814307491323, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 8492668814307491323, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_StaticEditorFlags value: 64 objectReference: {fileID: 0} - - target: {fileID: 9066520212796099257, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 9066520212796099257, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: bfe840013b1e840cdbc00d83632179e8, type: 2} - - target: {fileID: 9205124857158510153, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 9205124857158510153, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 9205124857158510153, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 9205124857158510153, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Text value: Metallic Map objectReference: {fileID: 0} - - target: {fileID: 9205124857158510153, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 9205124857158510153, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_CharacterSize value: 0.03 objectReference: {fileID: 0} @@ -2269,123 +2086,99 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 222607664510397816} m_Modifications: - - target: {fileID: 155458132493177538, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 155458132493177538, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_Name value: MainPanel objectReference: {fileID: 0} - - target: {fileID: 1638750836712682043, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 1638750836712682043, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_Text value: Lit Shader objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_Pivot.x value: 1 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_Pivot.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_RootOrder value: 2 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_AnchorMax.x value: 1 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_AnchorMax.y value: 1 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_AnchorMin.x value: 1 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_AnchorMin.y value: 1 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_SizeDelta.x value: 400 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_SizeDelta.y value: 250 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_LocalPosition.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_LocalPosition.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_LocalPosition.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_LocalRotation.w value: 1 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_LocalRotation.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_LocalRotation.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_LocalRotation.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_AnchoredPosition.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_AnchoredPosition.y value: -250 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_LocalEulerAnglesHint.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_LocalEulerAnglesHint.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4039968741557396746, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 4039968741557396746, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_Text value: This sample shows how different properties of the Lit shader affect the surface. Use the materials and textures as guidelines on how to set up @@ -2398,8 +2191,7 @@ PrefabInstance: m_SourcePrefab: {fileID: 100100000, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} --- !u!224 &2050154443 stripped RectTransform: - m_CorrespondingSourceObject: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + m_CorrespondingSourceObject: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} m_PrefabInstance: {fileID: 2050154442} m_PrefabAsset: {fileID: 0} --- !u!1 &221137969116224548 @@ -2450,200 +2242,159 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 0} m_Modifications: - - target: {fileID: 605078736972206957, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 605078736972206957, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 965276579647584521, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 965276579647584521, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: MappedSphere objectReference: {fileID: 0} - - target: {fileID: 1613878145432836316, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 1613878145432836316, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 81a7b3fb99e984cb0a7a85e94d32a98e, type: 2} - - target: {fileID: 1810530080357623737, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 1810530080357623737, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: RedText objectReference: {fileID: 0} - - target: {fileID: 1814010385164494244, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 1814010385164494244, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 1814010385164494244, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 1814010385164494244, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Text value: 'White base color' objectReference: {fileID: 0} - - target: {fileID: 1814010385164494244, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 1814010385164494244, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_CharacterSize value: 0.04 objectReference: {fileID: 0} - - target: {fileID: 3023133885351793476, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 3023133885351793476, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: MappedQuad objectReference: {fileID: 0} - - target: {fileID: 3273462983484937657, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 3273462983484937657, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 3552189744290811969, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 3552189744290811969, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 3552189744290811969, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 3552189744290811969, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Text value: Base Map objectReference: {fileID: 0} - - target: {fileID: 3552189744290811969, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 3552189744290811969, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_CharacterSize value: 0.04 objectReference: {fileID: 0} - - target: {fileID: 3685639466378869937, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 3685639466378869937, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 81a7b3fb99e984cb0a7a85e94d32a98e, type: 2} - - target: {fileID: 5474351984923567369, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 5474351984923567369, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 7287552079565133267, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 7287552079565133267, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: RedSphere objectReference: {fileID: 0} - - target: {fileID: 7976546426794385558, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 7976546426794385558, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: WhiteText objectReference: {fileID: 0} - - target: {fileID: 8097283291250739307, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283291250739307, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: WhiteQuad objectReference: {fileID: 0} - - target: {fileID: 8097283291266426208, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283291266426208, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: RedQuad objectReference: {fileID: 0} - - target: {fileID: 8097283291266426222, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283291266426222, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: ab1e501408f784696a373918622592b2, type: 2} - - target: {fileID: 8097283293074703921, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703921, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: BaseMap objectReference: {fileID: 0} - - target: {fileID: 8097283293074703921, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703921, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_RootOrder value: 5 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalPosition.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalPosition.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalPosition.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalRotation.w value: 1 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalRotation.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalRotation.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalRotation.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalEulerAnglesHint.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalEulerAnglesHint.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 8290614998434304938, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8290614998434304938, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: MappedText objectReference: {fileID: 0} - - target: {fileID: 8968186135458761160, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8968186135458761160, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 8968186135458761160, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 8968186135458761160, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Text value: 'Red base color' objectReference: {fileID: 0} - - target: {fileID: 8968186135458761160, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8968186135458761160, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_CharacterSize value: 0.04 objectReference: {fileID: 0} - - target: {fileID: 8979682401931062433, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8979682401931062433, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: WhiteSphere objectReference: {fileID: 0} - - target: {fileID: 9088944033397224454, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 9088944033397224454, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: ab1e501408f784696a373918622592b2, type: 2} @@ -2670,6 +2421,7 @@ Canvas: m_OverridePixelPerfect: 0 m_SortingBucketNormalizedSize: 0 m_VertexColorAlwaysGammaSpace: 0 + m_UseReflectionProbes: 0 m_AdditionalShaderChannelsFlag: 0 m_UpdateRectTransformForStandalone: 0 m_SortingLayerID: 0 @@ -2720,7 +2472,6 @@ SceneRoots: m_ObjectHideFlags: 0 m_Roots: - {fileID: 1925206219} - - {fileID: 1720569097} - {fileID: 222607664510397816} - {fileID: 909040152} - {fileID: 586851967382586498} diff --git a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/PlayerControls.inputactions b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/PlayerControls.inputactions new file mode 100644 index 00000000000..ce0b23b0dcb --- /dev/null +++ b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/PlayerControls.inputactions @@ -0,0 +1,839 @@ +{ + "version": 1, + "name": "PlayerControls", + "maps": [ + { + "name": "Player", + "id": "2cf6ceb3-86d0-4b8b-9eff-79d527e59fb0", + "actions": [ + { + "name": "Move", + "type": "Value", + "id": "68156268-5c1f-4acc-955e-d121992f8ad5", + "expectedControlType": "Vector2", + "processors": "", + "interactions": "", + "initialStateCheck": true + }, + { + "name": "Look", + "type": "Value", + "id": "e2f24dfb-116f-4941-8f88-cf0a20903c6a", + "expectedControlType": "Vector2", + "processors": "", + "interactions": "", + "initialStateCheck": true + }, + { + "name": "Fire", + "type": "Button", + "id": "75aea007-8293-456a-9d47-5442fc0f5e68", + "expectedControlType": "", + "processors": "", + "interactions": "", + "initialStateCheck": false + } + ], + "bindings": [ + { + "name": "", + "id": "978bfe49-cc26-4a3d-ab7b-7d7a29327403", + "path": "/leftStick", + "interactions": "", + "processors": "", + "groups": ";Gamepad", + "action": "Move", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "WASD", + "id": "00ca640b-d935-4593-8157-c05846ea39b3", + "path": "Dpad", + "interactions": "", + "processors": "", + "groups": "", + "action": "Move", + "isComposite": true, + "isPartOfComposite": false + }, + { + "name": "up", + "id": "e2062cb9-1b15-46a2-838c-2f8d72a0bdd9", + "path": "/w", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse", + "action": "Move", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "up", + "id": "8180e8bd-4097-4f4e-ab88-4523101a6ce9", + "path": "/upArrow", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse", + "action": "Move", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "down", + "id": "320bffee-a40b-4347-ac70-c210eb8bc73a", + "path": "/s", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse", + "action": "Move", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "down", + "id": "1c5327b5-f71c-4f60-99c7-4e737386f1d1", + "path": "/downArrow", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse", + "action": "Move", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "left", + "id": "d2581a9b-1d11-4566-b27d-b92aff5fabbc", + "path": "/a", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse", + "action": "Move", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "left", + "id": "2e46982e-44cc-431b-9f0b-c11910bf467a", + "path": "/leftArrow", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse", + "action": "Move", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "right", + "id": "fcfe95b8-67b9-4526-84b5-5d0bc98d6400", + "path": "/d", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse", + "action": "Move", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "right", + "id": "77bff152-3580-4b21-b6de-dcd0c7e41164", + "path": "/rightArrow", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse", + "action": "Move", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "", + "id": "1635d3fe-58b6-4ba9-a4e2-f4b964f6b5c8", + "path": "/{Primary2DAxis}", + "interactions": "", + "processors": "", + "groups": "XR", + "action": "Move", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "3ea4d645-4504-4529-b061-ab81934c3752", + "path": "/stick", + "interactions": "", + "processors": "", + "groups": "Joystick", + "action": "Move", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "c1f7a91b-d0fd-4a62-997e-7fb9b69bf235", + "path": "/rightStick", + "interactions": "", + "processors": "", + "groups": ";Gamepad", + "action": "Look", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "8c8e490b-c610-4785-884f-f04217b23ca4", + "path": "/delta", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse;Touch", + "action": "Look", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "3e5f5442-8668-4b27-a940-df99bad7e831", + "path": "/{Hatswitch}", + "interactions": "", + "processors": "", + "groups": "Joystick", + "action": "Look", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "143bb1cd-cc10-4eca-a2f0-a3664166fe91", + "path": "/rightTrigger", + "interactions": "", + "processors": "", + "groups": ";Gamepad", + "action": "Fire", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "05f6913d-c316-48b2-a6bb-e225f14c7960", + "path": "/leftButton", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse", + "action": "Fire", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "886e731e-7071-4ae4-95c0-e61739dad6fd", + "path": "/primaryTouch/tap", + "interactions": "", + "processors": "", + "groups": ";Touch", + "action": "Fire", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "ee3d0cd2-254e-47a7-a8cb-bc94d9658c54", + "path": "/trigger", + "interactions": "", + "processors": "", + "groups": "Joystick", + "action": "Fire", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "8255d333-5683-4943-a58a-ccb207ff1dce", + "path": "/{PrimaryAction}", + "interactions": "", + "processors": "", + "groups": "XR", + "action": "Fire", + "isComposite": false, + "isPartOfComposite": false + } + ] + }, + { + "name": "UI", + "id": "53dbdbef-4101-4aa8-b9ee-fffbbf22db70", + "actions": [ + { + "name": "Navigate", + "type": "PassThrough", + "id": "11b2185d-2fb4-4c89-aafd-748da443e2dc", + "expectedControlType": "Vector2", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "Submit", + "type": "Button", + "id": "d587f992-6a9d-4333-a252-7293b674fd36", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "Cancel", + "type": "Button", + "id": "86ee9931-c691-4e12-a075-6a5bc7be2520", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "Point", + "type": "PassThrough", + "id": "e49d4a8d-a0ca-4893-bc77-263954f4eb13", + "expectedControlType": "Vector2", + "processors": "", + "interactions": "", + "initialStateCheck": true + }, + { + "name": "Click", + "type": "PassThrough", + "id": "05a94944-eece-456c-a514-3c74d0b37a64", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": true + }, + { + "name": "ScrollWheel", + "type": "PassThrough", + "id": "8334b98a-d9f5-4295-8292-7d83bbc450ea", + "expectedControlType": "Vector2", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "MiddleClick", + "type": "PassThrough", + "id": "0862ed31-cb59-4cb8-b655-58f1fcc629e2", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "RightClick", + "type": "PassThrough", + "id": "6f006a1f-a75d-47a8-a238-82d8b73cb7bc", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "TrackedDevicePosition", + "type": "PassThrough", + "id": "09be00e8-57eb-45df-a37e-77e4e01d7239", + "expectedControlType": "Vector3", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "TrackedDeviceOrientation", + "type": "PassThrough", + "id": "ac15ba30-53c8-49bc-a859-98024bf21458", + "expectedControlType": "Quaternion", + "processors": "", + "interactions": "", + "initialStateCheck": false + } + ], + "bindings": [ + { + "name": "Gamepad", + "id": "809f371f-c5e2-4e7a-83a1-d867598f40dd", + "path": "2DVector", + "interactions": "", + "processors": "", + "groups": "", + "action": "Navigate", + "isComposite": true, + "isPartOfComposite": false + }, + { + "name": "up", + "id": "14a5d6e8-4aaf-4119-a9ef-34b8c2c548bf", + "path": "/leftStick/up", + "interactions": "", + "processors": "", + "groups": ";Gamepad", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "up", + "id": "9144cbe6-05e1-4687-a6d7-24f99d23dd81", + "path": "/rightStick/up", + "interactions": "", + "processors": "", + "groups": ";Gamepad", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "down", + "id": "2db08d65-c5fb-421b-983f-c71163608d67", + "path": "/leftStick/down", + "interactions": "", + "processors": "", + "groups": ";Gamepad", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "down", + "id": "58748904-2ea9-4a80-8579-b500e6a76df8", + "path": "/rightStick/down", + "interactions": "", + "processors": "", + "groups": ";Gamepad", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "left", + "id": "8ba04515-75aa-45de-966d-393d9bbd1c14", + "path": "/leftStick/left", + "interactions": "", + "processors": "", + "groups": ";Gamepad", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "left", + "id": "712e721c-bdfb-4b23-a86c-a0d9fcfea921", + "path": "/rightStick/left", + "interactions": "", + "processors": "", + "groups": ";Gamepad", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "right", + "id": "fcd248ae-a788-4676-a12e-f4d81205600b", + "path": "/leftStick/right", + "interactions": "", + "processors": "", + "groups": ";Gamepad", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "right", + "id": "1f04d9bc-c50b-41a1-bfcc-afb75475ec20", + "path": "/rightStick/right", + "interactions": "", + "processors": "", + "groups": ";Gamepad", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "", + "id": "fb8277d4-c5cd-4663-9dc7-ee3f0b506d90", + "path": "/dpad", + "interactions": "", + "processors": "", + "groups": ";Gamepad", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "Joystick", + "id": "e25d9774-381c-4a61-b47c-7b6b299ad9f9", + "path": "2DVector", + "interactions": "", + "processors": "", + "groups": "", + "action": "Navigate", + "isComposite": true, + "isPartOfComposite": false + }, + { + "name": "up", + "id": "3db53b26-6601-41be-9887-63ac74e79d19", + "path": "/stick/up", + "interactions": "", + "processors": "", + "groups": "Joystick", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "down", + "id": "0cb3e13e-3d90-4178-8ae6-d9c5501d653f", + "path": "/stick/down", + "interactions": "", + "processors": "", + "groups": "Joystick", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "left", + "id": "0392d399-f6dd-4c82-8062-c1e9c0d34835", + "path": "/stick/left", + "interactions": "", + "processors": "", + "groups": "Joystick", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "right", + "id": "942a66d9-d42f-43d6-8d70-ecb4ba5363bc", + "path": "/stick/right", + "interactions": "", + "processors": "", + "groups": "Joystick", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "Keyboard", + "id": "ff527021-f211-4c02-933e-5976594c46ed", + "path": "2DVector", + "interactions": "", + "processors": "", + "groups": "", + "action": "Navigate", + "isComposite": true, + "isPartOfComposite": false + }, + { + "name": "up", + "id": "563fbfdd-0f09-408d-aa75-8642c4f08ef0", + "path": "/w", + "interactions": "", + "processors": "", + "groups": "Keyboard&Mouse", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "up", + "id": "eb480147-c587-4a33-85ed-eb0ab9942c43", + "path": "/upArrow", + "interactions": "", + "processors": "", + "groups": "Keyboard&Mouse", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "down", + "id": "2bf42165-60bc-42ca-8072-8c13ab40239b", + "path": "/s", + "interactions": "", + "processors": "", + "groups": "Keyboard&Mouse", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "down", + "id": "85d264ad-e0a0-4565-b7ff-1a37edde51ac", + "path": "/downArrow", + "interactions": "", + "processors": "", + "groups": "Keyboard&Mouse", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "left", + "id": "74214943-c580-44e4-98eb-ad7eebe17902", + "path": "/a", + "interactions": "", + "processors": "", + "groups": "Keyboard&Mouse", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "left", + "id": "cea9b045-a000-445b-95b8-0c171af70a3b", + "path": "/leftArrow", + "interactions": "", + "processors": "", + "groups": "Keyboard&Mouse", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "right", + "id": "8607c725-d935-4808-84b1-8354e29bab63", + "path": "/d", + "interactions": "", + "processors": "", + "groups": "Keyboard&Mouse", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "right", + "id": "4cda81dc-9edd-4e03-9d7c-a71a14345d0b", + "path": "/rightArrow", + "interactions": "", + "processors": "", + "groups": "Keyboard&Mouse", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "", + "id": "9e92bb26-7e3b-4ec4-b06b-3c8f8e498ddc", + "path": "*/{Submit}", + "interactions": "", + "processors": "", + "groups": "Keyboard&Mouse;Gamepad;Touch;Joystick;XR", + "action": "Submit", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "82627dcc-3b13-4ba9-841d-e4b746d6553e", + "path": "*/{Cancel}", + "interactions": "", + "processors": "", + "groups": "Keyboard&Mouse;Gamepad;Touch;Joystick;XR", + "action": "Cancel", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "c52c8e0b-8179-41d3-b8a1-d149033bbe86", + "path": "/position", + "interactions": "", + "processors": "", + "groups": "Keyboard&Mouse", + "action": "Point", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "e1394cbc-336e-44ce-9ea8-6007ed6193f7", + "path": "/position", + "interactions": "", + "processors": "", + "groups": "Keyboard&Mouse", + "action": "Point", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "5693e57a-238a-46ed-b5ae-e64e6e574302", + "path": "/touch*/position", + "interactions": "", + "processors": "", + "groups": "Touch", + "action": "Point", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "4faf7dc9-b979-4210-aa8c-e808e1ef89f5", + "path": "/leftButton", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse", + "action": "Click", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "8d66d5ba-88d7-48e6-b1cd-198bbfef7ace", + "path": "/tip", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse", + "action": "Click", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "47c2a644-3ebc-4dae-a106-589b7ca75b59", + "path": "/touch*/press", + "interactions": "", + "processors": "", + "groups": "Touch", + "action": "Click", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "bb9e6b34-44bf-4381-ac63-5aa15d19f677", + "path": "/trigger", + "interactions": "", + "processors": "", + "groups": "XR", + "action": "Click", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "38c99815-14ea-4617-8627-164d27641299", + "path": "/scroll", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse", + "action": "ScrollWheel", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "24066f69-da47-44f3-a07e-0015fb02eb2e", + "path": "/middleButton", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse", + "action": "MiddleClick", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "4c191405-5738-4d4b-a523-c6a301dbf754", + "path": "/rightButton", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse", + "action": "RightClick", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "7236c0d9-6ca3-47cf-a6ee-a97f5b59ea77", + "path": "/devicePosition", + "interactions": "", + "processors": "", + "groups": "XR", + "action": "TrackedDevicePosition", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "23e01e3a-f935-4948-8d8b-9bcac77714fb", + "path": "/deviceRotation", + "interactions": "", + "processors": "", + "groups": "XR", + "action": "TrackedDeviceOrientation", + "isComposite": false, + "isPartOfComposite": false + } + ] + } + ], + "controlSchemes": [ + { + "name": "Keyboard&Mouse", + "bindingGroup": "Keyboard&Mouse", + "devices": [ + { + "devicePath": "", + "isOptional": false, + "isOR": false + }, + { + "devicePath": "", + "isOptional": false, + "isOR": false + } + ] + }, + { + "name": "Gamepad", + "bindingGroup": "Gamepad", + "devices": [ + { + "devicePath": "", + "isOptional": false, + "isOR": false + } + ] + }, + { + "name": "Touch", + "bindingGroup": "Touch", + "devices": [ + { + "devicePath": "", + "isOptional": false, + "isOR": false + } + ] + }, + { + "name": "Joystick", + "bindingGroup": "Joystick", + "devices": [ + { + "devicePath": "", + "isOptional": false, + "isOR": false + } + ] + }, + { + "name": "XR", + "bindingGroup": "XR", + "devices": [ + { + "devicePath": "", + "isOptional": false, + "isOR": false + } + ] + } + ] +} \ No newline at end of file diff --git a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/PlayerControls.inputactions.meta b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/PlayerControls.inputactions.meta new file mode 100644 index 00000000000..fd5f5da027f --- /dev/null +++ b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/PlayerControls.inputactions.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: f426eb113dac7124d897c338662b4024 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3} + generateWrapperCode: 0 + wrapperCodePath: + wrapperClassName: + wrapperCodeNamespace: diff --git a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Prefabs/FirstPersonPlayer.prefab b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Prefabs/FirstPersonPlayer.prefab index 7410520bcd9..21aa96c56ec 100644 --- a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Prefabs/FirstPersonPlayer.prefab +++ b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Prefabs/FirstPersonPlayer.prefab @@ -11,6 +11,7 @@ GameObject: - component: {fileID: 4212382672143566193} - component: {fileID: 4891938747972648122} - component: {fileID: 8509898242313118626} + - component: {fileID: 8535537789861062929} m_Layer: 0 m_Name: FirstPersonPlayer m_TagString: Untagged @@ -25,6 +26,7 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2148271877166492642} + serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0.812, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} @@ -32,7 +34,6 @@ Transform: m_Children: - {fileID: 3363522893988168260} m_Father: {fileID: 0} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!143 &4891938747972648122 CharacterController: @@ -42,9 +43,16 @@ CharacterController: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2148271877166492642} m_Material: {fileID: 0} - m_IsTrigger: 0 + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_ProvidesContacts: 0 m_Enabled: 1 - serializedVersion: 2 + serializedVersion: 3 m_Height: 1.5 m_Radius: 0.4 m_SlopeLimit: 45 @@ -61,15 +69,43 @@ MonoBehaviour: m_GameObject: {fileID: 2148271877166492642} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 94f9f55b5897449c29f5189f47cad4bc, type: 3} + m_Script: {fileID: 11500000, guid: 1b63a52c6229a7d48944998a4fcad092, type: 3} m_Name: m_EditorClassIdentifier: - m_MouseSensitivity: 100 - m_ButtonSensitivity: 100 - m_MovementSpeed: 3 - m_PlayerCamera: {fileID: 3363522893988168260} - m_MoveWithMouse: 1 - m_ButtonMovementFlags: 0 + moveSpeed: 5 + gravity: -9.81 + lookSensitivity: 0.5 + baseCamera: {fileID: 1104701761066559480} +--- !u!114 &8535537789861062929 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2148271877166492642} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 62899f850307741f2a39c98a8b639597, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.InputSystem::UnityEngine.InputSystem.PlayerInput + m_Actions: {fileID: -944628639613478452, guid: 052faaac586de48259a63d0c4782560b, type: 3} + m_NotificationBehavior: 0 + m_UIInputModule: {fileID: 0} + m_DeviceLostEvent: + m_PersistentCalls: + m_Calls: [] + m_DeviceRegainedEvent: + m_PersistentCalls: + m_Calls: [] + m_ControlsChangedEvent: + m_PersistentCalls: + m_Calls: [] + m_ActionEvents: [] + m_NeverAutoSwitchControlSchemes: 0 + m_DefaultControlScheme: + m_DefaultActionMap: + m_SplitScreenIndex: -1 + m_Camera: {fileID: 1104701761066559480} --- !u!1 &8157311212398424292 GameObject: m_ObjectHideFlags: 0 @@ -82,7 +118,6 @@ GameObject: - component: {fileID: 1104701761066559480} - component: {fileID: 5828494068272712963} - component: {fileID: 6350239021526260069} - - component: {fileID: 8900132868616544278} m_Layer: 0 m_Name: Camera m_TagString: MainCamera @@ -97,13 +132,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 8157311212398424292} + serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0.6, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 4212382672143566193} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!20 &1104701761066559480 Camera: @@ -119,9 +154,17 @@ Camera: m_projectionMatrixMode: 1 m_GateFitMode: 2 m_FOVAxisMode: 0 + m_Iso: 200 + m_ShutterSpeed: 0.005 + m_Aperture: 16 + m_FocusDistance: 10 + m_FocalLength: 50 + m_BladeCount: 5 + m_Curvature: {x: 2, y: 11} + m_BarrelClipping: 0.25 + m_Anamorphism: 0 m_SensorSize: {x: 36, y: 24} m_LensShift: {x: 0, y: 0} - m_FocalLength: 50 m_NormalizedViewPortRect: serializedVersion: 2 x: 0 @@ -186,19 +229,17 @@ MonoBehaviour: m_Dithering: 0 m_ClearDepth: 1 m_AllowXRRendering: 1 + m_AllowHDROutput: 1 + m_UseScreenCoordOverride: 0 + m_ScreenSizeOverride: {x: 0, y: 0, z: 0, w: 0} + m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0} m_RequiresDepthTexture: 0 m_RequiresColorTexture: 0 + m_TaaSettings: + m_Quality: 3 + m_FrameInfluence: 0.1 + m_JitterScale: 1 + m_MipBias: 0 + m_VarianceClampScale: 0.9 + m_ContrastAdaptiveSharpening: 0 m_Version: 2 ---- !u!114 &8900132868616544278 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8157311212398424292} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 21aa50131bc134f04a14efdbeb7686be, type: 3} - m_Name: - m_EditorClassIdentifier: - m_PipelineAsset: {fileID: 11400000, guid: 9b9c0b62deeea4218843a7ad59325649, type: 2} diff --git a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/CameraManagement.cs b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/CameraManagement.cs new file mode 100644 index 00000000000..8a978bac483 --- /dev/null +++ b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/CameraManagement.cs @@ -0,0 +1,87 @@ +using UnityEngine; +using UnityEngine.InputSystem; +using UnityEngine.Rendering.Universal; + +[RequireComponent(typeof(PlayerInput))] +public class CameraManagement : MonoBehaviour +{ + + [Header("Cameras")] + public Camera baseCamera; + public Camera overlayCamera; + + private PlayerInput playerInput; + private InputAction fireAction; + + private float baseFOV; + private float overlayFOV; + private bool isOverlayActive = false; + + private void Awake() + { + playerInput = GetComponent(); + + // Check if the cameras are corectly assigned + if (baseCamera == null || overlayCamera == null) + { + Debug.LogError("BaseCamera and OverlayCamera have to be assigned in the PlayerInput!"); + enabled = false; + return; + } + + // Get FOV + baseFOV = baseCamera.fieldOfView; + overlayFOV = overlayCamera.fieldOfView; + + // Prepare URP stack + var baseData = baseCamera.GetUniversalAdditionalCameraData(); + var overlayData = overlayCamera.GetUniversalAdditionalCameraData(); + overlayData.renderType = CameraRenderType.Overlay; + + if (!baseData.cameraStack.Contains(overlayCamera)) + baseData.cameraStack.Add(overlayCamera); + + // Overlay off at start + overlayCamera.gameObject.SetActive(false); + } + + private void OnEnable() + { + fireAction = playerInput.actions["Fire"]; + fireAction.performed += OnFirePerformed; + fireAction.canceled += OnFireCanceled; + } + + private void OnDisable() + { + if (fireAction != null) + { + fireAction.performed -= OnFirePerformed; + fireAction.canceled -= OnFireCanceled; + } + } + + private void OnFirePerformed(InputAction.CallbackContext ctx) + { + isOverlayActive = true; + overlayCamera.gameObject.SetActive(true); + baseCamera.fieldOfView = overlayFOV; + } + + private void OnFireCanceled(InputAction.CallbackContext ctx) + { + isOverlayActive = false; + overlayCamera.gameObject.SetActive(false); + baseCamera.fieldOfView = baseFOV; + } + + private void LateUpdate() + { + // Synchronise base and overlay camera rotation to avoid a jerky effect + if (isOverlayActive && overlayCamera != null && baseCamera != null) + { + overlayCamera.transform.rotation = baseCamera.transform.rotation; + } + } +} + diff --git a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/CameraManagement.cs.meta b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/CameraManagement.cs.meta new file mode 100644 index 00000000000..d1f069ceab1 --- /dev/null +++ b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/CameraManagement.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: e2ca254cf5a4eb443bba3eb4c9b3035b \ No newline at end of file diff --git a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/FirstPersonController.cs b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/FirstPersonController.cs index 6bcc30a6e56..9c5923eb9e0 100644 --- a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/FirstPersonController.cs +++ b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/FirstPersonController.cs @@ -1,84 +1,96 @@ using UnityEngine; -using Cursor = UnityEngine.Cursor; +using UnityEngine.InputSystem; [RequireComponent(typeof(CharacterController))] +[RequireComponent(typeof(PlayerInput))] public class FirstPersonController : MonoBehaviour { - [SerializeField] - private float m_MouseSensitivity = 100f; - [SerializeField] - private float m_MovementSpeed = 5f; - [SerializeField] - private Transform m_PlayerCamera = null; - [SerializeField] - private bool m_MoveWithMouse = true; - - private CharacterController m_CharacterController; - private float m_XRotation = 0f; - [SerializeField] - private byte m_ButtonMovementFlags; - - void Start() - { -#if ENABLE_INPUT_SYSTEM - Debug.Log("The FirstPersonController uses the legacy input system. Please set it in Project Settings"); - m_MoveWithMouse = false; -#endif - if (m_MoveWithMouse) - { - Cursor.lockState = CursorLockMode.Locked; - } - m_CharacterController = GetComponent(); - } + [Header("Movement Settings")] + public float moveSpeed = 5f; + public float gravity = -9.81f; - void Update() - { - Look(); - Move(); - } + [Header("Look Settings")] + public float lookSensitivity = 0.5f; - private void Look() - { - Vector2 lookInput = GetLookInput(); + [Header("Camera Reference")] + public Camera baseCamera; + + private CharacterController controller; + private PlayerInput playerInput; + private InputAction moveAction; + private InputAction lookAction; + + private Vector2 moveInput; + private Vector2 lookInput; + private float verticalVelocity; + private float cameraPitch; - m_XRotation -= lookInput.y; - m_XRotation = Mathf.Clamp(m_XRotation, -90f, 90f); + private void Awake() + { + controller = GetComponent(); + playerInput = GetComponent(); - m_PlayerCamera.localRotation = Quaternion.Euler(m_XRotation, 0, 0); - transform.Rotate(Vector3.up * lookInput.x, Space.World); + // Hide cursor + Cursor.lockState = CursorLockMode.Locked; + Cursor.visible = false; } - private void Move() + private void OnEnable() { - Vector3 movementInput = GetMovementInput(); + var actions = playerInput.actions; - Vector3 move = transform.right * movementInput.x + transform.forward * movementInput.z; + moveAction = actions["Move"]; + lookAction = actions["Look"]; + + moveAction.performed += ctx => moveInput = ctx.ReadValue(); + moveAction.canceled += ctx => moveInput = Vector2.zero; - m_CharacterController.Move(move * m_MovementSpeed * Time.deltaTime); + lookAction.performed += ctx => lookInput = ctx.ReadValue(); + lookAction.canceled += ctx => lookInput = Vector2.zero; + + actions.Enable(); } - private Vector2 GetLookInput() + private void OnDisable() { - float mouseX = 0; - float mouseY = 0; - if (m_MoveWithMouse) + if (moveAction != null) + { + moveAction.performed -= ctx => moveInput = ctx.ReadValue(); + moveAction.canceled -= ctx => moveInput = Vector2.zero; + } + if (lookAction != null) { - mouseX = Input.GetAxis("Mouse X") * m_MouseSensitivity * Time.deltaTime; - mouseY = Input.GetAxis("Mouse Y") * m_MouseSensitivity * Time.deltaTime; + lookAction.performed -= ctx => lookInput = ctx.ReadValue(); + lookAction.canceled -= ctx => lookInput = Vector2.zero; } - return new Vector2(mouseX, mouseY); } - private Vector3 GetMovementInput() + private void Update() { - float x = 0; - float z = 0; - if (m_MoveWithMouse) - { - x = Input.GetAxis("Horizontal"); - z = Input.GetAxis("Vertical"); - } + HandleMovement(); + HandleLook(); + } + + private void HandleMovement() + { + Vector3 move = transform.right * moveInput.x + transform.forward * moveInput.y; + + if (controller.isGrounded && verticalVelocity < 0) + verticalVelocity = -2f; + + verticalVelocity += gravity * Time.deltaTime; + move.y = verticalVelocity; + + controller.Move(move * moveSpeed * Time.deltaTime); + } + + private void HandleLook() + { + transform.Rotate(Vector3.up * lookInput.x * lookSensitivity); + + cameraPitch -= lookInput.y * lookSensitivity; + cameraPitch = Mathf.Clamp(cameraPitch, -80f, 80f); - return new Vector3(x, 0, z); + baseCamera.transform.localEulerAngles = Vector3.right * cameraPitch; } -} +} \ No newline at end of file diff --git a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/FirstPersonController.cs.meta b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/FirstPersonController.cs.meta index 05b26da7810..9dc6e420166 100644 --- a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/FirstPersonController.cs.meta +++ b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/FirstPersonController.cs.meta @@ -1,11 +1,2 @@ fileFormatVersion: 2 -guid: 94f9f55b5897449c29f5189f47cad4bc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +guid: 1b63a52c6229a7d48944998a4fcad092 \ No newline at end of file diff --git a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/SampleAssembly.asmdef b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/SampleAssembly.asmdef new file mode 100644 index 00000000000..8cb1bf88891 --- /dev/null +++ b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/SampleAssembly.asmdef @@ -0,0 +1,21 @@ +{ + "name": "SampleAssembly", + "rootNamespace": "", + "references": [ + "Unity.InputSystem", + "Unity.RenderPipelines.Core.Runtime", + "Unity.RenderPipelines.Universal.Editor", + "Unity.RenderPipelines.Universal.Runtime" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [ + "ENABLE_INPUT_SYSTEM" + ], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/SampleAssembly.asmdef.meta b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/SampleAssembly.asmdef.meta new file mode 100644 index 00000000000..083d6f1e079 --- /dev/null +++ b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/SampleAssembly.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: d770956cfc6450d45bf1908075cac342 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.render-pipelines.universal/Samples~/URPRenderGraphSamples/FramebufferFetch/FrameBufferFetchRenderFeature.cs b/Packages/com.unity.render-pipelines.universal/Samples~/URPRenderGraphSamples/FramebufferFetch/FrameBufferFetchRenderFeature.cs index f6e025241c9..ef16c0df19b 100644 --- a/Packages/com.unity.render-pipelines.universal/Samples~/URPRenderGraphSamples/FramebufferFetch/FrameBufferFetchRenderFeature.cs +++ b/Packages/com.unity.render-pipelines.universal/Samples~/URPRenderGraphSamples/FramebufferFetch/FrameBufferFetchRenderFeature.cs @@ -41,7 +41,7 @@ static void ExecuteFBFetchPass(PassData data, RasterGraphContext context) context.cmd.DrawProcedural(Matrix4x4.identity, data.material, data.useMSAA? 1 : 0, MeshTopology.Triangles, 3, 1, null); } - private void FBFetchPass(RenderGraph renderGraph, ContextContainer frameData, TextureHandle source, TextureHandle destination, bool useMSAA) + private void FBFetchPass(RenderGraph renderGraph, ContextContainer frameData, in TextureHandle source, in TextureHandle destination, bool useMSAA) { string passName = "FrameBufferFetchPass"; diff --git a/Packages/com.unity.render-pipelines.universal/Samples~/URPRenderGraphSamples/GlobalGbuffers/GlobalGbuffersRendererFeature.cs b/Packages/com.unity.render-pipelines.universal/Samples~/URPRenderGraphSamples/GlobalGbuffers/GlobalGbuffersRendererFeature.cs index 16adb100ff9..4a19f76706a 100644 --- a/Packages/com.unity.render-pipelines.universal/Samples~/URPRenderGraphSamples/GlobalGbuffers/GlobalGbuffersRendererFeature.cs +++ b/Packages/com.unity.render-pipelines.universal/Samples~/URPRenderGraphSamples/GlobalGbuffers/GlobalGbuffersRendererFeature.cs @@ -57,7 +57,7 @@ private class PassData // will be made accessible using 'builder.UseAllGlobalTextures(true)' instead of 'builder.UseTexture(gBuffer[i]) // Shaders that use global textures will be able to fetch them without the need to call 'material.SetTexture()' // like we do in the ExecutePass function of this pass. - private void SetGlobalGBufferTextures(IRasterRenderGraphBuilder builder, TextureHandle[] gBuffer) + private void SetGlobalGBufferTextures(IRasterRenderGraphBuilder builder, in TextureHandle[] gBuffer) { // This loop will make the gBuffers accessible by all shaders using _GBufferX texture shader IDs. for (int i = 0; i < gBuffer.Length; i++) diff --git a/Packages/com.unity.render-pipelines.universal/ShaderLibrary/GlobalIllumination.hlsl b/Packages/com.unity.render-pipelines.universal/ShaderLibrary/GlobalIllumination.hlsl index 56438e7ba05..ff2beaf897f 100644 --- a/Packages/com.unity.render-pipelines.universal/ShaderLibrary/GlobalIllumination.hlsl +++ b/Packages/com.unity.render-pipelines.universal/ShaderLibrary/GlobalIllumination.hlsl @@ -31,12 +31,12 @@ half3 SampleScreenSpaceGI(float2 pos) #define _MIXED_LIGHTING_SUBTRACTIVE #endif -#if !defined(_REFLECTION_PROBE_BLENDING_KEYWORD_DECLARED) -#define _REFLECTION_PROBE_BLENDING 0 +#if !defined(_REFLECTION_PROBE_BLENDING_KEYWORD_DECLARED) && !defined(_REFLECTION_PROBE_BLENDING) + #define _REFLECTION_PROBE_BLENDING 0 #endif -#if !defined(_REFLECTION_PROBE_BOX_PROJECTION_KEYWORD_DECLARED) -#define _REFLECTION_PROBE_BOX_PROJECTION 0 +#if !defined(_REFLECTION_PROBE_BOX_PROJECTION_KEYWORD_DECLARED) && !defined(_REFLECTION_PROBE_BOX_PROJECTION) + #define _REFLECTION_PROBE_BOX_PROJECTION 0 #endif // SH Vertex Evaluation. Depending on target SH sampling might be diff --git a/Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityInput.hlsl b/Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityInput.hlsl index 65f6c17365e..4c17acbe804 100644 --- a/Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityInput.hlsl +++ b/Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityInput.hlsl @@ -38,7 +38,7 @@ // ---------------------------------------------------------------------------- -// Time (t = time since current level load) values from Unity +// Time values from Unity float4 _Time; // (t/20, t, t*2, t*3) float4 _SinTime; // sin(t/8), sin(t/4), sin(t/2), sin(t) float4 _CosTime; // cos(t/8), cos(t/4), cos(t/2), cos(t) diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/2D/Sprite-Lit-Default.shader b/Packages/com.unity.render-pipelines.universal/Shaders/2D/Sprite-Lit-Default.shader index 0e5ce5d0fbe..26449110ef0 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/2D/Sprite-Lit-Default.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/2D/Sprite-Lit-Default.shader @@ -36,7 +36,8 @@ Shader "Universal Render Pipeline/2D/Sprite-Lit-Default" // GPU Instancing #pragma multi_compile_instancing - #pragma multi_compile _ DEBUG_DISPLAY SKINNED_SPRITE + #pragma multi_compile _ DEBUG_DISPLAY + #pragma multi_compile _ SKINNED_SPRITE struct Attributes { diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/Debug/HDRDebugView.shader b/Packages/com.unity.render-pipelines.universal/Shaders/Debug/HDRDebugView.shader index ae917ec615e..147b8266337 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/Debug/HDRDebugView.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/Debug/HDRDebugView.shader @@ -260,4 +260,6 @@ Shader "Hidden/Universal/HDRDebugView" ENDHLSL } } + + Fallback "Hidden/Core/FallbackError" } diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/Utils/StencilDitherMaskSeed.shader b/Packages/com.unity.render-pipelines.universal/Shaders/Utils/StencilDitherMaskSeed.shader index 1be56837aac..a8ca074faaa 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/Utils/StencilDitherMaskSeed.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/Utils/StencilDitherMaskSeed.shader @@ -33,8 +33,6 @@ Shader "Hidden/Universal Render Pipeline/StencilDitherMaskSeed" } HLSLPROGRAM - #pragma target 4.5 - // ------------------------------------- // Shader Stages #pragma vertex Vert diff --git a/Packages/com.unity.render-pipelines.universal/Tests/Editor/NoLeaksOnEnterLeavePlaymode.cs b/Packages/com.unity.render-pipelines.universal/Tests/Editor/NoLeaksOnEnterLeavePlaymode.cs index e70e76510d5..ff2a3f1a983 100644 --- a/Packages/com.unity.render-pipelines.universal/Tests/Editor/NoLeaksOnEnterLeavePlaymode.cs +++ b/Packages/com.unity.render-pipelines.universal/Tests/Editor/NoLeaksOnEnterLeavePlaymode.cs @@ -114,6 +114,7 @@ public IEnumerator NoResourceLeaks() "Arial Unicode MS - Regular Material", "Helvetica Neue - Regular Material", "Inter - Regular Material", // UUM-28555 + "Inter - Regular Material + Inter - Semi Bold Atlas", // UUM-28555 "Malgun Gothic - Regular Material", "Microsoft Sans Serif - Regular Material", "Microsoft YaHei - Regular Material", @@ -143,6 +144,7 @@ public IEnumerator NoResourceLeaks() "Arial Unicode MS - Regular Atlas", "Helvetica Neue - Regular Atlas", "Inter - Regular Atlas", + "Inter - Regular Material + Inter - Semi Bold Atlas", "Malgun Gothic - Regular Atlas", "Microsoft Sans Serif - Regular Atlas", "Microsoft YaHei - Regular Atlas", diff --git a/Packages/com.unity.render-pipelines.universal/Tests/Editor/RenderTextureDescriptorDimensionsTests.cs b/Packages/com.unity.render-pipelines.universal/Tests/Editor/RenderTextureDescriptorDimensionsTests.cs index dafa8cdbe0b..fc55d571f8e 100644 --- a/Packages/com.unity.render-pipelines.universal/Tests/Editor/RenderTextureDescriptorDimensionsTests.cs +++ b/Packages/com.unity.render-pipelines.universal/Tests/Editor/RenderTextureDescriptorDimensionsTests.cs @@ -57,7 +57,6 @@ public RenderTextureDescriptor CreateRenderTextureDescriptor() HDRColorBufferPrecision requestHDRColorBufferPrecision = HDRColorBufferPrecision._64Bits; int msaaSamples = 1; bool needsAlpha = false; - bool requiresOpaqueTexture = false; return UniversalRenderPipeline.CreateRenderTextureDescriptor( m_Camera, @@ -65,8 +64,7 @@ public RenderTextureDescriptor CreateRenderTextureDescriptor() isHdrEnabled, requestHDRColorBufferPrecision, msaaSamples, - needsAlpha, - requiresOpaqueTexture); + needsAlpha); } public void CheckDimensions(RenderTextureDescriptor desc, RenderScaleTestCase testCase) diff --git a/Packages/com.unity.render-pipelines.universal/Tests/Editor/Tools/Converters/RenderSettingsConverterTests.cs b/Packages/com.unity.render-pipelines.universal/Tests/Editor/Tools/Converters/RenderSettingsConverterTests.cs index 0ad589ff802..6802d535033 100644 --- a/Packages/com.unity.render-pipelines.universal/Tests/Editor/Tools/Converters/RenderSettingsConverterTests.cs +++ b/Packages/com.unity.render-pipelines.universal/Tests/Editor/Tools/Converters/RenderSettingsConverterTests.cs @@ -1,9 +1,9 @@ -using System.Linq; +using System.Collections.Generic; using NUnit.Framework; +using UnityEditor.Rendering.Converter; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; -using ShadowQuality = UnityEngine.ShadowQuality; namespace UnityEditor.Rendering.Universal.Tools { @@ -55,79 +55,67 @@ public void WhenRunningTheConverter_TheCurrent_QualityLevel_IsNowURP_AndHasEvery var renderSettingsConverter = new RenderSettingsConverter(); var expectedEntry = $"[{m_QualityLevel}] {m_QualityLevelName}"; - InitializeConverterContext ctx = new() { items = new() }; - renderSettingsConverter.OnInitialize(ctx, null); - - Assert.AreEqual(m_QualityLevel, QualitySettings.GetQualityLevel(), "Initialization did not rollback quality level"); - - ConverterItemDescriptor? desc = null; - - foreach (var item in ctx.items) + void OnScanFinished(List scanItems) { - if (item.name.Equals(expectedEntry)) - { - desc = item; - break; - } - } + Assert.IsTrue(scanItems.Count > 0, "Initialization did not found the item to convert"); - Assert.IsTrue(desc.HasValue, "Initialization did not found the item to convert"); + Assert.AreEqual(m_QualityLevel, QualitySettings.GetQualityLevel(), "Initialization did not rollback quality level"); + + var status = renderSettingsConverter.Convert(scanItems[m_QualityLevel], out string msg); + Assert.IsTrue(status == Status.Success, msg); - RunItemContext runItemContext = new RunItemContext(new ConverterItemInfo - { - descriptor = desc.Value, - index = 0, - }); + Assert.AreEqual(m_QualityLevel, QualitySettings.GetQualityLevel(), "Run did not rollback quality level"); - renderSettingsConverter.OnRun(ref runItemContext); + // ---------- ASSET REFERENCE CHECK ---------- + var urpAsset = QualitySettings.renderPipeline as UniversalRenderPipelineAsset; + Assert.IsNotNull(urpAsset, "URP asset is not assigned"); + Assert.AreEqual($"Assets/{UniversalProjectSettings.projectSettingsFolderPath}/{m_QualityLevelName}.asset", AssetDatabase.GetAssetPath(urpAsset)); - Assert.AreEqual(m_QualityLevel, QualitySettings.GetQualityLevel(), "Run did not rollback quality level"); + // ---------- RENDERER REFERENCE CHECK ---------- - // ---------- ASSET REFERENCE CHECK ---------- - var urpAsset = QualitySettings.renderPipeline as UniversalRenderPipelineAsset; - Assert.IsNotNull(urpAsset, "URP asset is not assigned"); - Assert.AreEqual($"Assets/{UniversalProjectSettings.projectSettingsFolderPath}/{m_QualityLevelName}.asset", AssetDatabase.GetAssetPath(urpAsset)); + Assert.IsNotNull(urpAsset.m_RendererDataList); + Assert.AreEqual(1, urpAsset.m_RendererDataList.Length); + Assert.AreEqual($"Assets/{UniversalProjectSettings.projectSettingsFolderPath}/Default_Forward_Renderer.asset", AssetDatabase.GetAssetPath(urpAsset.m_RendererDataList[0])); - // ---------- RENDERER REFERENCE CHECK ---------- + // ---------- SETTINGS FORWARDING CHECK ---------- - Assert.IsNotNull(urpAsset.m_RendererDataList); - Assert.AreEqual(1, urpAsset.m_RendererDataList.Length); - Assert.AreEqual($"Assets/{UniversalProjectSettings.projectSettingsFolderPath}/Default_Forward_Renderer.asset", AssetDatabase.GetAssetPath(urpAsset.m_RendererDataList[0])); + var targetGrp = BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget); + var tier = EditorGraphicsSettings.GetTierSettings(targetGrp, GraphicsTier.Tier3); - // ---------- SETTINGS FORWARDING CHECK ---------- + Assert.AreEqual(QualitySettings.softParticles, urpAsset.supportsCameraDepthTexture, "supportsCameraDepthTexture mismatch"); + Assert.AreEqual(tier.hdr, urpAsset.supportsHDR, "supportsHDR mismatch"); + Assert.AreEqual(QualitySettings.antiAliasing == 0 ? 1 : QualitySettings.antiAliasing, urpAsset.msaaSampleCount, "msaaSampleCount mismatch"); - var targetGrp = BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget); - var tier = EditorGraphicsSettings.GetTierSettings(targetGrp, GraphicsTier.Tier3); + var expectedMainLightMode = QualitySettings.pixelLightCount == 0 ? LightRenderingMode.Disabled : LightRenderingMode.PerPixel; + Assert.AreEqual(expectedMainLightMode, urpAsset.mainLightRenderingMode, "mainLightRenderingMode mismatch"); - Assert.AreEqual(QualitySettings.softParticles, urpAsset.supportsCameraDepthTexture, "supportsCameraDepthTexture mismatch"); - Assert.AreEqual(tier.hdr, urpAsset.supportsHDR, "supportsHDR mismatch"); - Assert.AreEqual(QualitySettings.antiAliasing == 0 ? 1 : QualitySettings.antiAliasing, urpAsset.msaaSampleCount, "msaaSampleCount mismatch"); + Assert.AreEqual(QualitySettings.shadows != UnityEngine.ShadowQuality.Disable, urpAsset.supportsMainLightShadows, "supportsMainLightShadows mismatch"); + Assert.AreEqual(RenderSettingsConverter.GetEquivalentMainlightShadowResolution((int)QualitySettings.shadowResolution), urpAsset.mainLightShadowmapResolution, "mainLightShadowmapResolution mismatch"); - var expectedMainLightMode = QualitySettings.pixelLightCount == 0 ? LightRenderingMode.Disabled : LightRenderingMode.PerPixel; - Assert.AreEqual(expectedMainLightMode, urpAsset.mainLightRenderingMode, "mainLightRenderingMode mismatch"); + var expectedAdditionalLightsMode = QualitySettings.pixelLightCount == 0 ? LightRenderingMode.PerVertex : LightRenderingMode.PerPixel; + Assert.AreEqual(expectedAdditionalLightsMode, urpAsset.additionalLightsRenderingMode, "additionalLightsRenderingMode mismatch"); + Assert.AreEqual(QualitySettings.pixelLightCount != 0 ? Mathf.Max(0, QualitySettings.pixelLightCount) : 4, urpAsset.maxAdditionalLightsCount, "maxAdditionalLightsCount mismatch"); + Assert.AreEqual(QualitySettings.shadows != UnityEngine.ShadowQuality.Disable, urpAsset.supportsAdditionalLightShadows, "supportsAdditionalLightShadows mismatch"); + Assert.AreEqual(RenderSettingsConverter.GetEquivalentAdditionalLightAtlasShadowResolution((int)QualitySettings.shadowResolution), urpAsset.additionalLightsShadowmapResolution, "additionalLightsShadowmapResolution mismatch"); - Assert.AreEqual(QualitySettings.shadows != ShadowQuality.Disable, urpAsset.supportsMainLightShadows, "supportsMainLightShadows mismatch"); - Assert.AreEqual(RenderSettingsConverter.GetEquivalentMainlightShadowResolution((int)QualitySettings.shadowResolution), urpAsset.mainLightShadowmapResolution, "mainLightShadowmapResolution mismatch"); + Assert.AreEqual(tier.reflectionProbeBlending, urpAsset.reflectionProbeBlending, "reflectionProbeBlending mismatch"); + Assert.AreEqual(tier.reflectionProbeBoxProjection, urpAsset.reflectionProbeBoxProjection, "reflectionProbeBoxProjection mismatch"); - var expectedAdditionalLightsMode = QualitySettings.pixelLightCount == 0 ? LightRenderingMode.PerVertex : LightRenderingMode.PerPixel; - Assert.AreEqual(expectedAdditionalLightsMode, urpAsset.additionalLightsRenderingMode, "additionalLightsRenderingMode mismatch"); - Assert.AreEqual(QualitySettings.pixelLightCount != 0 ? Mathf.Max(0, QualitySettings.pixelLightCount) : 4, urpAsset.maxAdditionalLightsCount, "maxAdditionalLightsCount mismatch"); - Assert.AreEqual(QualitySettings.shadows != ShadowQuality.Disable, urpAsset.supportsAdditionalLightShadows, "supportsAdditionalLightShadows mismatch"); - Assert.AreEqual(RenderSettingsConverter.GetEquivalentAdditionalLightAtlasShadowResolution((int)QualitySettings.shadowResolution), urpAsset.additionalLightsShadowmapResolution, "additionalLightsShadowmapResolution mismatch"); + Assert.AreEqual(QualitySettings.shadowDistance, urpAsset.shadowDistance, "shadowDistance mismatch"); + var expectedCascadeCount = tier.cascadedShadowMaps ? QualitySettings.shadowCascades : 1; + Assert.AreEqual(expectedCascadeCount, urpAsset.shadowCascadeCount, "shadowCascadeCount mismatch"); + Assert.AreEqual(QualitySettings.shadowCascade2Split, urpAsset.cascade2Split, "cascade2Split mismatch"); + Assert.AreEqual(QualitySettings.shadowCascade4Split, urpAsset.cascade4Split, "cascade4Split mismatch"); + Assert.AreEqual(QualitySettings.shadows == UnityEngine.ShadowQuality.All, urpAsset.supportsSoftShadows, "supportsSoftShadows mismatch"); - Assert.AreEqual(tier.reflectionProbeBlending, urpAsset.reflectionProbeBlending, "reflectionProbeBlending mismatch"); - Assert.AreEqual(tier.reflectionProbeBoxProjection, urpAsset.reflectionProbeBoxProjection, "reflectionProbeBoxProjection mismatch"); + // ---------- RENDERER FORWARDING CHECK ---------- + Assert.AreEqual(1, urpAsset.m_RendererDataList.Length); + Assert.IsNotNull(urpAsset.m_RendererDataList[0]); + } - Assert.AreEqual(QualitySettings.shadowDistance, urpAsset.shadowDistance, "shadowDistance mismatch"); - var expectedCascadeCount = tier.cascadedShadowMaps ? QualitySettings.shadowCascades : 1; - Assert.AreEqual(expectedCascadeCount, urpAsset.shadowCascadeCount, "shadowCascadeCount mismatch"); - Assert.AreEqual(QualitySettings.shadowCascade2Split, urpAsset.cascade2Split, "cascade2Split mismatch"); - Assert.AreEqual(QualitySettings.shadowCascade4Split, urpAsset.cascade4Split, "cascade4Split mismatch"); - Assert.AreEqual(QualitySettings.shadows == ShadowQuality.All, urpAsset.supportsSoftShadows, "supportsSoftShadows mismatch"); + renderSettingsConverter.Scan(OnScanFinished); - // ---------- RENDERER FORWARDING CHECK ---------- - Assert.AreEqual(1, urpAsset.m_RendererDataList.Length); - Assert.IsNotNull(urpAsset.m_RendererDataList[0]); + } } diff --git a/Packages/com.unity.render-pipelines.universal/Tests/Runtime/LightClusteringTests.cs b/Packages/com.unity.render-pipelines.universal/Tests/Runtime/LightClusteringTests.cs index 793cadaf955..29e02f1a64a 100644 --- a/Packages/com.unity.render-pipelines.universal/Tests/Runtime/LightClusteringTests.cs +++ b/Packages/com.unity.render-pipelines.universal/Tests/Runtime/LightClusteringTests.cs @@ -61,6 +61,8 @@ public void LightClustering_WhenLightVolumeIntersectionWithXZPlaneIsOutsideTheSc float farPlane = 1000f; JobHandle handle = ForwardLights.ScheduleClusteringJobs( + false, + true, lights, probes, zBins, diff --git a/Packages/com.unity.render-pipelines.universal/Tests/Runtime/ShadowCaster2DTests.cs b/Packages/com.unity.render-pipelines.universal/Tests/Runtime/ShadowCaster2DTests.cs new file mode 100644 index 00000000000..da84421001e --- /dev/null +++ b/Packages/com.unity.render-pipelines.universal/Tests/Runtime/ShadowCaster2DTests.cs @@ -0,0 +1,56 @@ +#if U2D_ANIMATION_INSTALLED +using NUnit.Framework; +using UnityEngine.U2D.Animation; + +namespace UnityEngine.Rendering.Universal.Tests +{ + class ShadowCaster2DTests + { + GameObject m_Obj; + + [SetUp] + public void Setup() + { + m_Obj = new GameObject(); + m_Obj.AddComponent(); + } + + [TearDown] + public void Cleanup() + { + Object.DestroyImmediate(m_Obj); + } + + [Test] + public void AddShadowCaster2DWithSpriteSkin() + { + m_Obj.AddComponent(); + ShadowCaster2D shadowCaster2D = m_Obj.AddComponent(); + +// ShadowCaster2D.shadowShape2DProvider is always null on Standalone. +#if UNITY_EDITOR + Assert.That(shadowCaster2D.shadowShape2DProvider, Is.TypeOf(typeof(ShadowShape2DProvider_SpriteSkin))); +#else + Assert.That(shadowCaster2D.shadowShape2DProvider, Is.Null); +#endif + } + + [Test] + public void AddShadowCaster2DWithSpriteSkinWhenInactive() + { + m_Obj.AddComponent(); + m_Obj.SetActive(false); + ShadowCaster2D shadowCaster2D = m_Obj.AddComponent(); + Assert.That(shadowCaster2D.shadowShape2DProvider, Is.Null); + + m_Obj.SetActive(true); +// ShadowCaster2D.shadowShape2DProvider is always null on Standalone. +#if UNITY_EDITOR + Assert.That(shadowCaster2D.shadowShape2DProvider, Is.TypeOf(typeof(ShadowShape2DProvider_SpriteSkin))); +#else + Assert.That(shadowCaster2D.shadowShape2DProvider, Is.Null); +#endif + } + } +} +#endif diff --git a/Packages/com.unity.render-pipelines.core/Editor/LookDev/CameraController.cs.meta b/Packages/com.unity.render-pipelines.universal/Tests/Runtime/ShadowCaster2DTests.cs.meta similarity index 83% rename from Packages/com.unity.render-pipelines.core/Editor/LookDev/CameraController.cs.meta rename to Packages/com.unity.render-pipelines.universal/Tests/Runtime/ShadowCaster2DTests.cs.meta index 9ea69f6bcf2..a7db3171516 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/LookDev/CameraController.cs.meta +++ b/Packages/com.unity.render-pipelines.universal/Tests/Runtime/ShadowCaster2DTests.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 65d4b8eee9b19324cb60b5b126ca55f4 +guid: cf9e72a1bdd854b65a42b0d13738efcd MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Packages/com.unity.render-pipelines.universal/Tests/Runtime/Unity.RenderPipelines.Universal.Runtime.Tests.asmdef b/Packages/com.unity.render-pipelines.universal/Tests/Runtime/Unity.RenderPipelines.Universal.Runtime.Tests.asmdef index 13cdbdae9cf..502762ff501 100644 --- a/Packages/com.unity.render-pipelines.universal/Tests/Runtime/Unity.RenderPipelines.Universal.Runtime.Tests.asmdef +++ b/Packages/com.unity.render-pipelines.universal/Tests/Runtime/Unity.RenderPipelines.Universal.Runtime.Tests.asmdef @@ -7,7 +7,8 @@ "GUID:0acc523941302664db1f4e527237feb3", "GUID:516a5277b8c3b4f4c8cc86b77b1591ff", "GUID:d8b63aba1907145bea998dd612889d6b", - "GUID:df380645f10b7bc4b97d4f5eb6303d95" + "GUID:df380645f10b7bc4b97d4f5eb6303d95", + "GUID:41524c21c95e5fe4dbc5b48bd21995a4" ], "includePlatforms": [], "excludePlatforms": [], @@ -20,6 +21,12 @@ "defineConstraints": [ "UNITY_INCLUDE_TESTS" ], - "versionDefines": [], + "versionDefines": [ + { + "name": "com.unity.2d.animation", + "expression": "1.0.0", + "define": "U2D_ANIMATION_INSTALLED" + } + ], "noEngineReferences": false } \ No newline at end of file diff --git a/Packages/com.unity.render-pipelines.universal/ValidationExceptions.json b/Packages/com.unity.render-pipelines.universal/ValidationExceptions.json index 082ee57dd9f..9fb62857cac 100644 --- a/Packages/com.unity.render-pipelines.universal/ValidationExceptions.json +++ b/Packages/com.unity.render-pipelines.universal/ValidationExceptions.json @@ -2,7 +2,7 @@ "Exceptions": [ { "ValidationTest": "API Updater Configuration Validation", - "PackageVersion": "17.4.0" + "PackageVersion": "17.5.0" } ] } \ No newline at end of file diff --git a/Packages/com.unity.render-pipelines.universal/package.json b/Packages/com.unity.render-pipelines.universal/package.json index 1f6f437939a..68824e7b6f4 100644 --- a/Packages/com.unity.render-pipelines.universal/package.json +++ b/Packages/com.unity.render-pipelines.universal/package.json @@ -1,13 +1,13 @@ { "name": "com.unity.render-pipelines.universal", "description": "The Universal Render Pipeline (URP) is a prebuilt Scriptable Render Pipeline, made by Unity. URP provides artist-friendly workflows that let you quickly and easily create optimized graphics across a range of platforms, from mobile to high-end consoles and PCs.", - "version": "17.4.0", - "unity": "6000.4", + "version": "17.5.0", + "unity": "6000.5", "displayName": "Universal Render Pipeline", "dependencies": { - "com.unity.render-pipelines.core": "17.4.0", - "com.unity.shadergraph": "17.4.0", - "com.unity.render-pipelines.universal-config": "17.4.0" + "com.unity.render-pipelines.core": "17.5.0", + "com.unity.shadergraph": "17.5.0", + "com.unity.render-pipelines.universal-config": "17.5.0" }, "keywords": [ "graphics", @@ -31,7 +31,7 @@ { "displayName": "Renderer Shader User Value Samples", "description": "Adds a set of examples using Renderer Shader User Value feature.", - "path": "Samples~/RendererShaderUserValueSamples", + "path": "Samples~/RendererShaderUserValueSamples", "dependencies": [ "com.unity.render-pipelines.core/Samples~/Common", "com.unity.render-pipelines.core/Samples~/RendererShaderUserValue_Common" diff --git a/Packages/com.unity.shaderanalysis/Editor/Platforms/ShaderReportBuildData.cs b/Packages/com.unity.shaderanalysis/Editor/Platforms/ShaderReportBuildData.cs index b71ccc36444..4f03dd853c4 100644 --- a/Packages/com.unity.shaderanalysis/Editor/Platforms/ShaderReportBuildData.cs +++ b/Packages/com.unity.shaderanalysis/Editor/Platforms/ShaderReportBuildData.cs @@ -37,9 +37,10 @@ public Pass(string name, int shaderPassIndex) readonly HashSet m_ShaderKeywords; // Outputs -#if UNITY_2018_1_OR_NEWER + /// + /// Gets the processed shader data generated after analysis or build. + /// public ShaderData shaderData { get; private set; } -#endif static readonly Dictionary k_ProfileToDeclaration = new() { @@ -69,16 +70,11 @@ protected ShaderBuildData( public void FetchShaderData() { -#if UNITY_2018_1_OR_NEWER shaderData = ShaderUtil.GetShaderData(m_Shader); -#else - throw new Exception("Missing Unity ShaderData feature, It requires Unity 2018.1 or newer."); -#endif } public void BuildPassesData() { -#if UNITY_2018_1_OR_NEWER Assert.IsNotNull(shaderData); passes.Clear(); @@ -103,7 +99,6 @@ public void BuildPassesData() }; passes.Add(pass); } -#endif } public IEnumerator ExportPassSourceFiles() @@ -220,13 +215,11 @@ public override IEnumerator ExportBuildReport() { m_Report = new ShaderBuildReport(); -#if UNITY_2018_1_OR_NEWER foreach (var skippedPassIndex in m_SkippedPassesFromFilter) { var pass = shaderData.ActiveSubshader.GetPass(skippedPassIndex); m_Report.AddSkippedPass(skippedPassIndex, pass.Name); } -#endif var c = passes.Count; for (var i = 0; i < c; i++) diff --git a/Packages/com.unity.shadergraph/CHANGELOG.md b/Packages/com.unity.shadergraph/CHANGELOG.md index 07f48e5a175..9b1bd1e4fa9 100644 --- a/Packages/com.unity.shadergraph/CHANGELOG.md +++ b/Packages/com.unity.shadergraph/CHANGELOG.md @@ -10,6 +10,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. Version Updated The version number for this package has increased due to a version update of a related graphics package. +## [17.4.0] - 2025-10-22 + +This version is compatible with Unity 6000.4.0a4. +For the release notes, refer to the [Unity download archive](https://unity.com/releases/editor/archive). + ## [17.3.0] - 2025-08-27 This version is compatible with Unity 6000.3.0b1. diff --git a/Packages/com.unity.shadergraph/Documentation~/Append-Node.md b/Packages/com.unity.shadergraph/Documentation~/Append-Node.md index 1550eddd367..54958b882e1 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Append-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Append-Node.md @@ -19,7 +19,11 @@ Input **A** channels take priority over input **B** to combine up to a maximum o ## Example graph usage -In the following example, an **Append** node combines a **Vector 2** and a **Float**. The resulting output vector has 3 channels: the **X** and **Y** from the **Vector 2**, and the **X** from the **Float**. +In the following example, an **Append** node combines a **Vector 2** and a **Float**. The resulting output vector has the following 3 channels: + +- The first channel is the **X** from the **Vector 2**. +- The second channel is the **Y** from the **Vector 2**. +- The third channel is the **X** from the **Float**. Notice that with an Append node, you don't need to use a Split node to break up the Vector 2 into individual channels, then a Combine node to combine the 3 separate channels. diff --git a/Packages/com.unity.shadergraph/Documentation~/Cosine-Node.md b/Packages/com.unity.shadergraph/Documentation~/Cosine-Node.md index 6bfd3c8ee58..60872a1cd29 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Cosine-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Cosine-Node.md @@ -8,7 +8,7 @@ Returns the cosine of the value of input **In**. | Name | Direction | Type | Description | |:------------ |:-------------|:-----|:---| -| In | Input | Dynamic Vector | Input value | +| In | Input | Dynamic Vector | Input value in radians | | Out | Output | Dynamic Vector | Output value | ## Generated Code Example diff --git a/Packages/com.unity.shadergraph/Documentation~/Create-Node-Menu.md b/Packages/com.unity.shadergraph/Documentation~/Create-Node-Menu.md index 31b2d355a79..5cfbb956fbc 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Create-Node-Menu.md +++ b/Packages/com.unity.shadergraph/Documentation~/Create-Node-Menu.md @@ -1,22 +1,69 @@ -# Create Node Menu +# Add and connect nodes in a shader graph -## Description +You can add and connect nodes in a shader graph in different ways depending on your current task. -Use the **Create Node Menu** to create [nodes](Node.md) in Shader Graph. To open the **Create Node Menu**, either right-click on the workspace in the [Shader Graph Window](Shader-Graph-Window.md) and select **Create Node**, or press the spacebar. +> [!NOTE] +> To add and connect nodes in a shader graph, you need to [create a shader graph asset](create-shader-graph.md) first and open the asset in the [Shader Graph window](Shader-Graph-Window.md). -At the top of the **Create Node Menu** is a search bar. To search for a node, type any part of its name in the search field. The search box gives you autocomplete options, and you can press Tab to accept the predictive text. It highlights matching text in yellow. +## Add a node -The **Create Node Menu** lists all nodes that are available in Shader Graph, categorized by their function. User-created [Sub Graphs](Sub-graph.md) are also available in the **Create Node Menu** under **Sub Graph Assets**, or in a custom category that you define in the Sub Graph Asset. +To add a [node](Node.md) to your shader graph, follow these steps: -To add a node to the workspace, double-click it in the **Create Node Menu**. +1. Open the **Create Node** menu through either of the following: + + * Select the [Shader Graph window](Shader-Graph-Window.md)'s workspace and press the **Spacebar**. + * Right-click in the Shader Graph Window's workspace and select **Create Node**. -### Contextual Create Node Menu +1. In the **Create Node** menu, browse or search for the desired node. + + The **Create Node** menu lists all nodes that are available in Shader Graph, categorized by their function. User-created [sub graphs](Sub-graph.md) are also available in the **Create Node** menu under **Sub Graph Assets**, or in a custom category that you define in the Sub Graph Asset. -A contextual **Create Node Menu** filters the available nodes, and only shows those that use the [Data Type](Data-Types.md) of a selected edge. It lists every available [Port](Port.md) on nodes that match that Data Type. +1. Double-click on a node's name to add the corresponding node in the graph. -To open a contextual **Create Node Menu**, click and drag an [Edge](Edge.md) from a Port, and then release it in an empty area of the workspace. +> [!NOTE] +> Use the **Create Node** menu search box to filter the listed nodes by name parts and synonyms based on industry terms. It provides autocomplete options and highlights matching text in yellow. You can press **Tab** to accept the predictive text. -### Master Stack Create Node Menu -To add a new [Block Node]() to the [Master Stack](), either right click and select **Create Node** or press spacebar with the stack selected. +## Connect node ports -The **Create Node Menu** will display all available blocks for the master stack based on the render pipelines in your project. Any block can be added to the master stack via the **Create Node Menu**. If the block added is not compatible with the current Graph settings, the block will be disabled until the settings are configured to support it. +To connect [ports](Port.md) between two existing [nodes](Node.md) or with the [master stack](Master-Stack.md), select and drag the desired port to the target. + +The line resulting from that connection is called an [edge](Edge.md). + +You can only connect an output port to a input port, or vice-versa, and you can't connect two ports of the same node together. + +## Add and connect a node from an existing port + +To connect a [port](Port.md) to a [node](Node.md) that doesn't exist yet and create that targeted node in the process, follow these steps: + +1. Select and drag the desired port and release it in an empty area of the workspace. + +1. In the **Create Node** menu, browse or search for the node you need to connect to the port you dragged out. + + The **Create Node** menu displays every node port available according to the [data types](Data-Types.md) compatible with the port you dragged out. + +1. Double-click on a node port's name to add the corresponding node in the graph, with the two expected ports already connected­. + +## Add a block node in the Master Stack + +To add a new [block node](Block-Node.md) to the [master stack](Master-Stack.md), follow these steps: + +1. Open the **Create Node** menu for the Master Stack context through either of the following: + * Select the Master Stack's targeted context (**Vertex** or **Fragment**) and press the **Spacebar**. + * Right-click in the Master Stack's targeted context area and select **Create Node**. + +1. In the **Create Node** menu, browse or search for the desired block node. + + The **Create Node** menu displays all available blocks for the master stack based on the render pipelines in your project. + +1. Double-click on a block node's name to add the corresponding block node in the Master Stack. + +> [!NOTE] +> If the block that you add is not compatible with the current [graph settings](Graph-Settings-Tab.md), the block is deactivated until you configure the settings to support it. + +## Additional resources + +* [Nodes](Node.md) +* [Ports](Port.md) +* [Edges](Edge.md) +* [Master Stack](Master-Stack.md) +* [Block nodes](Block-Node.md) diff --git a/Packages/com.unity.shadergraph/Documentation~/Create-Shader-Graph.md b/Packages/com.unity.shadergraph/Documentation~/Create-Shader-Graph.md index 0db8b5eeecc..bf5b07eeb02 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Create-Shader-Graph.md +++ b/Packages/com.unity.shadergraph/Documentation~/Create-Shader-Graph.md @@ -1,51 +1,57 @@ -# Creating a new shader graph asset +# Create a shader graph asset -After you configure an SRP, you can create a new shader graph asset. +You can create a new shader graph asset in different ways according to your current workflow. -To create a new shader graph asset, follow these steps: -1. In the **Project** window, right-click and select **Create** > **Shader Graph** > **From Template...**. +## Create a shader graph from a template -1. In the context menu, select your desired type of Shader Graph. +To create a new shader graph asset from a prebuilt shader graph template, follow these steps: - The type of Shader Graph available is dependent on the render pipelines present in your project. +1. In the **Project** window, right-click and select **Create** > **Shader Graph** > **From Template**. - A submenu for each installed render pipeline may be present containing template stacks for standard shading models ( Lit, Unlit, etc ). + The [template browser](template-browser.md) lists all available templates according to your project's render pipeline. - For a full list of provided options, refer to the [Universal Render Pipeline](https://docs.unity3d.com/Manual/urp/urp-introduction.html) and [High Definition Render Pipeline](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest) documentation. +1. Select the desired template and click **Create**. - For this example, Universal is installed so a Universal Lit Shader Graph has been created. + Unity creates a new shader graph asset in your project. -1. Double-click your newly created shader graph asset to open it in the Shader Graph window. +1. Name the shader graph asset. -## Shader Graph window +You can now open the asset and edit the graph in the [Shader Graph window](Shader-Graph-Window.md). -The Shader Graph window consists of the Master Stack, the Preview Window, the Blackboard, and the Graph Inspector. -![](images/ShaderGraphWindow.png) +## Create a shader graph with a preset target -### Master Stack +To start from a default configuration with a preset master stack according to a specific render pipeline and material type, follow these steps: -The final connection that determines your shader output. Refer to [Master Stack](Master-Stack.md) for more information. +1. In the **Project** window, right-click and select **Create** > **Shader Graph**, and then the target render pipeline and the desired shader type. -![]() + The types of shader graphs available depend on the render pipelines present in your project (for example, **URP** > **Lit Shader Graph**). For a full list of provided options, refer to the [Universal Render Pipeline](https://docs.unity3d.com/Manual/urp/urp-introduction.html) and [High Definition Render Pipeline](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest) documentation. -### Preview window + Unity creates a new shader graph asset in your project. -An area to preview the current shader output. Here, you can rotate the object, and zoom in and out. You can also change the basic mesh on which the shader is previewed. Refer to [Main Preview](Main-Preview.md) for more information. +1. Name the shader graph asset. -![img](images/MainPreview.png) +You can now open the asset and edit the graph in the [Shader Graph window](Shader-Graph-Window.md). -### Blackboard -An area that contains all of the shader's properties in a single, collected view. Use the Blackboard to add, remove, rename, and reorder properties. Refer to [Blackboard](Blackboard.md) for more information. +## Create an empty shader graph -![](images/Blackboard.png) +To create an empty shader graph asset and build your shader graph from scratch in the Shader Graph window: -After you've set up a project, and become familiar with the Shader Graph window, refer to [My first Shader Graph](First-Shader-Graph.md) for more information on how to get started. +1. In the **Project** window, right-click and select **Create** > **Shader Graph** > **Blank Shader Graph**. -### Internal Inspector + Unity creates a new shader graph asset in your project. -An area that contains information contextual to whatever the user is currently clicking on. It's a window that automatically is hidden by default and only appears when something is selected that can be edited by the user. Use the Internal Inspector to display and modify properties, node options, and the graph settings. Refer to [Internal Inspector](Internal-Inspector.md) for more information. +1. Name the shader graph asset. -![](images/Inspector.png) +You can now open the asset and edit the graph in the [Shader Graph window](Shader-Graph-Window.md). + +> [!NOTE] +> To make such a blank shader graph functional, you have to define a [Target](Graph-Target.md) in the [Graph settings tab](Graph-Settings-Tab.md) of the Graph Inspector. + +## Additional resources + +* [Shader Graph template browser](template-browser.md) +* [Create a custom shader graph template](template-browser.md#create-a-custom-shader-graph-template) +* [Shader Graph window](Shader-Graph-Window.md) diff --git a/Packages/com.unity.shadergraph/Documentation~/Edge.md b/Packages/com.unity.shadergraph/Documentation~/Edge.md index 988acaeb150..5a45646a536 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Edge.md +++ b/Packages/com.unity.shadergraph/Documentation~/Edge.md @@ -6,6 +6,6 @@ An **Edge** defines a connection between two [Ports](Port.md). **Edges** define Each **Edge** has a [Data Type](Data-Types.md) which defines what [Ports](Port.md) it can be connected to. Each [Data Type](Data-Types.md) has an associated color for identifying its type. -You can create a new **Edge** by clicking and dragging from a [Port](Port.md) with the left mouse button. Edges can be deleted with Delete (Windows), Command + Backspace (OSX) or from the context menu by right clicking on the [Node](Node.md). +You can create a new **Edge** by clicking and dragging from a [Port](Port.md) with the left mouse button. Edges can be deleted with Delete (Windows), Command + Backspace (OSX) or from the context menu by right clicking on the edge. You can open a contextual [Create Node Menu](Create-Node-Menu.md) by dragging an **Edge** from a [Port](Port.md) with the left mouse button and releasing it in an empty area of the workspace. diff --git a/Packages/com.unity.shadergraph/Documentation~/First-Shader-Graph.md b/Packages/com.unity.shadergraph/Documentation~/First-Shader-Graph.md index 303b7dcda8b..240330c6fd7 100644 --- a/Packages/com.unity.shadergraph/Documentation~/First-Shader-Graph.md +++ b/Packages/com.unity.shadergraph/Documentation~/First-Shader-Graph.md @@ -1,111 +1,121 @@ -# My first Shader Graph +# Create a shader graph and use it with a material -Before you begin, make sure that your project is set up properly, and the graphs are loading correctly. See [Getting started with Shader Graph](Getting-Started.md) for more information. +This example shows you how to do the following: +* Create a simple Lit shader graph with the Universal Render Pipeline (URP). +* Create and manage a material that uses this shader graph in a scene. -## Create a New Graph -Use the Project Browser to create a new [Shader Graph Asset](Shader-Graph-Asset.md) in your project. The **Create > Shader Graph** will display the various creation options. +For more options to get started with Shader Graph, refer to: +* [Create a shader graph asset](create-shader-graph.md) +* [Add and connect nodes in a shader graph](Create-Node-Menu.md) -A **Blank Shader Graph** will create a Shader Graph with no selected active targets or [block nodes](Block-Node.md). You will need to select a target via the [Graph Settings Menu](Graph-Settings-Tab.md) to continue. +## Create a new shader graph -Certain integrations, like Render Pipelines, can also provide pre-configured options for Shader Graphs. For this example, a **Universal > Lit** Shader Graph has been created and opened. +Before you can build a new shader graph, you have to create a shader graph asset to contain it. Follow these steps: -## Create a new node +1. In the **Project** window, right-click and select **Create** > **Shader Graph** > **URP** > **Lit**. + +1. Name the created shader graph asset and press Enter. -Use the **Create Node** menu to create new nodes. There are two ways to open the menu: +The [Shader Graph window](Shader-Graph-Window.md) opens, which allows you to edit the shader graph in the created asset. If the window doesn't open, double-click on the created asset. -1. Right click, and select **Create Node** from the context menu. -2. Press the spacebar. +## Create a new node -In the menu, you can type in the search bar to look for specific nodes, or browse all nodes in the library. In this example, we'll create a Color node. First, type "color" in the **Create Node** menu's search bar. Then, click **Color**, or highlight **Color** and press Enter to create a Color node. +For this example, you need to create a Color node. Follow these steps: -![](images/MyFirstShaderGraph_01.png) +1. Select the Shader Graph window's workspace and press the **Spacebar**. + + The **Create Node** menu opens, with the list of all available nodes. -## Connect nodes +1. In the **Create Node** menu's search bar, type `color`. -To build a graph, you need to connect nodes together. To do so, click the **Output Slot** of a node, and drag that connection into the **Input Slot** of another node. +1. In the **Input** > **Basic** category, double-click on **Color**. -Start by connecting the Color node to the **Base Color** block of our Fragment Stack. +A new **Color** node appears in the workspace. -![](images/MyFirstShaderGraph_02.png) +## Connect the node to the master stack -## Change node output +To use the Color node property as an input for the shader, you need to connect the node to the master stack. Follow these steps: -Notice that the connection updated the main preview, and the 3D Object in the **Main Preview** is now black, which is the color specified in the Color node. You can click on the color bar in that node, and use the color picker to change the color. Any changes you make on the node updates the object in the **Main Preview** in real time. +1. Select the **Out(4)** port of the **Color** node. -For example, if you pick red, the 3D Object immediately reflects this change. +1. Drag it to the **Base Color** block port of the **Fragment** section of the [master stack](Master-Stack.md). -![](images/MyFirstShaderGraph_03.png) +This connection updates the appearance of the 3D object in the **Main Preview**, which is now black, according to the Color node's default value. -## Save the graph +## Change the shader color -Currently, Shader Graphs do not automatically save. There are two ways to save your changes: +You can change the output color of the Color node to view how it affects the final shader. Follow these steps: -1. Click the **Save Asset** button in the top left corner of the window. -3. Close the graph. If Unity detects any unsaved changes, a pop-up window appears, and asks if you want to save those changes. +1. In the **Color** node, click on the color bar. -![](images/MyFirstShaderGraph_04.png) +1. Use the color picker to change the color. -## Create a Material +The color of the 3D object in the **Main Preview** changes to the selected color in real time. -After saving your graph, use the shader to create a new Material. The process of [creating a new Material](https://docs.unity3d.com/Manual/Materials.html) and assigning it a Shader Graph shader is the same as that for regular shaders. In either the main menu or the Project View context menu, select **Assets > Create > Material**. Select the Material you just created. In its Inspector window, select the **Shader** drop-down menu, click **Shader Graphs**, and choose the Shader Graph shader you wish to apply to the Material. +## Save your shader graph -You can also right-click the Shader Graph shader, and select **Create > Material**. This method automatically assigns that Shader Graph shader to the newly created Material. +You need to save your shader graph to use it with a material. To save your shader graph, do one of the following: -![](images/MyFirstShaderGraph_05.png) +* Click the **Save Asset** button in the top left corner of the window. -A Material is also automatically generated as a subasset of the Shader Graph. You can assign it directly to an object in your scene. Modifying a property from the Blackboard on the Shader Graph will update this material in real time, which allows for quick visualization in the scene. +* Close the graph. If Unity detects any unsaved changes, a dialog appears, and asks if you want to save those changes. -## Put the Material in the Scene +## Create a material from your shader graph -Now that you have assigned your shader to a Material, you can apply it to objects in the Scene. Drag and drop the Material onto an object in the Scene. Alternatively, in the object's Inspector window, locate **Mesh Renderer > Materials**, and apply the Material to the **Element**. +After you've saved your shader graph, you can use it to create a new material. -![](images/MyFirstShaderGraph_06.png) +The process of [creating a new Material](https://docs.unity3d.com/Manual/Materials.html) and assigning it a Shader Graph shader is the same as that for regular shaders. -## Use properties to edit the graph +To create a new material from your shader graph, follow these steps: -You can also use properties to alter your shader's appearance. Properties are options that are visible from the Material's Inspector, which lets others change settings in your shader without the need to open the Shader Graph. +1. In the Project window, right-click the shader graph asset you created. -To create a new property, use the **Add (+)** button on the top right corner of the Blackboard, and select the type of property to create. In this example, we'll select **Color**. +1. Select **Create > Material**. -![](images/MyFirstShaderGraph_07.png) +Unity automatically assigns the shader graph asset to the newly created material. You can view the shader graph name selected in the material's Inspector in the **Shader** property. -This adds a new property in the Blackboard with the following options in the **Node Settings** tab of the [Graph Inspector](Internal-Inspector.md) when the property is selected. +## Use the material in the scene -![](images/MyFirstShaderGraph_08.png) +Now that you have assigned your shader to a material, you can apply this material to GameObjects in the scene through one of the following: -| **Option** | **Description** | -| ------------------- | ------------------------------------------------------------ | -| **Property button** | To change the name of the property, right-click the button in the Blackboard, select **Rename**, then enter a new property name. To delete the property, right-click the button, and select **Delete**. | -| **Exposed** | Enable this checkbox to make the property visible from the Material's Inspector. | -| **Reference** | The property's name that appears in C# scripts. To change the **Reference** name, enter a new string. | -| **Default** | The default value of the property. | -| **Mode** | The mode of the property. Each property has different modes. For **Color**, you can select either **Default** or **HDR**. | -| **Precision** | The default [precision](Precision-Modes.md) of the property. | -| **Hybrid Instanced**| An experimental feature that enables this property to be instanced when using the Hybrid DOTS renderer. | +* Drag the material onto a GameObject in the scene. +* In the GameObject's Inspector, go to **Mesh Renderer > Materials**, and set the **Element** property to your material. -There are two ways to reference a property in your graph: +## Control the color from the material's Inspector -1. Drag the property from the Blackboard onto the graph. -2. Right-click and select **Create Node**. The property is listed in the **Properties** category. +You can use a property in the shader graph to alter your shader's appearance directly from the material's Inspector, without the need to edit the shader graph. -![](images/MyFirstShaderGraph_09.png) +To use a Color property instead of a Color node in your shader graph, follow these steps: -Try connecting the property to the **Base Color** block. The object immediately changes to black. +1. Open the shader graph you created earlier in the [Shader Graph window](Shader-Graph-Window.md). -![](images/MyFirstShaderGraph_10.png) +1. In the [Blackboard](Blackboard.md), select **Add (+)**, and then select **Color**. + + The Blackboard now displays a [property of Color type](Property-Types.md#color). -Save your graph, and return to the Material's Inspector. The property now appears in the Inspector. Any changes you make to the property in the Inspector affects all objects that use this Material. +1. Select the property. +1. In the [Graph Inspector](Internal-Inspector.md), in the **Node Settings** tab: + + * Change the **Name** according to the name you want to identify the property within the material's Inspector. + * Make sure to activate the **Show In Inspector** option. -![](images/MyFirstShaderGraph_11.png) +1. Drag the property from the Blackboard onto the Shader Graph window's workspace. -## More Tutorials +1. Connect the property's node to the **Base Color** block port of the **Fragment** section of the [master stack](Master-Stack.md), instead of the Color node you were using previously. + + This connection updates the appearance of the 3D object in the **Main Preview**, which is now black, according to the property's default value. -Older tutorials use an outdated format of Shader Graph with master nodes. When looking at older tutorials, reference the [Upgrade Guide](Upgrade-Guide-10-0-x.md) for tips on how to convert the master node to a [Master Stack](Master-Stack.md). +1. Save your graph, and return to the material's Inspector. + + The property you added in the graph now appears in the material's Inspector. Any changes you make to the property from the Inspector affects all objects that use this material. -To keep exploring how to use Shader Graph to author shaders, check out these blog posts: +## Additional resources -- [Art That Moves: Creating Animated Materials with Shader Graph](https://unity.com/blog/engine-platform/creating-animated-materials-with-shader-graph) -- [Custom Lighting in Shader Graph: Expanding Your Graphs in 2019](https://unity.com/blog/engine-platform/custom-lighting-in-shader-graph-expanding-your-graphs-in-2019) +* [Art That Moves: Creating Animated Materials with Shader Graph](https://unity.com/blog/engine-platform/creating-animated-materials-with-shader-graph) +* [Custom Lighting in Shader Graph: Expanding Your Graphs in 2019](https://unity.com/blog/engine-platform/custom-lighting-in-shader-graph-expanding-your-graphs-in-2019) +* [Shader Graph video tutorials](https://www.youtube.com/user/Unity3D/search?query=shader+graph) (on Unity YouTube Channel) +* [Shader Graph forum](https://discussions.unity.com/tags/c/unity-engine/52/shader-graph) -You can also visit the [Unity YouTube Channel](https://www.youtube.com/channel/UCG08EqOAXJk_YXPDsAvReSg) and look for [video tutorials on Shader Graph](https://www.youtube.com/user/Unity3D/search?query=shader+graph), or head to our [user forum](https://discussions.unity.com/tags/c/unity-engine/52/shader-graph) to find the latest information and conversations about Shader Graph. +> [!NOTE] +> Older tutorials use a former version of Shader Graph with master nodes. To know the differences between the former master node and the [Master Stack](Master-Stack.md), refer to the [Upgrade Guide](Upgrade-Guide-10-0-x.md). diff --git a/Packages/com.unity.shadergraph/Documentation~/Getting-Started.md b/Packages/com.unity.shadergraph/Documentation~/Getting-Started.md index 4ba39a34efe..07bd1887a40 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Getting-Started.md +++ b/Packages/com.unity.shadergraph/Documentation~/Getting-Started.md @@ -1,9 +1,9 @@ # Get started with Shader Graph -Explore the Shader Graph user interface and general workflows to start creating your own shader graphs. +Use the main shader graph creation and editing tools and explore general workflows to start creating your own shader graphs. | Topic | Description | | :--- | :--- | -| **[Creating a new shader graph asset](Create-Shader-Graph.md)** | Create a shader graph asset and get an overview of the main Shader Graph interface elements available to create and configure a shader graph. | -| **[My first Shader Graph](First-Shader-Graph.md)** | Create and configure a shader graph, and create and manipulate a material that uses that shader graph. | -| **[Create a new shader graph from a template](create-shader-graph-template.md)** | Use the Shader Graph template browser to create a shader graph. | +| **[Create a shader graph asset](Create-Shader-Graph.md)** | Create a shader graph asset, either from a template or with a preset target, or from nothing. | +| **[Add and connect nodes in a shader graph](Create-Node-Menu.md)** | Edit your shader graph asset, create nodes, and connect nodes together. | +| **[Create a shader graph and use it with a material](First-Shader-Graph.md)** | Create and configure a shader graph, and create and manipulate a material that uses that shader graph. | diff --git a/Packages/com.unity.shadergraph/Documentation~/Keywords-reference.md b/Packages/com.unity.shadergraph/Documentation~/Keywords-reference.md index c7577407f91..98576807ab3 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Keywords-reference.md +++ b/Packages/com.unity.shadergraph/Documentation~/Keywords-reference.md @@ -10,6 +10,7 @@ Parameters that all keyword types have in common. | :--- | :--- | | **Name** | The display name of the keyword. Unity shows this name in the title bar of nodes that reference the corresponding keyword, and also in the Material Inspector if you expose that keyword. | | **Reference** | The internal name for the keyword in the shader. Use this **Reference** name instead of the display **Name** when you reference the keyword in a script.

If you overwrite this parameter, be aware of the following:
  • A Keyword **Reference** has to be in full capitals. Unity converts any lowercase letters to uppercase.
  • If the string contains any characters that HLSL does not support, Unity replaces those characters with underscores.
  • You can revert to the default value: right-click on the **Reference** field label, and select **Reset Reference**.
| +| **Promote to final Shader** | Makes the keyword available across the entire shader rather than only within the subgraph. | | **Definition** | Sets the keyword declaration type, which determines how Unity compiles the shader code. This allows you to [optimize the balance between build time, runtime, and file sizes](Keywords-concepts.md#keyword-impact-optimization).

The options are:
  • **Shader Feature**: Unity only compiles shader variants for keyword combinations used by materials in your build, and removes other shader variants.
  • **Multi Compile**: Unity compiles shader variants for all keyword combinations regardless of whether the build uses these variants.
  • **Predefined**: Specifies that the target/sub-target already defines the keyword and you just want to reuse it. Predefined Keywords can either use a [built-in macro](https://docs.unity3d.com/Manual/shader-branching-built-in-macros.html), which results in static branching at build time, or any of the keywords already defined by the Shader Graph Target (for example, [URP](https://docs.unity3d.com/Manual/urp/urp-shaders/shader-keywords-macros.html)), including [Built-In keyword sets](https://docs.unity3d.com/Manual/SL-MultipleProgramVariants-shortcuts.html), and where the branching depends on that definition.
  • **Dynamic Branch**: Unity keeps branching code in one compiled shader program.
| | **Is Overridable** | Indicates whether the keyword's state can be overridden.
For more information, refer to [Toggle shader keywords in a script](https://docs.unity3d.com/Manual/shader-keywords-scripts.html). | | **Generate Material Property** | Generates a material property declaration to display the keyword as a property in the material inspector.
This adds a `[Toggle(_KEYWORD)]` attribute to the material property. For more information, refer to [`MaterialPropertyDrawer`](https://docs.unity3d.com/ScriptReference/MaterialPropertyDrawer.html). | diff --git a/Packages/com.unity.shadergraph/Documentation~/Property-Types.md b/Packages/com.unity.shadergraph/Documentation~/Property-Types.md index 9b83dfdf03a..2aee450abbe 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Property-Types.md +++ b/Packages/com.unity.shadergraph/Documentation~/Property-Types.md @@ -12,13 +12,17 @@ All properties have the following common parameters in addition to those specifi | Parameter | Description | | :--- | :--- | -| **Name** | The display name of the property. | -| **Reference** | The internal name for the property in the shader. Use this **Reference** name instead of the display **Name** when you reference the property in a script.

If you overwrite this parameter, be aware of the following:
  • If the string doesn't begin with an underscore, Unity automatically adds one.
  • If the string contains any characters that HLSL does not support, Unity removes them.
  • You can revert to the default value: right-click on the **Reference** field label, and select **Reset Reference**.
| -| **Precision** | Sets the data precision mode of the Property. The options are **Inherit**, **Single**, **Half**, and **Use Graph Precision**.
For more details, refer to [Precision Modes](Precision-Modes.md). | -| **Scope** | Specifies where you expect to edit the property for materials. The options are:
  • **Global**: Makes the property editable at a global level, through a C# script only, for all materials that use it. Selecting this option hides or grays out all parameters that relate to the Inspector UI display.
  • **Per Material**: Makes the property independently editable per material, either through a C# script, or in the Inspector UI if you enable **Show In Inspector**.
  • **Hybrid Per Instance**: Has the same effect as **Per Material**, unless you're using [DOTS instancing](https://docs.unity3d.com/Packages/com.unity.entities.graphics@latest/index.html?subfolder=/manual/dots-instancing-shader.html).
| -| **Show In Inspector** | Displays the property in the material inspector.
If you disable this option, it includes an `[HideInInspector]` attribute to the material property (refer to [Properties block reference in ShaderLab](https://docs.unity3d.com/Manual/SL-Properties.html#material-property-attributes) for more details). | -| **Read Only** | Adds a [`PerRendererData`](https://docs.unity3d.com/ScriptReference/Rendering.ShaderPropertyFlags.html) attribute to the material property to display the value as read-only in the material inspector. | -| **Custom Attributes** | A list of entries that allow you to call custom functions you scripted to create additional [material property drawers](https://docs.unity3d.com/ScriptReference/MaterialPropertyDrawer.html), like static decorators or complex controls.
The **Custom Material Property Drawers** sample, available in the Package Manager among other [Shader Graph samples](ShaderGraph-Samples.md), shows how to display a Vector2 as a min/max slider, for example.

**Note**: When you declare the custom functions in the script, make sure to suffix their names with `Drawer` or `Decorator`.

In the list, use **+** or **-** to add or remove entries. Each entry corresponds to a function call which requires the following parameters:
  • **Name**: A shorthened version of the function name, without its `Drawer` or `Decorator` suffix.
  • **Value**: The input values for the function as the script expects them.
**Note**: A property can only have one drawer at any given time. | +| **Name** | Displays the user-facing name of the property in the UI. | +| **Reference** | Defines the internal identifier used by the shader for this property; use this `Reference` instead of the display `Name` when accessing the property from a script.

If you overwrite this parameter, be aware of the following:
  • If the string doesn't begin with an underscore, Unity automatically adds one.
  • If the string contains any characters that HLSL does not support, Unity removes them.
  • You can revert to the default value: right-click on the **Reference** field label, and select **Reset Reference**.
| +| **Promote to final Shader** | Makes the property accessible across the final shader as a material property, not as an input port on the Subgraph Node. | +| **Precision** | Sets the numeric precision for the property’s data type.

The options are:
  • **Inherit**: Uses the precision defined by the graph or parent context.
  • **Single**: Uses single-precision (float) for maximum accuracy.
  • **Half**: Uses half-precision to reduce memory and improve performance.
  • **Use Graph Precision**: Uses the precision mode set in the graph settings.

For more details, refer to [Precision Modes](Precision-Modes.md). | +| **Scope** | Specifies where and how the property is edited across materials. The options are:
  • **Global**: Makes the property editable at a global level, through a C# script only, for all materials that use it. Selecting this option hides or grays out all parameters that relate to the Inspector UI display.
  • **Per Material**: Makes the property independently editable per material, either through a C# script, or in the Inspector UI if you enable **Show In Inspector**.
  • **Hybrid Per Instance**: Has the same effect as **Per Material**, unless you're using [DOTS instancing](https://docs.unity3d.com/Packages/com.unity.entities.graphics@latest/index.html?subfolder=/manual/dots-instancing-shader.html).
| +| **Default Value** | Sets the property's initial value to be serialized and used when new material instances are created. The value depends on the property type. | +| **Preview Value** | Sets a value to use for preview in the Shader Graph window, only when you set **Scope** to **Global**. | +| **Show In Inspector** | Displays the property in the material Inspector when enabled.
If you disable this option, it includes an `[HideInInspector]` attribute to the material property (refer to [Properties block reference in ShaderLab](https://docs.unity3d.com/Manual/SL-Properties.html#material-property-attributes) for more details). | +| **Read Only** | Marks the property as non-editable in the material Inspector by adding the [`PerRendererData`](https://docs.unity3d.com/ScriptReference/Rendering.ShaderPropertyFlags.html) attribute. | +| **Custom Attributes** | Enables attachment of custom scripted drawers or decorators to extend the material property UI, such as adding static headers or complex controls.
The **Custom Material Property Drawers** sample, available in the Package Manager among other [Shader Graph samples](ShaderGraph-Samples.md), shows how to display a Vector2 as a min/max slider, for example.

**Note**: When you declare the custom functions in the script, make sure to suffix their names with `Drawer` or `Decorator`.

In the list, use **+** or **-** to add or remove entries. Each entry corresponds to a function call which requires the following parameters:
  • **Name**: A shorthened version of the function name, without its `Drawer` or `Decorator` suffix.
  • **Value**: The input values for the function as the script expects them.
**Note**: A property can only have one drawer at any given time. | +| **Use Custom Binding** | Turns the property into a bound input port for connection to the [**Branch On Input Connection**](Branch-On-Input-Connection-Node.md) node. In the **Label** field, enter the label for the default value that displays on your Subgraph node's port binding in its parent Shader Graph.
This property is available only in sub graphs. | ## Float @@ -28,8 +32,9 @@ Parameters specific to Float properties in addition to the [common parameters](# | Parameter | Description | | :--- | :--- | -| **Mode** | Select the UI mode in which you want to display the Property and manipulate its value in the material inspector. You need to define a specific subset of parameters according to the option you select.

The options are:
  • **Default**: Displays a scalar input field in the material inspector. Only requires a **Default Value**.
  • **Slider**: Defines the Float property in [`Range`](https://docs.unity3d.com/Manual/SL-Properties.html#material-property-declaration-syntax-by-type) mode to display a slider field in the material inspector. Use [additional parameters](#slider) to define the slider type.
  • **Integer**: Displays an integer input field in the material inspector. Only requires a **Default Value**.
  • **Enum**: Adds an [`Enum`](https://docs.unity3d.com/ScriptReference/MaterialPropertyDrawer.html) attribute to the Float property to display a drop-down with a list of specific values in the material inspector. Use [additional parameters](#enum) to define the enum type.
| -| **Default Value** | The default value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html).
The value might be either a float or an integer according to the **Mode** and options you select. | +| **Mode** | Selects the UI mode used to display and edit the property value in the material Inspector, requiring a specific subset of parameters depending on the chosen option.

The options are:
  • **Default**: Displays a scalar input field in the material Inspector; only requires a **Default Value**.
  • **Slider**: Defines the Float property in [`Range`](https://docs.unity3d.com/Manual/SL-Properties.html#material-property-declaration-syntax-by-type) mode to display a slider; use [additional parameters](#slider) to define the slider type.
  • **Integer**: Displays an integer input field in the material Inspector; only requires a **Default Value**.
  • **Enum**: Adds an [`Enum`](https://docs.unity3d.com/ScriptReference/MaterialPropertyDrawer.html) attribute to the Float property to display a drop-down of specific values; use [additional parameters](#enum) to define the enum type.
| +| **Default Value** | Sets the initial value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html).
The value is either a float or an integer depending on the selected **Mode** and its options. Not available when **Scope** is set to **Global**. | +| **Requires Literal Input** | Requires the input to be a constant value. When enabled, if the user connects a variable, the shader compilation fails with an error. | ### Slider @@ -37,10 +42,10 @@ Additional parameters available when you set the Float property **Mode** to **Sl | Parameter | Description | | :--- | :--- | -| **Slider Type** | Select the slider response type to apply when you move the slider to change the value in the material inspector.

The options are:
  • **Default**: Displays a slider with a linear response. The value responds linearly within the slider range.
  • **Power**: Adds a [`PowerSlider`](https://docs.unity3d.com/ScriptReference/MaterialPropertyDrawer.html) attribute to the Float property to display a slider with a non-linear response. The value responds exponentially within the slider range according to the specified **Power** value.
  • **Integer**: Adds an [`IntRange`](https://docs.unity3d.com/ScriptReference/MaterialPropertyDrawer.html) attribute to the Float property to display a slider with an integer value response. The value responds in integer steps within the slider range.
| -| **Min** | The minimum value of the slider range. | -| **Max** | The maximum value of the slider range. | -| **Power** | The exponent to use for non-linear response between **Min** and **Max** when you set the **Slider Type** to **Power**. | +| **Slider Type** | Selects the slider response type applied when adjusting the value in the material Inspector.

The options are:
  • **Default**: Displays a slider with a linear response; the value changes linearly within the slider range.
  • **Power**: Adds a [`PowerSlider`](https://docs.unity3d.com/ScriptReference/MaterialPropertyDrawer.html) attribute to display a slider with a non-linear response; the value changes exponentially within the range according to the specified **Power**.
  • **Integer**: Adds an [`IntRange`](https://docs.unity3d.com/ScriptReference/MaterialPropertyDrawer.html) attribute to display a slider with integer steps; the value changes in whole-number increments within the range.
| +| **Min** | Sets the minimum value of the slider range. | +| **Max** | Sets the maximum value of the slider range. | +| **Power** | Defines the exponent used for non-linear response between **Min** and **Max** when **Slider Type** is set to **Power**. | ### Enum @@ -48,166 +53,163 @@ Additional parameters available when you set the Float property **Mode** to **En | Parameter | Description | | :--- | :--- | -| **Enum Type** | Select the source type to use for the dropdown entries in the material inspector.

The options are:
  • **Explicit Values**: Use a list of **Entries** you directly specify in this interface.
  • **Type Reference**: Use a **C# Enum Type** reference that contains predefined entries.
| -| **Entries** | The list of dropdown entries to define when you set **Enum Type** to **Explicit Values**.

Use **+** or **-** to add or remove entries. You have to define each entry with the following parameters:
  • **Name**: The entry name to display in the dropdown in the material inspector.
  • **Value**: The value to apply to the Float property when you select its **Name** in the dropdown in the material inspector.
**Note**: The **Entries** option allows you to define up to 7 entries. If you need a dropdown with more entries, use the **Type Reference** option. | -| **C# Enum Type** | The existing Enum Type reference to use when you set **Enum Type** to **Type Reference**.
Specify the full path of the type with the namespace. For example, to get Unity's predefined blend mode values: `UnityEngine.Rendering.BlendMode`. | +| **Enum Type** | Selects the source used to populate the dropdown entries in the material Inspector.

The options are:
  • **Explicit Values**: Uses a list of **Entries** you specify directly in this interface.
  • **Type Reference**: Uses a **C# Enum Type** reference that contains predefined entries.
| +| **Entries** | Defines the list of dropdown entries when **Enum Type** is set to **Explicit Values**.

Use **+** or **-** to add or remove entries. Each entry requires the following parameters:
  • **Name**: Sets the label displayed in the dropdown in the material Inspector.
  • **Value**: Sets the numeric value applied to the Float property when its **Name** is selected.
**Note**: Supports up to 7 entries. If you need more, use **Type Reference**. | +| **C# Enum Type** | Specifies the existing enum type to reference when **Enum Type** is set to **Type Reference**.
Enter the full type path with namespace, for example: `UnityEngine.Rendering.BlendMode`. | ## Vector 2 Defines a **Vector 2** value. Displays a **Vector 4** input field in the material inspector, where the z and w components are not used. -| Data Type | Modes | -|:-------------|:------| -| Vector 2 | | - -| Field | Type | Description | -|:-------------|:------|:------------| -| Default | Vector 2 | The default value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html). | +| Parameter | Description | +| :--- | :--- | +| **Default Value** | Sets the initial value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html).
A 2D vector value (Vector2). | ## Vector 3 Defines a **Vector 3** value. Displays a **Vector 4** input field in the material inspector, where the w component is not used. -| Data Type | Modes | -|:-------------|:------| -| Vector 3 | | - -| Field | Type | Description | -|:-------------|:------|:------------| -| Default | Vector 3 | The default value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html). | +| Parameter | Description | +| :--- | :--- | +| **Default Value** | Sets the initial value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html).
A 3D vector value (Vector3). | ## Vector 4 Defines a **Vector 4** value. Displays a **Vector 4** input field in the material inspector. -| Data Type | Modes | -|:-------------|:------| -| Vector 4 | | - -| Field | Type | Description | -|:-------------|:------|:------------| -| Default | Vector 4 | The default value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html). | +| Parameter | Description | +| :--- | :--- | +| **Default Value** | Sets the initial value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html).
A 4D vector value (Vector4). | ## Color Defines a **Color** value. If the Property Inspector displays **Main Color**, this is the [Main Color](https://docs.unity3d.com/Manual/SL-Properties.html) for the shader. To select or deselect this node as the **Main Color**, right-click it in the graph or Blackboard and select **Set as Main Color** or **Clear Main Color**. Corresponds to the [`MainColor`](https://docs.unity3d.com/Manual/SL-Properties.html) ShaderLab Properties attribute. -| Data Type | Modes | -|:-------------|:------| -| Color | Default, HDR | +| Parameter | Description | +| :--- | :--- | +| **Default Value** | Sets the initial value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html). | +| **Mode** | Selects the color input mode.

The options are:
  • **Default**: Allows to select a standard sRGB color.
  • **HDR**: Allows to select an HDR color and sets its intensity from -10 to 10 exposure stops.
| + +**Note:** In versions prior to 10.0, Shader Graph didn't correct HDR colors for the project colorspace. Version 10.0 corrected this behavior. HDR color properties that you created with older versions maintain the old behavior, but you can use the [Graph Inspector](Internal-Inspector.md) to upgrade them. To mimic the old behavior in a gamma space project, you can use the [Colorspace Conversion Node](Colorspace-Conversion-Node.md) to convert a new HDR **Color** property from **RGB** to **Linear** space. -#### Default +## Boolean + +Defines a **Boolean** value. Displays a **ToggleUI** field in the material inspector. Note that internally to the shader this value is a **Float**. The **Boolean** type in Shader Graph is merely for usability. -Displays an sRGB color field in the material inspector. +| Parameter | Description | +| :--- | :--- | +| **Default Value** | Sets the initial value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html).
A boolean value. | -| Field | Type | Description | -|:-------------|:------|:------------| -| Default | Vector 4 | The default value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html). | +## Gradient -#### HDR +Defines a constant **Gradient**. -Displays an HDR color field in the material inspector. +Parameters specific to Gradient properties in addition to the [common parameters](#common-parameters): -| Field | Type | Description | -|:-------------|:------|:------------| -| Default | Vector 4 | The default value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html). | +| Parameter | Description | +| :--- | :--- | +| **Default Value** | Displays the **HDR Gradient Editor** with selectable modes.
The options are:
  • **Blend (Classic)**: Creates transitions based on traditional HDR handling.
  • **Blend (Perceptual)**: Creates human vision–based gradient transitions in HDR.
  • **Fixed**: Creates a discrete gradient with fixed steps.
| -NOTE: In versions prior to 10.0, Shader Graph didn't correct HDR colors for the project colorspace. Version 10.0 corrected this behavior. HDR color properties that you created with older versions maintain the old behavior, but you can use the [Graph Inspector](Internal-Inspector.md) to upgrade them. To mimic the old behavior in a gamma space project, you can use the [Colorspace Conversion Node](Colorspace-Conversion-Node.md) to convert a new HDR **Color** property from **RGB** to **Linear** space. +**Note:** The **Promote to final Shader** parameter is not available for this property. ## Texture 2D Defines a [Texture 2D](https://docs.unity3d.com/Manual/class-TextureImporter.html) value. Displays an object field of type [Texture](https://docs.unity3d.com/Manual/class-TextureImporter.html) in the material inspector. If the Property Inspector displays **Main Texture**, this is the `Main Texture` for the shader. To select or deselect this node as the `Main Texture`, right-click on it in the graph or Blackboard and select **Set as Main Texture** or **Clear Main Texture**. Corresponds to the [`MainTexture`](https://docs.unity3d.com/Manual/SL-Properties.html) ShaderLab Properties attribute. -| Data Type | Modes | -|:-------------|:------| -| Texture | White, Black, Grey, Bump | +| Parameter | Description | +| :--- | :--- | +| **Default Value** | Sets the initial value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html).
A texture asset reference. | +| **Mode** | Defines the fallback texture Unity uses when none is provided.

The options are:
  • **White**: Sets a solid white (1,1,1) texture to ensure full-intensity sampling.
  • **Black**: Sets a solid black (0,0,0) texture to yield zero contribution.
  • **Grey**: Sets a mid-grey in sRGB (~0.5) as a neutral fallback.
  • **Normal Map**: Sets a flat normal value to keep surfaces flat without a normal texture.
  • **Linear Grey**: Sets a mid-grey in linear color space.
  • **Red**: Sets a solid red (1,0,0) texture, useful for data expected in the red channel.
| +| **Use Tiling and Offset** | Toggles the property `NoScaleOffset` to enable manipulating scale and offset separately from other texture properties; see [SplitTextureTransformNode](Split-Texture-Transform-Node.md).
A boolean value. | +| **Use TexelSize** | Uses the size of texels expressed in UV space. | + +## Texture 2D Array + +Defines a [Texture 2D Array](https://docs.unity3d.com/Manual/class-TextureImporter.html) value. Displays an object field of type [Texture 2D Array](https://docs.unity3d.com/Manual/class-TextureImporter.html) in the material inspector. -| Field | Type | Description | -|:-------------|:------|:------------| -| Default | Texture | The default value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html). | -| Use Tiling and Offset | Boolean | When set to false, activates the property [NoScaleOffset](https://docs.unity3d.com/Manual/SL-Properties.html), to enable manipulation of scale and offset separately from other texture properties. See [SplitTextureTransformNode](Split-Texture-Transform-Node.md).| +| Parameter | Description | +| :--- | :--- | +| **Default Value** | Sets the initial value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html).
A texture asset reference. | ## Texture 3D Defines a [Texture 3D](https://docs.unity3d.com/Manual/class-TextureImporter.html) value. Displays an object field of type [Texture 3D](https://docs.unity3d.com/Manual/class-TextureImporter.html) in the material inspector. -| Data Type | Modes | -|:-------------|:------| -| Texture | | +| Parameter | Description | +| :--- | :--- | +| **Default Value** | Sets the initial value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html).
A texture asset reference. | -| Field | Type | Description | -|:-------------|:------|:------------| -| Default | Texture | The default value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html). | +## Cubemap -## Texture 2D Array +Defines a [Cubemap](https://docs.unity3d.com/Manual/class-Cubemap.html) value. Displays an object field of type [Texture](https://docs.unity3d.com/Manual/class-TextureImporter.html) in the material inspector. -Defines a [Texture 2D Array](https://docs.unity3d.com/Manual/class-TextureImporter.html) value. Displays an object field of type [Texture 2D Array](https://docs.unity3d.com/Manual/class-TextureImporter.html) in the material inspector. +| Parameter | Description | +| :--- | :--- | +| **Default Value** | Sets the initial value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html).
A cubemap asset reference. | -| Data Type | Modes | -|:-------------|:------| -| Texture | | + +## Virtual Texture -| Field | Type | Description | -|:-------------|:------|:------------| -| Default | Texture | The default value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html). | +Defines a [Texture Stack](https://docs.unity3d.com/2020.1/Documentation/Manual/svt-use-in-shader-graph.html), which appears as object fields of type [Texture](https://docs.unity3d.com/Manual/class-TextureImporter.html) in the Material Inspector. The number of fields corresponds to the number of layers in the property. -## Cubemap +| Parameter | Description | +| :--- | :--- | +| **Layers** | Manages the collection of layers in the stack.

The options are:
  • **Add (+)**: Adds a new layer.
  • **Remove (−)**: Removes the selected layer.

Select the active layer to edit its parameters. | +| **Layer Name** | Displays the user-defined name for the selected layer. | +| **Layer Reference** | Defines the internal identifier used to reference the selected layer. | +| **Layer Texture** | Assigns the default texture asset for the selected layer. | +| **Layer Texture Type** | Specifies the expected data type for the selected layer’s texture, which determines import settings and sampling behavior, such as sRGB vs Linear and normal map decoding.

The options are:
  • **Normal tangent space**: Encodes per-texel normals relative to the mesh’s tangent basis so surface detail follows UVs and local orientation.
  • **Normal object space**: Preserves per-texel normals in object coordinates.
| -Defines a [Cubemap](https://docs.unity3d.com/Manual/class-Cubemap.html) value. Displays an object field of type [Texture](https://docs.unity3d.com/Manual/class-TextureImporter.html) in the material inspector. +**Note:** The **Use Custom Binding** parameter isn't available for this property. -| Data Type | Modes | -|:-------------|:------| -| Cubemap | | +**Note:** The **Promote to final Shader** parameter is not available for this property. -| Field | Type | Description | -|:-------------|:------|:------------| -| Default | Cubemap | The default value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html). | +## Matrix 2 - -## Virtual Texture +Defines a Matrix 2. Matrices do not display in the **Inspector** window of the material. -Defines a [Texture Stack](https://docs.unity3d.com/2020.1/Documentation/Manual/svt-use-in-shader-graph.html), which appears as object fields of type [Texture](https://docs.unity3d.com/Manual/class-TextureImporter.html) in the Material Inspector. The number of fields correspond to the number of layers in the property. +| Parameter | Description | +| :--- | :--- | +| **Default Value** | Sets the initial value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html).
A 2×2 matrix value (Matrix2). | -| Data Type | Modes | -|:----------|-------| -| Virtual Texture | | +## Matrix 3 -| Field | Type | Description | -|:-------------|:------|:------------| -| Default | Texture | The default value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html). | +Defines a Matrix 3 value. Can't be displayed in the material inspector. -## Boolean +| Parameter | Description | +| :--- | :--- | +| **Default Value** | Sets the initial value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html).
A 3×3 matrix value (Matrix3). | -Defines a **Boolean** value. Displays a **ToggleUI** field in the material inspector. Note that internally to the shader this value is a **Float**. The **Boolean** type in Shader Graph is merely for usability. +## Matrix 4 -| Data Type | Modes | -|:-------------|:------| -| Boolean | | +Defines a Matrix 4 value. Can't be displayed in the material inspector. -| Field | Type | Description | -|:-------------|:------|:------------| -| Default | Boolean | The default value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html). | +| Parameter | Description | +| :--- | :--- | +| **Default Value** | Sets the initial value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html).
A 4×4 matrix value (Matrix4). | -## Matrix 2x2 +## SamplerState -Defines a Matrix 2. Matrices do not display in the **Inspector** window of the material. +Defines a **SamplerState**. -| Field | Type | -|:--------|:---------| -| Default | Matrix 2 | +Parameters specific to Float properties in addition to the [common parameters](#common-parameters): -## Matrix 3x3 +| Parameter | Description | +| :--- | :--- | +| **Filter** | Specifies the texture filtering mode used when sampling. The options are:
  • **Linear**: Sets bilinear filtering within mip levels for smoother results, at the cost of potential blur.
  • **Point**: Sets nearest-neighbor sampling for a crisp, pixelated look.
  • **Trilinear**: Sets bilinear filtering with interpolation between mip levels for smoother transitions.
| +| **Wrap** | Specifies how UVs outside the [0–1] range are handled. The options are:
  • **Repeat**: Tiles the texture infinitely.
  • **Clamp**: Clamps to edge texels with no tiling.
  • **Mirror**: Tiles by mirroring each repeat.
  • **MirrorOnce**: Mirrors once, then clamps.
| +| **Aniso** | Specifies the anisotropic filtering level to improve texture clarity at grazing angles. The options are:
  • **None**: Disables anisotropic filtering.
  • **x2**: Applies a low level for higher performance.
  • **x4**: Applies a moderate level.
  • **x8**: Applies a high level.
  • **x16**: Applies the maximum level for best quality at lower performance.
| -Defines a Matrix 3 value. Can't be displayed in the material inspector. +## Dropdown -| Field | Type | -|:--------|:---------| -| Default | Matrix 3 | +Defines a **Dropdown**. This property is available only in sub graphs. -## Matrix 4x4 +Parameters specific to Dropdown properties in addition to the [common parameters](#common-parameters): -Defines a Matrix 4 value. Can't be displayed in the material inspector. +| Parameter | Description | +| :--- | :--- | +| **Default Value** | Selects the default Entry that you want Shader Graph to select on your property. | +| **Entries** | Adds a corresponding input port to the node for each entry.

The options are:
  • **Add to the list (+)**: Adds a new option to your dropdown.
  • **Remove selection from the list (-)**: Removes the selected entry from the list.
| + +**Note:** The **Promote to final Shader** parameter is not available for this property. -| Field | Type | -|:--------|:---------| -| Default | Matrix 4 | diff --git a/Packages/com.unity.shadergraph/Documentation~/Rounded-Rectangle-Node.md b/Packages/com.unity.shadergraph/Documentation~/Rounded-Rectangle-Node.md index 143a0bbcb90..f43d5783719 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Rounded-Rectangle-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Rounded-Rectangle-Node.md @@ -1,20 +1,23 @@ -# Rounded Rectangle Node +# Rounded Rectangle node -## Description +The Rounded Rectangle node generates a filled rounded rectangle shape with a border around it. The output is 1 for the rectangle and 0 for the border. -Generates a rounded rectangle shape based on input **UV** at the size specified by inputs **Width** and **Height**. The radius of each corner is defined by input **Radius**. The generated shape can be offset or tiled by connecting a [Tiling And Offset Node](Tiling-And-Offset-Node.md). Note that in order to preserve the ability to offset the shape within the UV space the shape will not automatically repeat if tiled. To achieve a repeating rounded rectangle effect first connect your input through a [Fraction Node](Fraction-Node.md). +To move the rectangle within the space, do the following: -NOTE: This [Node](Node.md) can only be used in the **Fragment** [Shader Stage](Shader-Stage.md). +- To offset the shape, input a [Tiling And Offset node](Tiling-And-Offset-Node.md) and adjust the **Offset** property. +- To tile the shape, input a [Tiling and Offset node](Fraction-Node.md) into a [Fraction node](Tiling-And-Offset-Node.md), then input the Fraction node into the Rounded Rectangle node. + +You can only output this node into the Fragment Context. ## Ports -| Name | Direction | Type | Binding | Description | -|:------------ |:-------------|:-----|:---|:---| -| UV | Input | Vector 2 | UV | Input UV value | -| Width | Input | Float | None | Rounded Rectangle width | -| Height | Input | Float | None | Rounded Rectangle height | -| Radius | Input | Float | None | Corner radius | -| Out | Output | Float | None | Output value | +| Name | Direction | Type | Binding | Description | +|-|-|-|-|-| +| **UV** | Input | Vector 2 | UV | Sets the UV coordinates to use to sample the rounded rectangle shape and the border. | +| **Width** | Input | Float | None | Sets how much horizontal space the rectangle fills, where 1 is a full-width rectangle without a border on the left and right. | +| **Height** | Input | Float | None | Sets how much vertical space the rectangle fills, where 1 is a full height rectangle without a border above and below. | +| **Radius** | Input | Float | None | Sets the roundness of the corners of the rectangle. The range is 0 to 1, where 0 is right-angled corners. | +| **Out** | Output | Float | None | The rounded rectangle and the border, where 1 is the rectangle and 0 is the border. | ## Generated Code Example diff --git a/Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Asset.md b/Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Asset.md index 80417b2b67a..7a908788bcf 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Asset.md +++ b/Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Asset.md @@ -1,9 +1,36 @@ -# Shader Graph Asset +# Shader Graph Asset reference -## Description +A Shader Graph asset is a file that contains a graph you create and edit in the [**Shader Graph** window](Shader-Graph-Window.md). It is also a shader that you can select from a material's shader dropdown, as any other shader. -The **Shader Graph Asset** is the new **Asset** type introduced with the shader graph. You can create a **Shader Graph Asset** from the [Project Window](https://docs.unity3d.com/Manual/ProjectView.html) from the **Create** menu. +To access the properties of a Shader Graph asset in the **Inspector** window, select the asset in your project. -For convenience there is a **Create** menu entry for **Blank Shader Graph** and [Sub-graph](Sub-graph.md). They can be found in the **Shader** sub-menu. Additional options may be provided by render pipelines. These options will create a new Shader Graph with required settings and [Block]() nodes in the [Master Stack]() for the selected shading model. +## Action buttons -You can open the [Shader Graph Window](Shader-Graph-Window.md) by double clicking a **Shader Graph Asset** or by clicking **Open Shader Editor** in the [Inspector](https://docs.unity3d.com/Manual/UsingTheInspector.html) when the **Shader Graph Asset** is selected. +Manage Shader Graph assets code. + +| Property | Description | +|---------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **Open Shader Editor** | Opens the selected asset in the [Shader Graph window](Shader-Graph-Window.md) so you can edit the graph. | +| **View Generated Shader** | Opens the shader code that the shader graph generates in a text editor or an IDE, such as Visual Studio. The code includes all possible passes and targets. | +| **Regenerate** | Updates the code you edited in your text editor or IDE. This button appears only when you select **View Generated Shader**. | +| **Copy Shader** | Copies the shader code to the clipboard. | + +## Properties + +Manage Shader Graph assets templates. + +| Property | Description | +|---------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **Use As Template** | Marks the selected Shader Graph asset as a template. When enabled, the asset appears in the [Shader Graph template browser](template-browser.md), but is no longer listed in any material's **Shader** dropdown by default. | +| **Expose As Shader** | Keeps the asset listed in a material's **Shader** dropdown so you can still use it as a shader when you also use it as a template. This is available only when **Use As Template** is enabled. | +| **Name** | Sets the name of the template in the Shader Graph template browser. | +| **Category** | Sets the category of the template in the Shader Graph template browser. | +| **Description** | Sets the description of the template in the Shader Graph template browser. | +| **Icon** | Sets the icon that represents the template in the Shader Graph template browser. | +| **Thumbnail** | Sets the image that represents the template in the Shader Graph template browser. | + +## Additional resources + +* [Creating a new shader graph asset](Create-Shader-Graph.md) +* [Shader Graph Window](Shader-Graph-Window.md) +* [Shader Graph template browser](template-browser.md) diff --git a/Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Preferences.md b/Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Preferences.md index 02dbbad75cc..74a705a0853 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Preferences.md +++ b/Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Preferences.md @@ -7,12 +7,15 @@ Use the Shader Graph preferences to define shader graph settings for your system ## Settings -| Name | Description | -|:--------------------------|:----------------------------------------| -| **Preview Variant Limit** | Set the maximum number of variants allowed in local projects. This is a local version of the **Shader Variant Limit** in the project settings. If your graph exceeds this maximum value, Unity returns the following error:
_Validation: Graph is generating too many variants. Either delete Keywords, reduce Keyword variants or increase the **Shader Variant Limit** in Preferences > Shader Graph._
For more information about shader variants, refer to [Making multiple shader program variants](https://docs.unity3d.com/Manual/SL-MultipleProgramVariants.html). For more information about the Shader Variant Limit, refer to [Shader graph project settings](Shader-Graph-Project-Settings.md)| -| **Automatically Add and Remove Block Nodes** | Automatically add [Block nodes](Block-Node.md) to, or remove them from, the [Master Stack](Master-Stack.md) as needed. If you select this option, any [Block nodes](Block-Node.md) that your Shader graph needs are added to the [Master Stack](Master-Stack.md) automatically. Any incompatible [Block nodes](Block-Node.md) that have no incoming connections will be removed from the [Master Stack](Master-Stack.md). If you don't select this option, no [Block nodes](Block-Node.md) are added to, or removed from, the [Master Stack](Master-Stack.md) automatically. | -| **Enable Deprecated Nodes** | Disable warnings for deprecated nodes and properties. If you select this option, Shader Graph doesn't display warnings if your graph contains deprecated nodes or properties. If you don't select this option, Shader Graph displays warnings for deprecated nodes and properties, and any new nodes and properties you create use the latest version. | -| **Zoom Step Size** | Control how much the camera in Shader Graph zooms each time you roll the mouse wheel. This makes it easier to control the difference in zoom speed between the touchpad and mouse. A touchpad simulates hundreds of steps, which causes very fast zooms, whereas a mouse wheel steps once with each click. | +| Name | Description | +|:---------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **Preview Variant Limit** | Sets the maximum number of variants allowed in local projects. This is a local version of the **Shader Variant Limit** in the project settings. If your graph exceeds this maximum value, Unity returns the following error:
_Validation: Graph is generating too many variants. Either delete Keywords, reduce Keyword variants, or increase the **Shader Variant Limit** in Preferences > Shader Graph._
For more information about shader variants, refer to [Making multiple shader program variants](https://docs.unity3d.com/Manual/SL-MultipleProgramVariants.html). For more information about the Shader Variant Limit, refer to [Shader graph project settings](Shader-Graph-Project-Settings.md) | +| **Automatically Add and Remove Block Nodes** | Adds to the [Master Stack](Master-Stack.md) any needed [Block nodes](Block-Node.md) and removes from the [Master Stack](Master-Stack.md) any Block nodes with no incoming connections. | +| **Enable Deprecated Nodes** | Disables warnings for deprecated nodes and properties. When enabled, Shader Graph doesn't display warnings if your graph contains deprecated nodes or properties. When disabled, Shader Graph displays warnings for deprecated nodes and properties, and the new nodes and properties you create use the latest version. | +| **Zoom Step Size** | Adjusts how much the Shader Graph camera zooms with each mouse wheel movement. This helps balance zoom speed, since touchpads can zoom much faster than regular mouse wheels.
Only affects materials created automatically, such as when you make a new shader graph from a Decal Projector or Fullscreen Renderer Feature. | +| **Graph Template Workflow** | Sets whether Unity creates new materials as [material variants](https://docs.unity3d.com/Manual/materialvariant-concept.html) from the child asset of the shader graph asset, or as standalone materials. The options are:
  • **Material Variant**: Unity creates material variants from the child asset of the shader graph asset.
  • **Material**: Unity creates standalone materials.
| +| **Open new Shader Graphs automatically** | Makes Unity open the Shader Graph window immediately after you create a new shader graph asset. When disabled, Unity does not open the window, and you must open the graph manually. | +| **New Nodes Preview** | Makes Shader Graph automatically expand the preview area for any newly created node that supports previews. When disabled, Shader Graph does not expand previews, but you can expand them manually. | ## Additional resources diff --git a/Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Window.md b/Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Window.md index e771e131aa6..d49036d4740 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Window.md +++ b/Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Window.md @@ -1,14 +1,25 @@ # Shader Graph Window -## Description +The **Shader Graph Window** contains the workspace to edit your shader graphs. -The **Shader Graph Window** contains the workspace for creating shaders with the **Shader Graph** system. To open the **Shader Graph Window**, you must first create a [Shader Graph Asset](index.md). For more information, refer to the [Getting Started](Getting-Started.md) section. +To access the **Shader Graph Window**, you must first create a [Shader Graph Asset](index.md). If the Shader Graph window doesn't open automatically after you [create a new shader graph asset](create-shader-graph.md), you have to double-click on the created asset. -The **Shader Graph** window contains various individual elements such as the [Blackboard](Blackboard.md), [Graph Inspector](Internal-Inspector.md), and [Main Preview](Main-Preview.md). You can move these elements around inside the workspace. They automatically anchor to the nearest corner when scaling the **Shader Graph Window**. +## Shader Graph window layout + +![The Shader Graph window with its main elements labeled from A to F.](images/ShaderGraphWindow.png) + +| Label | Name | Description | +| :--- | :--- | :--- | +| **A** | [Toolbar](#toolbar) | A set of tools to manage the shader graph asset, display elements in the window, and more. | +| **B** | [Workspace](#workspace) | The area where you create your graph. | +| **C** | [Master Stack](Master-Stack.md) | The final connection that determines your shader output. It consists of two separate contexts: **Vertex** and **Fragment**. | +| **D** | [Main Preview](Main-Preview.md) | Previews the current shader output. Use this to rotate the object, and zoom in and out. You can also change the basic mesh on which the shader is previewed. | +| **E** | [Blackboard](Blackboard.md) | Contains all of the shader's properties and keywords in a single, collected view. Use the Blackboard to add, remove, rename, and reorder properties and keywords. | +| **F** | [Graph Inspector](Internal-Inspector.md) | Displays the properties of the currently selected component. Use this to modify properties, node options, and the graph settings. This window is hidden by default and only appears when something is selected that can be edited by the user. | ## Toolbar -The toolbar at the top of the **Shader Graph Window** contains the following commands. +Use the **Shader Graph Window** toolbar to manage the shader graph asset, display elements in the window, and more. | Icon | Item | Description | |:--------------------|:--------------------|:------------| @@ -25,42 +36,42 @@ The toolbar at the top of the **Shader Graph Window** contains the following com ## Workspace -The workspace is where you create [Node](Node.md) networks. +Use the **Shader Graph Window** workspace to create [Node](Node.md) networks and connect them to the **Master Stack**. + To navigate the workspace, do the following: - Press and hold the Alt key and drag with the left mouse button to pan. - Use the mouse scroll wheel to zoom in and out. You can hold the left mouse button and drag to select multiple [Nodes](Node.md) with a marquee. There are also various [shortcut keys](Keyboard-shortcuts.md) you can use for better workflow. +### Context Menu -## Context Menu - -Right-click within the workspace to open a context menu. However, if you right-click on an item within the workspace, such as a [Node](Node.md), the context menu for that item opens. The workspace context menu provides the following options. +Right-click in the workspace area, on a node, or on a selection of nodes to open a context menu. | Item | Description | |:-----------------------------|:------------| | **Create Node** | Opens the [Create Node Menu](Create-Node-Menu.md). | | **Create Sticky Note** | Creates a new [Sticky Note](Sticky-Notes.md) on the Graph. | -| **Collapse All Previews** | Collapses previews on all [Nodes](Node.md). | -| **Cut** | Removes the selected [Nodes](Node.md) from the graph and places them in the clipboard. | -| **Copy** | Copies the selected [Nodes](Node.md) to the clipboard. | -| **Paste** | Pastes the [Nodes](Node.md) from the clipboard. | -| **Delete** | Deletes the selected [Nodes](Node.md). | -| **Duplicate** | Duplicates the selected [Nodes](Node.md). | -| **Select / Unused Nodes** | Selects all nodes on the graph that are not contributing to the final shader output from the [Master Stack](Master-Stack.md). | -| **View / Collapse Ports** | Collapses unused ports on all selected [Nodes](Node.md). | -| **View / Expand Ports** | Expands unused ports on all selected [Nodes](Node.md). | -| **View / Collapse Previews** | Collapses previews on all selected [Nodes](Node.md). | -| **View / Expand Previews** | Expands previews on all selected [Nodes](Node.md). | -| **Precision / Inherit** | Sets the precision of all selected Nodes to Inherit. | -| **Precision / Float** | Sets the precision of all selected nodes to Float. | -| **Precision / Half** | Sets the precision of all selected nodes to Half. | +| **Collapse All Previews** | Collapses previews on all nodes. | +| **Cut** | Removes the selected nodes from the graph and places them in the clipboard. | +| **Copy** | Copies the selected nodes to the clipboard. | +| **Paste** | Pastes the nodes from the clipboard. | +| **Delete** | Deletes the selected nodes. | +| **Duplicate** | Duplicates the selected nodes. | +| **Select** > **Unused Nodes** | Selects all nodes on the graph that are not contributing to the final shader output from the [Master Stack](Master-Stack.md). | +| **View** > **Collapse Ports** | Collapses unused ports on all selected nodes. | +| **View** > **Expand Ports** | Expands unused ports on all selected nodes. | +| **View** > **Collapse Previews** | Collapses previews on all selected nodes. | +| **View** > **Expand Previews** | Expands previews on all selected nodes. | +| **Precision** > **Inherit** | Sets the precision of all selected nodes to Inherit. | +| **Precision** > **Float** | Sets the precision of all selected nodes to Float. | +| **Precision** > **Half** | Sets the precision of all selected nodes to Half. | ## Additional resources -- [Color Modes](Color-Modes.md) -- [Create Node Menu](Create-Node-Menu.md) -- [Keyboard shortcuts](Keyboard-shortcuts.md) -- [Master Stack](Master-Stack.md) -- [Nodes](Node.md) -- [Sticky Notes](Sticky-Notes.md) \ No newline at end of file +* [Color Modes](Color-Modes.md) +* [Create Node Menu](Create-Node-Menu.md) +* [Keyboard shortcuts](Keyboard-shortcuts.md) +* [Master Stack](Master-Stack.md) +* [Nodes](Node.md) +* [Sticky Notes](Sticky-Notes.md) diff --git a/Packages/com.unity.shadergraph/Documentation~/TableOfContents.md b/Packages/com.unity.shadergraph/Documentation~/TableOfContents.md index 03a0c6fdc7c..b864b3cbdbe 100644 --- a/Packages/com.unity.shadergraph/Documentation~/TableOfContents.md +++ b/Packages/com.unity.shadergraph/Documentation~/TableOfContents.md @@ -4,18 +4,17 @@ * [Install Shader Graph](install-shader-graph.md) * [Upgrade to Shader Graph 10.0.x](Upgrade-Guide-10-0-x.md) * [Get started with Shader Graph](Getting-Started.md) - * [Creating a new Shader Graph Asset](Create-Shader-Graph.md) - * [My first Shader Graph](First-Shader-Graph.md) - * [Create a new shader graph from a template](create-shader-graph-template.md) + * [Create a shader graph asset](Create-Shader-Graph.md) + * [Add and connect nodes](Create-Node-Menu.md) + * [Create a shader graph and use it with a material](First-Shader-Graph.md) * [Shader Graph UI reference](ui-reference.md) * [Shader Graph template browser](template-browser.md) * [Shader Graph Window](Shader-Graph-Window.md) - * [Blackboard](Blackboard.md) + * [Master Stack](Master-Stack.md) * [Main Preview](Main-Preview.md) + * [Blackboard](Blackboard.md) * [Graph Inspector](Internal-Inspector.md) - * [Create Node Menu](Create-Node-Menu.md) - * [Graph Settings Tab](Graph-Settings-Tab.md) - * [Master Stack](Master-Stack.md) + * [Graph Settings Tab](Graph-Settings-Tab.md) * [Shader Graph Preferences](Shader-Graph-Preferences.md) * [Shader Graph Project Settings](Shader-Graph-Project-Settings.md) * [Shader Graph Keyboard Shortcuts](Keyboard-shortcuts.md) @@ -317,8 +316,10 @@ * [Parallax Mapping](Parallax-Mapping-Node.md) * [Parallax Occlusion Mapping](Parallax-Occlusion-Mapping-Node.md) * [Block Nodes](Block-Node.md) - * [Built In Blocks](Built-In-Blocks.md) - * [Terrain Texture](Terrain-Texture-Node.md) + * [Built In Blocks](Built-In-Blocks.md) + * [Terrain](Terrain-Nodes.md) + * [Terrain Properties](Terrain-Properties-Node.md) + * [Terrain Texture](Terrain-Texture-Node.md) * [Samples](ShaderGraph-Samples.md) * [Feature Examples](Shader-Graph-Sample-Feature-Examples.md) * [Production Ready Shaders](Shader-Graph-Sample-Production-Ready.md) diff --git a/Packages/com.unity.shadergraph/Documentation~/Terrain-Nodes.md b/Packages/com.unity.shadergraph/Documentation~/Terrain-Nodes.md new file mode 100644 index 00000000000..5f1502c0750 --- /dev/null +++ b/Packages/com.unity.shadergraph/Documentation~/Terrain-Nodes.md @@ -0,0 +1,6 @@ +# Terrain nodes + +| Topic | Description | +| :--- | :--- | +| **[Terrain Properties](Terrain-Properties-Node.md)** | Input properties from the actively rendered Terrain into the Contexts of a Terrain Lit shader graph. | +| **[Terrain Texture](Terrain-Texture-Node.md)** | Sample textures, masks and other properties from the Terrain Layers of a terrain material, adjust them, and input them into the Contexts of a Terrain Lit shader graph. | diff --git a/Packages/com.unity.shadergraph/Documentation~/Terrain-Properties-Node.md b/Packages/com.unity.shadergraph/Documentation~/Terrain-Properties-Node.md new file mode 100644 index 00000000000..a836928e51e --- /dev/null +++ b/Packages/com.unity.shadergraph/Documentation~/Terrain-Properties-Node.md @@ -0,0 +1,15 @@ +# Terrain Properties Node + +## Description + +Use the Terrain Properties node to input properties from the actively rendered Terrain into the Contexts of a Terrain Lit shader graph. + +The Terrain Properties node is compatible only with Terrain Lit shader graphs. You can't use it with other types of shaders. + +## Ports + +| Name | Direction | Type | Description | +|:-----------------|:-----------------|:------------|:-------------| +| Max Local Height | Output | float | The maximum local height stored in the Terrain heightmap. Unlike the actual values stored in the heightmap, this is not a normalized value. | +| Basemap Distance | Output | float | The basemap distance as set in the Terrain's settings. | +| Layers Count | Output | uint | The number of Terrain Layers assigned to the Terrain. | diff --git a/Packages/com.unity.shadergraph/Documentation~/create-shader-graph-template.md b/Packages/com.unity.shadergraph/Documentation~/create-shader-graph-template.md deleted file mode 100644 index 5e791693749..00000000000 --- a/Packages/com.unity.shadergraph/Documentation~/create-shader-graph-template.md +++ /dev/null @@ -1,20 +0,0 @@ -# Create a new shader graph from a template - -To create a new shader graph from a template, follow these steps: - -1. In the **Project** window, right-click and select **Create** > **Shader Graph** > **From Template**. - - The [template browser](template-browser.md) opens. - -1. Select the desired template and click **Create**. - - Unity creates a new shader graph asset in your project. - -1. Name the shader graph asset. - -You can now edit the graph in the [Shader Graph window](Shader-Graph-Window.md). - -## Additional resources - -* [Shader Graph template browser](template-browser.md) -* [Create a custom shader graph template](template-browser.md#create-a-custom-shader-graph-template) diff --git a/Packages/com.unity.shadergraph/Documentation~/images/Blackboard.png b/Packages/com.unity.shadergraph/Documentation~/images/Blackboard.png deleted file mode 100644 index d640d95c4bf..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/Blackboard.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/Inspector.png b/Packages/com.unity.shadergraph/Documentation~/images/Inspector.png deleted file mode 100644 index d84f421f3e1..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/Inspector.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/MainPreview.png b/Packages/com.unity.shadergraph/Documentation~/images/MainPreview.png deleted file mode 100644 index 58aeed8c6d5..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/MainPreview.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_01.png b/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_01.png deleted file mode 100644 index 592e811dcc9..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_01.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_02.png b/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_02.png deleted file mode 100644 index 04fc3b16446..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_02.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_03.png b/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_03.png deleted file mode 100644 index db0ba8f5099..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_03.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_04.png b/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_04.png deleted file mode 100644 index bf11c53a696..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_04.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_05.png b/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_05.png deleted file mode 100644 index 4aa103b2bca..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_05.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_06.png b/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_06.png deleted file mode 100644 index 02105363417..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_06.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_07.png b/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_07.png deleted file mode 100644 index ebe636f976e..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_07.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_08.png b/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_08.png deleted file mode 100644 index b3029961798..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_08.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_09.png b/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_09.png deleted file mode 100644 index 6b595db6f84..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_09.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_10.png b/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_10.png deleted file mode 100644 index 4a5591fd796..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_10.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_11.png b/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_11.png deleted file mode 100644 index 720ce333461..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_11.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/ShaderGraphWindow.png b/Packages/com.unity.shadergraph/Documentation~/images/ShaderGraphWindow.png index 2f1479a1849..c505be42269 100644 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/ShaderGraphWindow.png and b/Packages/com.unity.shadergraph/Documentation~/images/ShaderGraphWindow.png differ diff --git a/Packages/com.unity.shadergraph/Documentation~/ui-reference.md b/Packages/com.unity.shadergraph/Documentation~/ui-reference.md index 4abf26114eb..00e36e1dac8 100644 --- a/Packages/com.unity.shadergraph/Documentation~/ui-reference.md +++ b/Packages/com.unity.shadergraph/Documentation~/ui-reference.md @@ -5,14 +5,11 @@ Explore the main user interface elements you need to know to create and configur | Topic | Description | | :--- | :--- | | [Shader Graph template browser](template-browser.md) | Browse the list of available templates to create your shader graphs from. | -| [Shader Graph Window](Shader-Graph-Window.md) | Display and edit your shader graph assets in Unity, including the Blackboard, the Main Preview, and the Graph Inspector. | -| [Create Node Menu](Create-Node-Menu.md) | Create nodes in your graph and create block nodes in the Master Stack. | -| [Graph Settings Tab](Graph-Settings-Tab.md) | Change settings that affect your shader graph as a whole. | -| [Master Stack](Master-Stack.md) | Explore the end point of a shader graph, which defines the final surface appearance of a shader. | +| [Shader Graph Window](Shader-Graph-Window.md) | Display and edit your shader graph assets in Unity, including the [Master Stack](Master-Stack.md), the [Main Preview](Main-Preview.md), the [Blackboard](Blackboard.md), and the [Graph Inspector](Internal-Inspector.md). | | [Shader Graph Preferences](Shader-Graph-Preferences.md) | Define shader graph settings for your system. | | [Shader Graph Project Settings](Shader-Graph-Project-Settings.md) | Define shader graph settings for your entire project. | | [Shader Graph Keyboard Shortcuts](Keyboard-shortcuts.md) | Use keyboard shortcuts to work more efficiently when you're using Shader Graph. | ## Additional resources -* [Node Library](Node-Library.md) \ No newline at end of file +* [Node Library](Node-Library.md) diff --git a/Packages/com.unity.shadergraph/Editor/Data/Graphs/VirtualTextureShaderProperty.cs b/Packages/com.unity.shadergraph/Editor/Data/Graphs/VirtualTextureShaderProperty.cs index 3537a87b587..4c654ea1e87 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Graphs/VirtualTextureShaderProperty.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Graphs/VirtualTextureShaderProperty.cs @@ -207,9 +207,10 @@ internal void AddTextureInfo(List infos) var textureInfo = new PropertyCollector.TextureInfo { name = layerRefName, - textureId = texture != null ? texture.GetInstanceID() : 0, + textureId = texture != null ? texture.GetEntityId() : EntityId.None, dimension = texture != null ? texture.dimension : UnityEngine.Rendering.TextureDimension.Any, - modifiable = true + modifiable = true, + generatePropertyBlock = generatePropertyBlock }; infos.Add(textureInfo); } diff --git a/Packages/com.unity.shadergraph/Editor/Data/Nodes/Input/Scene/SceneDepthDifferenceNode.cs b/Packages/com.unity.shadergraph/Editor/Data/Nodes/Input/Scene/SceneDepthDifferenceNode.cs index d604aa8d563..fc43a092ad7 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Nodes/Input/Scene/SceneDepthDifferenceNode.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Nodes/Input/Scene/SceneDepthDifferenceNode.cs @@ -56,12 +56,12 @@ protected override MethodInfo GetFunctionToConvert() static string Unity_SceneDepthDifference_Linear01( [Slot(0, Binding.None, ShaderStageCapability.Fragment)] out Vector1 Out, [Slot(1, Binding.ScreenPosition)] Vector2 SceneUV, - [Slot(2, Binding.WorldSpacePosition)] Vector2 PositionWS) + [Slot(2, Binding.ViewSpacePosition)] Vector2 PositionVS) { return @" { - $precision dist = Remap01(length(PositionWS), _ProjectionParams.y, _ProjectionParams.z); + $precision dist = Remap01(length(PositionVS), _ProjectionParams.y, _ProjectionParams.z); #if defined(UNITY_REVERSED_Z) Out = Linear01Depth(SHADERGRAPH_SAMPLE_SCENE_DEPTH(SceneUV.xy), _ZBufferParams) - dist; #else @@ -74,12 +74,12 @@ static string Unity_SceneDepthDifference_Linear01( static string Unity_SceneDepthDifference_Raw( [Slot(0, Binding.None, ShaderStageCapability.Fragment)] out Vector1 Out, [Slot(1, Binding.ScreenPosition)] Vector2 SceneUV, - [Slot(2, Binding.WorldSpacePosition)] Vector3 PositionWS) + [Slot(2, Binding.ViewSpacePosition)] Vector3 PositionVS) { return @" { - $precision deviceDepth = ComputeNormalizedDeviceCoordinatesWithZ(PositionWS, GetWorldToHClipMatrix()).z; + $precision deviceDepth = ComputeNormalizedDeviceCoordinatesWithZ(PositionVS, GetWorldToHClipMatrix()).z; #if defined(UNITY_REVERSED_Z) Out = deviceDepth - SHADERGRAPH_SAMPLE_SCENE_DEPTH(SceneUV.xy); #else @@ -92,7 +92,7 @@ static string Unity_SceneDepthDifference_Raw( static string Unity_SceneDepthDifference_Eye( [Slot(0, Binding.None, ShaderStageCapability.Fragment)] out Vector1 Out, [Slot(1, Binding.ScreenPosition)] Vector2 SceneUV, - [Slot(2, Binding.WorldSpacePosition)] Vector3 PositionWS) + [Slot(2, Binding.ViewSpacePosition)] Vector3 PositionVS) { return @" @@ -100,17 +100,17 @@ static string Unity_SceneDepthDifference_Eye( if (IsPerspectiveProjection()) { #if defined(UNITY_REVERSED_Z) - Out = LinearEyeDepth(ComputeWorldSpacePosition(SceneUV.xy, SHADERGRAPH_SAMPLE_SCENE_DEPTH(SceneUV.xy), UNITY_MATRIX_I_VP), UNITY_MATRIX_V) - length(PositionWS); + Out = LinearEyeDepth(ComputeWorldSpacePosition(SceneUV.xy, SHADERGRAPH_SAMPLE_SCENE_DEPTH(SceneUV.xy), UNITY_MATRIX_I_VP), UNITY_MATRIX_V) - length(PositionVS); #else - Out = length(PositionWS) - LinearEyeDepth(ComputeWorldSpacePosition(SceneUV.xy, SHADERGRAPH_SAMPLE_SCENE_DEPTH(SceneUV.xy), UNITY_MATRIX_I_VP), UNITY_MATRIX_V); + Out = length(PositionVS) - LinearEyeDepth(ComputeWorldSpacePosition(SceneUV.xy, SHADERGRAPH_SAMPLE_SCENE_DEPTH(SceneUV.xy), UNITY_MATRIX_I_VP), UNITY_MATRIX_V); #endif } else { #if defined(UNITY_REVERSED_Z) - Out = LinearEyeDepth(SHADERGRAPH_SAMPLE_SCENE_DEPTH(SceneUV.xy), _ZBufferParams) - length(PositionWS); + Out = LinearEyeDepth(SHADERGRAPH_SAMPLE_SCENE_DEPTH(SceneUV.xy), _ZBufferParams) - length(PositionVS); #else - Out = length(PositionWS) - LinearEyeDepth(SHADERGRAPH_SAMPLE_SCENE_DEPTH(SceneUV.xy), _ZBufferParams); + Out = length(PositionVS) - LinearEyeDepth(SHADERGRAPH_SAMPLE_SCENE_DEPTH(SceneUV.xy), _ZBufferParams); #endif } } @@ -129,7 +129,7 @@ bool IMayRequireScreenPosition.RequiresScreenPosition(ShaderStageCapability stag NeededCoordinateSpace IMayRequirePosition.RequiresPosition(ShaderStageCapability stageCapability) { - return NeededCoordinateSpace.World; + return NeededCoordinateSpace.View; } } } diff --git a/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/DefaultBitmapTextNode.cs b/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/DefaultBitmapTextNode.cs index 709bb00d708..2d8e4e4b3ef 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/DefaultBitmapTextNode.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/DefaultBitmapTextNode.cs @@ -35,7 +35,7 @@ public void GenerateNodeCode(ShaderStringBuilder sb, GenerationMode generationMo sb.AppendLine("float4 {0} = float4(1, 1, 0, 1);", outputVarName); - sb.AppendLine("[branch] if (_UIE_RENDER_TYPE_TEXT || _UIE_RENDER_TYPE_ANY && round(IN.typeTexSettings.x) == k_FragTypeBitmapText)"); + sb.AppendLine("[branch] if ((_UIE_RENDER_TYPE_TEXT || _UIE_RENDER_TYPE_ANY) && round(IN.typeTexSettings.x) == k_FragTypeText && (!(GetTextureInfo(IN.typeTexSettings.y).sdfScale > 0.0)))"); using (sb.BlockScope()) { bool hasTint = GetInputNodeFromSlot(k_InputSlotIdTint) != null; @@ -43,6 +43,7 @@ public void GenerateNodeCode(ShaderStringBuilder sb, GenerationMode generationMo sb.AppendLine("Unity_UIE_EvaluateBitmapNode_Input.tint = {0};", hasTint ? GetSlotValue(k_InputSlotIdTint, generationMode) : "IN.color"); sb.AppendLine("Unity_UIE_EvaluateBitmapNode_Input.textureSlot = IN.typeTexSettings.y;"); sb.AppendLine("Unity_UIE_EvaluateBitmapNode_Input.uv = IN.uvClip.xy;"); + sb.AppendLine("Unity_UIE_EvaluateBitmapNode_Input.opacity = IN.typeTexSettings.z;"); sb.AppendLine("CommonFragOutput Unity_UIE_EvaluateBitmapNode_Output = uie_std_frag_bitmap_text(Unity_UIE_EvaluateBitmapNode_Input);"); sb.AppendLine("{0}.rgb = Unity_UIE_EvaluateBitmapNode_Output.color.rgb;", outputVarName); // To correctly apply the opacity we have to multiply the alpha values by the input color's alpha if input color is not used as the tint diff --git a/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/DefaultSDFTextNode.cs b/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/DefaultSDFTextNode.cs index b4665271ab9..8791c282b74 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/DefaultSDFTextNode.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/DefaultSDFTextNode.cs @@ -35,7 +35,7 @@ public void GenerateNodeCode(ShaderStringBuilder sb, GenerationMode generationMo sb.AppendLine("float4 {0} = float4(1, 1, 0, 1);", outputVarName); - sb.AppendLine("[branch] if ((_UIE_RENDER_TYPE_TEXT || _UIE_RENDER_TYPE_ANY) && round(IN.typeTexSettings.x) == k_FragTypeSdfText)"); + sb.AppendLine("[branch] if ((_UIE_RENDER_TYPE_TEXT || _UIE_RENDER_TYPE_ANY) && round(IN.typeTexSettings.x) == k_FragTypeText && (GetTextureInfo(IN.typeTexSettings.y).sdfScale > 0.0))"); using (sb.BlockScope()) { bool hasTint = GetInputNodeFromSlot(k_InputSlotIdTint) != null; diff --git a/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/RenderTypeBranchNode.cs b/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/RenderTypeBranchNode.cs index 6c2cffbc114..4d35f17f2fb 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/RenderTypeBranchNode.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/RenderTypeBranchNode.cs @@ -95,45 +95,50 @@ public void GenerateNodeCode(ShaderStringBuilder sb, GenerationMode generationMo sb.AppendLine("{0} = Unity_UIE_RenderTypeSwitchNode_Output.color.a;", outputVarNameAlpha); } } - sb.AppendLine("else [branch] if ((_UIE_RENDER_TYPE_TEXT || _UIE_RENDER_TYPE_ANY) && TestType(IN.typeTexSettings.x, k_FragTypeSdfText))"); + sb.AppendLine("else [branch] if ((_UIE_RENDER_TYPE_TEXT || _UIE_RENDER_TYPE_ANY) && TestType(IN.typeTexSettings.x, k_FragTypeText))"); using (sb.BlockScope()) { - if (GetInputNodeFromSlot(k_InputSlotIdSdfText) != null) + sb.AppendLine("[branch] if (GetTextureInfo(IN.typeTexSettings.y).sdfScale > 0.0)"); + using (sb.BlockScope()) { - sb.AppendLine("{0} = {1}.rgb;", outputVarNameColor, GetSlotValue(k_InputSlotIdSdfText, generationMode)); - sb.AppendLine("{0} = {1}.a;", outputVarNameAlpha, GetSlotValue(k_InputSlotIdSdfText, generationMode)); + if (GetInputNodeFromSlot(k_InputSlotIdSdfText) != null) + { + sb.AppendLine("{0} = {1}.rgb;", outputVarNameColor, GetSlotValue(k_InputSlotIdSdfText, generationMode)); + sb.AppendLine("{0} = {1}.a;", outputVarNameAlpha, GetSlotValue(k_InputSlotIdSdfText, generationMode)); + } + else + { + sb.AppendLine("SdfTextFragInput Unity_UIE_RenderTypeSwitchNode_SdfText_Input;"); + sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_SdfText_Input.tint = IN.color;"); + sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_SdfText_Input.textureSlot = IN.typeTexSettings.y;"); + sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_SdfText_Input.uv = IN.uvClip.xy;"); + sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_SdfText_Input.extraDilate = IN.circle.x;"); + sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_SdfText_Input.textCoreLoc = round(IN.textCoreLoc);"); + sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_SdfText_Input.opacity = IN.typeTexSettings.z;"); + sb.AppendLine("CommonFragOutput Unity_UIE_RenderTypeSwitchNode_Output = uie_std_frag_sdf_text(Unity_UIE_RenderTypeSwitchNode_SdfText_Input);"); + sb.AppendLine("{0} = Unity_UIE_RenderTypeSwitchNode_Output.color.rgb;", outputVarNameColor); + sb.AppendLine("{0} = Unity_UIE_RenderTypeSwitchNode_Output.color.a;", outputVarNameAlpha); + } } - else + sb.AppendLine("else"); + using (sb.BlockScope()) { - sb.AppendLine("SdfTextFragInput Unity_UIE_RenderTypeSwitchNode_SdfText_Input;"); - sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_SdfText_Input.tint = IN.color;"); - sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_SdfText_Input.textureSlot = IN.typeTexSettings.y;"); - sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_SdfText_Input.uv = IN.uvClip.xy;"); - sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_SdfText_Input.extraDilate = IN.circle.x;"); - sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_SdfText_Input.textCoreLoc = round(IN.textCoreLoc);"); - sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_SdfText_Input.opacity = IN.typeTexSettings.z;"); - sb.AppendLine("CommonFragOutput Unity_UIE_RenderTypeSwitchNode_Output = uie_std_frag_sdf_text(Unity_UIE_RenderTypeSwitchNode_SdfText_Input);"); - sb.AppendLine("{0} = Unity_UIE_RenderTypeSwitchNode_Output.color.rgb;", outputVarNameColor); - sb.AppendLine("{0} = Unity_UIE_RenderTypeSwitchNode_Output.color.a;", outputVarNameAlpha); - } - } - sb.AppendLine("else [branch] if (_UIE_RENDER_TYPE_TEXT || _UIE_RENDER_TYPE_ANY && TestType(IN.typeTexSettings.x, k_FragTypeBitmapText))"); - using (sb.BlockScope()) - { - if (GetInputNodeFromSlot(k_InputSlotIdBitmapText) != null) - { - sb.AppendLine("{0} = {1}.rgb;", outputVarNameColor, GetSlotValue(k_InputSlotIdBitmapText, generationMode)); - sb.AppendLine("{0} = {1}.a;", outputVarNameAlpha, GetSlotValue(k_InputSlotIdBitmapText, generationMode)); - } - else - { - sb.AppendLine("BitmapTextFragInput Unity_UIE_RenderTypeSwitchNode_BitmapText_Input;"); - sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_BitmapText_Input.tint = IN.color;"); - sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_BitmapText_Input.textureSlot = IN.typeTexSettings.y;"); - sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_BitmapText_Input.uv = IN.uvClip.xy;"); - sb.AppendLine("CommonFragOutput Unity_UIE_RenderTypeSwitchNode_Output = uie_std_frag_bitmap_text(Unity_UIE_RenderTypeSwitchNode_BitmapText_Input);"); - sb.AppendLine("{0} = Unity_UIE_RenderTypeSwitchNode_Output.color.rgb;", outputVarNameColor); - sb.AppendLine("{0} = Unity_UIE_RenderTypeSwitchNode_Output.color.a;", outputVarNameAlpha); + if (GetInputNodeFromSlot(k_InputSlotIdBitmapText) != null) + { + sb.AppendLine("{0} = {1}.rgb;", outputVarNameColor, GetSlotValue(k_InputSlotIdBitmapText, generationMode)); + sb.AppendLine("{0} = {1}.a;", outputVarNameAlpha, GetSlotValue(k_InputSlotIdBitmapText, generationMode)); + } + else + { + sb.AppendLine("BitmapTextFragInput Unity_UIE_RenderTypeSwitchNode_BitmapText_Input;"); + sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_BitmapText_Input.tint = IN.color;"); + sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_BitmapText_Input.textureSlot = IN.typeTexSettings.y;"); + sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_BitmapText_Input.uv = IN.uvClip.xy;"); + sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_BitmapText_Input.opacity = IN.typeTexSettings.z;"); + sb.AppendLine("CommonFragOutput Unity_UIE_RenderTypeSwitchNode_Output = uie_std_frag_bitmap_text(Unity_UIE_RenderTypeSwitchNode_BitmapText_Input);"); + sb.AppendLine("{0} = Unity_UIE_RenderTypeSwitchNode_Output.color.rgb;", outputVarNameColor); + sb.AppendLine("{0} = Unity_UIE_RenderTypeSwitchNode_Output.color.a;", outputVarNameAlpha); + } } } sb.AppendLine("else"); // k_FragTypeSvgGradient diff --git a/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/RenderTypeNode.cs b/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/RenderTypeNode.cs index 965f96a56b4..3aaed5f3bcf 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/RenderTypeNode.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/RenderTypeNode.cs @@ -41,8 +41,8 @@ public void GenerateNodeCode(ShaderStringBuilder sb, GenerationMode generationMo { sb.AppendLine("bool {0} = _UIE_RENDER_TYPE_SOLID || _UIE_RENDER_TYPE_ANY && round(IN.typeTexSettings.x) == k_FragTypeSolid;", GetVariableNameForSlot(k_OutputSlotIdSolid)); sb.AppendLine("bool {0} = _UIE_RENDER_TYPE_TEXTURE || _UIE_RENDER_TYPE_ANY && round(IN.typeTexSettings.x) == k_FragTypeTexture;", GetVariableNameForSlot(k_OutputSlotIdTexture)); - sb.AppendLine("bool {0} = (_UIE_RENDER_TYPE_TEXT || _UIE_RENDER_TYPE_ANY) && round(IN.typeTexSettings.x) == k_FragTypeSdfText;", GetVariableNameForSlot(k_OutputSlotIdSDFText)); - sb.AppendLine("bool {0} = (_UIE_RENDER_TYPE_TEXT || _UIE_RENDER_TYPE_ANY) && round(IN.typeTexSettings.x) == k_FragTypeBitmapText;", GetVariableNameForSlot(k_OutputSlotIdBitmapText)); + sb.AppendLine("bool {0} = (_UIE_RENDER_TYPE_TEXT || _UIE_RENDER_TYPE_ANY) && round(IN.typeTexSettings.x) == k_FragTypeText && (GetTextureInfo(IN.typeTexSettings.y).sdfScale > 0.0);", GetVariableNameForSlot(k_OutputSlotIdSDFText)); + sb.AppendLine("bool {0} = (_UIE_RENDER_TYPE_TEXT || _UIE_RENDER_TYPE_ANY) && round(IN.typeTexSettings.x) == k_FragTypeText && (!(GetTextureInfo(IN.typeTexSettings.y).sdfScale > 0.0));", GetVariableNameForSlot(k_OutputSlotIdBitmapText)); sb.AppendLine("bool {0} = _UIE_RENDER_TYPE_GRADIENT || _UIE_RENDER_TYPE_ANY && round(IN.typeTexSettings.x) == k_FragTypeSvgGradient;", GetVariableNameForSlot(k_OutputSlotIdGradient)); } diff --git a/Packages/com.unity.shadergraph/Editor/Drawing/PreviewManager.cs b/Packages/com.unity.shadergraph/Editor/Drawing/PreviewManager.cs index 464f339083a..5528667d9c6 100644 --- a/Packages/com.unity.shadergraph/Editor/Drawing/PreviewManager.cs +++ b/Packages/com.unity.shadergraph/Editor/Drawing/PreviewManager.cs @@ -102,7 +102,7 @@ void SetupUITKPanelSettings() m_PreviewElement.style.bottom = 16; root.Add(m_PreviewElement); m_PreviewShadedElement = m_PreviewElement.Q("shader"); - UIElementsUtility.RegisterCachedPanel(m_PreviewPanelSettings.GetInstanceID(), m_PreviewPanelSettings.panel); + UIElementsUtility.RegisterCachedPanel(m_PreviewPanelSettings.GetEntityId(), m_PreviewPanelSettings.panel); SetupUITKFonts(); } @@ -1517,7 +1517,7 @@ public void Dispose() if (m_PreviewPanelSettings != null) { - UIElementsUtility.RemoveCachedPanel(m_PreviewPanelSettings.GetInstanceID()); + UIElementsUtility.RemoveCachedPanel(m_PreviewPanelSettings.GetEntityId()); Object.DestroyImmediate(m_PreviewPanelSettings); m_PreviewPanelSettings = null; } diff --git a/Packages/com.unity.shadergraph/Editor/Generation/Contexts/TargetSetupContext.cs b/Packages/com.unity.shadergraph/Editor/Generation/Contexts/TargetSetupContext.cs index 8cff4b96b4e..5d6251c6938 100644 --- a/Packages/com.unity.shadergraph/Editor/Generation/Contexts/TargetSetupContext.cs +++ b/Packages/com.unity.shadergraph/Editor/Generation/Contexts/TargetSetupContext.cs @@ -59,7 +59,7 @@ public void AddKernel(KernelDescriptor kernel) kernels.Add(kernel); } - public void AddAssetDependency(GUID guid, AssetCollection.Flags flags) + public void AddAssetDependency(UnityEngine.GUID guid, AssetCollection.Flags flags) { assetCollection?.AddAssetDependency(guid, flags); } diff --git a/Packages/com.unity.shadergraph/Editor/Generation/Processors/Generator.cs b/Packages/com.unity.shadergraph/Editor/Generation/Processors/Generator.cs index d2d4dc4bfc9..06afc60c5ce 100644 --- a/Packages/com.unity.shadergraph/Editor/Generation/Processors/Generator.cs +++ b/Packages/com.unity.shadergraph/Editor/Generation/Processors/Generator.cs @@ -11,7 +11,7 @@ using UnityEngine.Rendering; using UnityEngine.Assertions; using Pool = UnityEngine.Pool; -using UnityEngine.Profiling; +using Unity.Profiling; namespace UnityEditor.ShaderGraph { @@ -33,6 +33,31 @@ struct GeneratedShader class Generator { + #region ProfileMarkers + static readonly ProfilerMarker s_profileGenerateShaderPass = new ProfilerMarker("GenerateShaderPass"); + static readonly ProfilerMarker s_profileCollectShaderKeywords = new ProfilerMarker("CollectShaderKeywords"); + static readonly ProfilerMarker s_profileGetCurrentTargetActiveBlocks = new ProfilerMarker("GetCurrentTargetActiveBlocks"); + static readonly ProfilerMarker s_profileProcessStackForPass = new ProfilerMarker("ProcessStackForPass"); + static readonly ProfilerMarker s_profileGetActiveFieldsFromUpstreamNodes = new ProfilerMarker("GetActiveFieldsFromUpstreamNodes"); + static readonly ProfilerMarker s_profileGetActiveFieldsFromPass = new ProfilerMarker("GetActiveFieldsFromPass"); + static readonly ProfilerMarker s_profilePropagateActiveFieldReqs = new ProfilerMarker("PropagateActiveFieldReqs"); + static readonly ProfilerMarker s_profileRenderState = new ProfilerMarker("RenderState"); + static readonly ProfilerMarker s_profilePragmas = new ProfilerMarker("Pragmas"); + static readonly ProfilerMarker s_profileKeywords = new ProfilerMarker("Keywords"); + static readonly ProfilerMarker s_profileStructsAndPacking = new ProfilerMarker("StructsAndPacking"); + static readonly ProfilerMarker s_profileStructTypes = new ProfilerMarker("StructTypes"); + static readonly ProfilerMarker s_profileGraphVertex = new ProfilerMarker("GraphVertex"); + static readonly ProfilerMarker s_profileGenerateVertexDescriptionStruct = new ProfilerMarker("GenerateVertexDescriptionStruct"); + static readonly ProfilerMarker s_profileGenerateVertexDescriptionFunction = new ProfilerMarker("GenerateVertexDescriptionFunction"); + static readonly ProfilerMarker s_profileGraphPixel = new ProfilerMarker("GraphPixel"); + static readonly ProfilerMarker s_profileGraphFunctions = new ProfilerMarker("GraphFunctions"); + static readonly ProfilerMarker s_profileGraphKeywords = new ProfilerMarker("GraphKeywords"); + static readonly ProfilerMarker s_profileGraphProperties = new ProfilerMarker("GraphProperties"); + static readonly ProfilerMarker s_profileGraphDefines = new ProfilerMarker("GraphDefines"); + static readonly ProfilerMarker s_profileProcessTemplate = new ProfilerMarker("ProcessTemplate"); + #endregion + + const string kDebugSymbol = "SHADERGRAPH_DEBUG"; // readonly data setup in constructor @@ -544,7 +569,7 @@ void GenerateShaderPass(int targetIndex, PassDescriptor pass, ActiveFields activ if (m_Mode == GenerationMode.Preview && !pass.useInPreview) return; - Profiler.BeginSample("GenerateShaderPass"); + using (s_profileGenerateShaderPass.Auto()) { // -------------------------------------------------- // Debug @@ -570,12 +595,11 @@ void GenerateShaderPass(int targetIndex, PassDescriptor pass, ActiveFields activ // NOTE: propertyCollector is not really used anymore -- we use the subshader PropertyCollector instead CustomInterpSubGen customInterpSubGen = new CustomInterpSubGen(m_OutputNode != null); - // Initiailize Collectors - Profiler.BeginSample("CollectShaderKeywords"); + // Initialize Collectors var propertyCollector = new PropertyCollector(); var keywordCollector = new KeywordCollector(); - m_GraphData.CollectShaderKeywords(keywordCollector, m_Mode); - Profiler.EndSample(); + using (s_profileCollectShaderKeywords.Auto()) + m_GraphData.CollectShaderKeywords(keywordCollector, m_Mode); // Get upstream nodes from ShaderPass port mask List vertexNodes; @@ -588,21 +612,19 @@ void GenerateShaderPass(int targetIndex, PassDescriptor pass, ActiveFields activ if (m_OutputNode == null) { // Update supported block list for current target implementation - Profiler.BeginSample("GetCurrentTargetActiveBlocks"); var activeBlockContext = new TargetActiveBlockContext(currentBlockDescriptors, pass); - m_Targets[targetIndex].GetActiveBlocks(ref activeBlockContext); - Profiler.EndSample(); + using (s_profileGetCurrentTargetActiveBlocks.Auto()) + m_Targets[targetIndex].GetActiveBlocks(ref activeBlockContext); void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlockMask, List nodeList, List slotList) { if (passBlockMask == null) { - Profiler.EndSample(); return; } - Profiler.BeginSample("ProcessStackForPass"); + using (s_profileProcessStackForPass.Auto()) foreach (var blockFieldDescriptor in passBlockMask) { // Mask blocks on active state @@ -632,7 +654,6 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo slotList.Add(block.FindSlot(0)); activeFields.baseInstance.Add(block.descriptor); } - Profiler.EndSample(); } // Mask blocks per pass @@ -674,11 +695,9 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo List[] pixelNodePermutations = new List[pixelNodes.Count]; // Get active fields from upstream Node requirements - Profiler.BeginSample("GetActiveFieldsFromUpstreamNodes"); ShaderGraphRequirementsPerKeyword graphRequirements; - GenerationUtils.GetActiveFieldsAndPermutationsForNodes(pass, keywordCollector, vertexNodes, pixelNodes, new bool[ShaderGeneratorNames.UVCount], - vertexNodePermutations, pixelNodePermutations, activeFields, out graphRequirements); - Profiler.EndSample(); + using(s_profileGetActiveFieldsFromUpstreamNodes.Auto()) + GenerationUtils.GetActiveFieldsAndPermutationsForNodes(pass, keywordCollector, vertexNodes, pixelNodes, new bool[ShaderGeneratorNames.UVCount], vertexNodePermutations, pixelNodePermutations, activeFields, out graphRequirements); // Moved this up so that we can reuse the information to figure out which struct Descriptors // should be populated by custom interpolators. @@ -691,9 +710,8 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo passStructs = customInterpSubGen.CopyModifyExistingPassStructs(passStructs, activeFields.baseInstance); // Get active fields from ShaderPass - Profiler.BeginSample("GetActiveFieldsFromPass"); - GenerationUtils.AddRequiredFields(pass.requiredFields, activeFields.baseInstance); - Profiler.EndSample(); + using (s_profileGetActiveFieldsFromPass.Auto()) + GenerationUtils.AddRequiredFields(pass.requiredFields, activeFields.baseInstance); // Function Registry var functionBuilder = new ShaderStringBuilder(humanReadable: m_HumanReadable); @@ -715,12 +733,11 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo // Propagate active field requirements using dependencies // Must be executed before types are built - Profiler.BeginSample("PropagateActiveFieldReqs"); + using(s_profilePropagateActiveFieldReqs.Auto()) foreach (var instance in activeFields.all.instances) { GenerationUtils.ApplyFieldDependencies(instance, pass.fieldDependencies); } - Profiler.EndSample(); // -------------------------------------------------- // Pass Setup @@ -749,7 +766,7 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo // Pass Code // Render State - Profiler.BeginSample("RenderState"); + using (s_profileRenderState.Auto()) using (var renderStateBuilder = new ShaderStringBuilder(humanReadable: m_HumanReadable)) { // Render states need to be separated by RenderState.Type @@ -777,9 +794,8 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo string command = GenerationUtils.GetSpliceCommand(renderStateBuilder.ToCodeBlock(), "RenderState"); spliceCommands.Add("RenderState", command); } - Profiler.EndSample(); // Pragmas - Profiler.BeginSample("Pragmas"); + using (s_profilePragmas.Auto()) using (var passPragmaBuilder = new ShaderStringBuilder(humanReadable: m_HumanReadable)) { if (pass.pragmas != null) @@ -801,9 +817,8 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo string command = GenerationUtils.GetSpliceCommand(passPragmaBuilder.ToCodeBlock(), "PassPragmas"); spliceCommands.Add("PassPragmas", command); } - Profiler.EndSample(); // Keywords - Profiler.BeginSample("Keywords"); + using (s_profileKeywords.Auto()) using (var passKeywordBuilder = new ShaderStringBuilder(humanReadable: m_HumanReadable)) { if (pass.keywords != null) @@ -821,7 +836,6 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo string command = GenerationUtils.GetSpliceCommand(passKeywordBuilder.ToCodeBlock(), "PassKeywords"); spliceCommands.Add("PassKeywords", command); } - Profiler.EndSample(); List originalPassStructs = new List(passStructs); @@ -830,9 +844,8 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo // ----------------------------- // Generated structs and Packing code - Profiler.BeginSample("StructsAndPacking"); var interpolatorBuilder = new ShaderStringBuilder(humanReadable: m_HumanReadable); - + using (s_profileStructsAndPacking.Auto()) { if (passStructs != null) { var packedStructs = new List(); @@ -893,11 +906,11 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo else interpolatorBuilder.AppendLine("//Interpolator Packs: "); spliceCommands.Add("InterpolatorPack", interpolatorBuilder.ToCodeBlock()); - Profiler.EndSample(); + } - // Generated String Builders for all struct types - Profiler.BeginSample("StructTypes"); + // Generated String Builders for all struct types var passStructBuilder = new ShaderStringBuilder(humanReadable: m_HumanReadable); + using (s_profileStructTypes.Auto()) { if (passStructs != null) { var structBuilder = new ShaderStringBuilder(humanReadable: m_HumanReadable); @@ -911,81 +924,78 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo if (passStructBuilder.length == 0) passStructBuilder.AppendLine("//Pass Structs: "); spliceCommands.Add("PassStructs", passStructBuilder.ToCodeBlock()); - Profiler.EndSample(); + } // Note: End of code copy/pasted into GeneratePassStructsAndInterpolators() in GeneratorDerivativeUtils.cs. // -------------------------------------------------- // Graph Vertex - Profiler.BeginSample("GraphVertex"); var vertexBuilder = new ShaderStringBuilder(humanReadable: m_HumanReadable); // If vertex modification enabled + using (s_profileGraphVertex.Auto()) { if (activeFields.baseInstance.Contains(Fields.GraphVertex) && vertexSlots != null) - { - // Setup - string vertexGraphInputName = "VertexDescriptionInputs"; - string vertexGraphOutputName = "VertexDescription"; - string vertexGraphFunctionName = "VertexDescriptionFunction"; - var vertexGraphFunctionBuilder = new ShaderStringBuilder(humanReadable: m_HumanReadable); - var vertexGraphOutputBuilder = new ShaderStringBuilder(humanReadable: m_HumanReadable); - - // Build vertex graph outputs - // Add struct fields to active fields - Profiler.BeginSample("GenerateVertexDescriptionStruct"); - GenerationUtils.GenerateVertexDescriptionStruct(vertexGraphOutputBuilder, vertexSlots, vertexGraphOutputName, activeFields.baseInstance); - Profiler.EndSample(); - - // Build vertex graph functions from ShaderPass vertex port mask - Profiler.BeginSample("GenerateVertexDescriptionFunction"); - GenerationUtils.GenerateVertexDescriptionFunction( - m_GraphData, - vertexGraphFunctionBuilder, - functionRegistry, - propertyCollector, - keywordCollector, - m_Mode, - m_OutputNode, - vertexNodes, - vertexNodePermutations, - vertexSlots, - vertexGraphInputName, - vertexGraphFunctionName, - vertexGraphOutputName); - Profiler.EndSample(); - - // Generate final shader strings - if (m_HumanReadable) - { - vertexBuilder.AppendLines(vertexGraphOutputBuilder.ToString()); - vertexBuilder.AppendNewLine(); - vertexBuilder.AppendLines(vertexGraphFunctionBuilder.ToString()); - } - else { - vertexBuilder.Append(vertexGraphOutputBuilder.ToString()); - vertexBuilder.AppendNewLine(); - vertexBuilder.Append(vertexGraphFunctionBuilder.ToString()); + // Setup + string vertexGraphInputName = "VertexDescriptionInputs"; + string vertexGraphOutputName = "VertexDescription"; + string vertexGraphFunctionName = "VertexDescriptionFunction"; + var vertexGraphFunctionBuilder = new ShaderStringBuilder(humanReadable: m_HumanReadable); + var vertexGraphOutputBuilder = new ShaderStringBuilder(humanReadable: m_HumanReadable); + + // Build vertex graph outputs + // Add struct fields to active fields + using(s_profileGenerateVertexDescriptionStruct.Auto()) + GenerationUtils.GenerateVertexDescriptionStruct(vertexGraphOutputBuilder, vertexSlots, vertexGraphOutputName, activeFields.baseInstance); + + // Build vertex graph functions from ShaderPass vertex port mask + using(s_profileGenerateVertexDescriptionFunction.Auto()) + GenerationUtils.GenerateVertexDescriptionFunction( + m_GraphData, + vertexGraphFunctionBuilder, + functionRegistry, + propertyCollector, + keywordCollector, + m_Mode, + m_OutputNode, + vertexNodes, + vertexNodePermutations, + vertexSlots, + vertexGraphInputName, + vertexGraphFunctionName, + vertexGraphOutputName); + + // Generate final shader strings + if (m_HumanReadable) + { + vertexBuilder.AppendLines(vertexGraphOutputBuilder.ToString()); + vertexBuilder.AppendNewLine(); + vertexBuilder.AppendLines(vertexGraphFunctionBuilder.ToString()); + } + else + { + vertexBuilder.Append(vertexGraphOutputBuilder.ToString()); + vertexBuilder.AppendNewLine(); + vertexBuilder.Append(vertexGraphFunctionBuilder.ToString()); + } } - } // Add to splice commands if (vertexBuilder.length == 0) vertexBuilder.AppendLine("// GraphVertex: "); spliceCommands.Add("GraphVertex", vertexBuilder.ToCodeBlock()); - Profiler.EndSample(); + } // -------------------------------------------------- // Graph Pixel - Profiler.BeginSample("GraphPixel"); // Setup string pixelGraphInputName = "SurfaceDescriptionInputs"; string pixelGraphOutputName = "SurfaceDescription"; string pixelGraphFunctionName = "SurfaceDescriptionFunction"; var pixelGraphOutputBuilder = new ShaderStringBuilder(humanReadable: m_HumanReadable); var pixelGraphFunctionBuilder = new ShaderStringBuilder(humanReadable: m_HumanReadable); - + using (s_profileGraphPixel.Auto()) { // Build pixel graph outputs // Add struct fields to active fields GenerationUtils.GenerateSurfaceDescriptionStruct(pixelGraphOutputBuilder, pixelSlots, pixelGraphOutputName, activeFields.baseInstance, m_OutputNode is SubGraphOutputNode, pass.virtualTextureFeedback); @@ -1020,18 +1030,18 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo pixelBuilder.AppendLine("// GraphPixel: "); spliceCommands.Add("GraphPixel", pixelBuilder.ToCodeBlock()); } - Profiler.EndSample(); + } // -------------------------------------------------- // Graph Functions - Profiler.BeginSample("GraphFunctions"); + using (s_profileGraphFunctions.Auto()) { if (functionBuilder.length == 0) functionBuilder.AppendLine("// GraphFunctions: "); spliceCommands.Add("GraphFunctions", functionBuilder.ToCodeBlock()); - Profiler.EndSample(); + } // -------------------------------------------------- // Graph Keywords - Profiler.BeginSample("GraphKeywords"); + using (s_profileGraphKeywords.Auto()) using (var keywordBuilder = new ShaderStringBuilder(humanReadable: m_HumanReadable)) { keywordCollector.GetKeywordsDeclaration(keywordBuilder, m_Mode); @@ -1039,11 +1049,10 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo keywordBuilder.AppendLine("// GraphKeywords: "); spliceCommands.Add("GraphKeywords", keywordBuilder.ToCodeBlock()); } - Profiler.EndSample(); // -------------------------------------------------- // Graph Properties - Profiler.BeginSample("GraphProperties"); + using (s_profileGraphProperties.Auto()) using (var propertyBuilder = new ShaderStringBuilder(humanReadable: m_HumanReadable)) { subShaderProperties.GetPropertiesDeclaration(propertyBuilder, m_Mode, m_GraphData.graphDefaultConcretePrecision); @@ -1065,12 +1074,11 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo if (propertyBuilder.length == 0) propertyBuilder.AppendLine("// GraphProperties: "); spliceCommands.Add("GraphProperties", propertyBuilder.ToCodeBlock()); - } - Profiler.EndSample(); + } // -------------------------------------------------- // Graph Defines - Profiler.BeginSample("GraphDefines"); + using(s_profileGraphDefines.Auto()) using (var graphDefines = new ShaderStringBuilder(humanReadable: m_HumanReadable)) { graphDefines.AppendLine("#define SHADERPASS {0}", pass.referenceName); @@ -1129,7 +1137,6 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo // Add to splice commands spliceCommands.Add("GraphDefines", graphDefines.ToCodeBlock()); } - Profiler.EndSample(); // -------------------------------------------------- // Includes @@ -1236,22 +1243,21 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo if (!File.Exists(passTemplatePath)) { - Profiler.EndSample(); + UnityEngine.Profiling.Profiler.EndSample(); // GenerateShaderPass return; } // Process Template - Profiler.BeginSample("ProcessTemplate"); var templatePreprocessor = new ShaderSpliceUtil.TemplatePreprocessor(activeFields, spliceCommands, isDebug, sharedTemplateDirectories, m_AssetCollection, m_HumanReadable, m_IncludeCache); - templatePreprocessor.ProcessTemplateFile(passTemplatePath); + using (s_profileProcessTemplate.Auto()) + templatePreprocessor.ProcessTemplateFile(passTemplatePath); m_Builder.Concat(templatePreprocessor.GetShaderCode()); - Profiler.EndSample(); // Turn off the skip flag so other passes behave correctly correctly. CustomInterpolatorUtils.generatorSkipFlag = false; CustomInterpolatorUtils.generatorNodeOnly = false; - Profiler.EndSample(); + } } } } diff --git a/Packages/com.unity.shadergraph/Editor/Generation/Processors/PropertyCollector.cs b/Packages/com.unity.shadergraph/Editor/Generation/Processors/PropertyCollector.cs index c4b63e3be8f..d0a96c4089e 100644 --- a/Packages/com.unity.shadergraph/Editor/Generation/Processors/PropertyCollector.cs +++ b/Packages/com.unity.shadergraph/Editor/Generation/Processors/PropertyCollector.cs @@ -15,6 +15,7 @@ public struct TextureInfo public EntityId textureId; public TextureDimension dimension; public bool modifiable; + public bool generatePropertyBlock; } bool m_ReadOnly; @@ -268,7 +269,8 @@ public List GetConfiguredTextures() name = prop.referenceName, textureId = prop.value.texture != null ? prop.value.texture.GetEntityId() : EntityId.None, dimension = TextureDimension.Tex2D, - modifiable = prop.modifiable + modifiable = prop.modifiable, + generatePropertyBlock = prop.generatePropertyBlock }; result.Add(textureInfo); } @@ -283,7 +285,8 @@ public List GetConfiguredTextures() name = prop.referenceName, textureId = prop.value.textureArray != null ? prop.value.textureArray.GetEntityId() : EntityId.None, dimension = TextureDimension.Tex2DArray, - modifiable = prop.modifiable + modifiable = prop.modifiable, + generatePropertyBlock = prop.generatePropertyBlock }; result.Add(textureInfo); } @@ -298,7 +301,8 @@ public List GetConfiguredTextures() name = prop.referenceName, textureId = prop.value.texture != null ? prop.value.texture.GetEntityId() : EntityId.None, dimension = TextureDimension.Tex3D, - modifiable = prop.modifiable + modifiable = prop.modifiable, + generatePropertyBlock = prop.generatePropertyBlock }; result.Add(textureInfo); } @@ -313,7 +317,8 @@ public List GetConfiguredTextures() name = prop.referenceName, textureId = prop.value.cubemap != null ? prop.value.cubemap.GetEntityId() : EntityId.None, dimension = TextureDimension.Cube, - modifiable = prop.modifiable + modifiable = prop.modifiable, + generatePropertyBlock = prop.generatePropertyBlock }; result.Add(textureInfo); } diff --git a/Packages/com.unity.shadergraph/Editor/Generation/Processors/ShaderSpliceUtil.cs b/Packages/com.unity.shadergraph/Editor/Generation/Processors/ShaderSpliceUtil.cs index c0f6b990065..e193eb18680 100644 --- a/Packages/com.unity.shadergraph/Editor/Generation/Processors/ShaderSpliceUtil.cs +++ b/Packages/com.unity.shadergraph/Editor/Generation/Processors/ShaderSpliceUtil.cs @@ -93,7 +93,7 @@ public void ProcessTemplateFile(string filePath) if (assetCollection != null) { - GUID guid = AssetDatabase.GUIDFromAssetPath(filePath); + UnityEngine.GUID guid = AssetDatabase.GUIDFromAssetPath(filePath); if (!guid.Empty()) assetCollection.AddAssetDependency(guid, AssetCollection.Flags.SourceDependency); } diff --git a/Packages/com.unity.shadergraph/Editor/Generation/ShaderGraphVfxAsset.cs b/Packages/com.unity.shadergraph/Editor/Generation/ShaderGraphVfxAsset.cs index b5eb5949896..6f348d985cd 100644 --- a/Packages/com.unity.shadergraph/Editor/Generation/ShaderGraphVfxAsset.cs +++ b/Packages/com.unity.shadergraph/Editor/Generation/ShaderGraphVfxAsset.cs @@ -95,7 +95,7 @@ internal ConcretePrecision concretePrecision internal void SetTextureInfos(IList textures) { - m_TextureInfos = textures.Select(t => new TextureInfo(t.name, EditorUtility.EntityIdToObject(t.textureId) as Texture, t.dimension)).ToArray(); + m_TextureInfos = textures.Where(t => t.generatePropertyBlock).Select(t => new TextureInfo(t.name, EditorUtility.EntityIdToObject(t.textureId) as Texture, t.dimension)).ToArray(); } internal void SetOutputs(OutputMetadata[] outputs) diff --git a/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Targets/BuiltInCanvasSubTarget.cs b/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Targets/BuiltInCanvasSubTarget.cs index 6edd68c89d0..4cd7e113e84 100644 --- a/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Targets/BuiltInCanvasSubTarget.cs +++ b/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Targets/BuiltInCanvasSubTarget.cs @@ -7,7 +7,7 @@ namespace UnityEditor.Rendering.BuiltIn.ShaderGraph { class BuiltInCanvasSubTarget : CanvasSubTarget, IRequiresData, IHasMetadata { - static readonly GUID kSourceCodeGuid = new GUID("5a0372ef872c4103b70866297bd45e38"); // BuiltInCanvasSubTarget.cs + static readonly UnityEngine.GUID kSourceCodeGuid = new UnityEngine.GUID("5a0372ef872c4103b70866297bd45e38"); // BuiltInCanvasSubTarget.cs static readonly string kCanvasPass = "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Includes/BuiltInCanvasPass.hlsl"; diff --git a/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Targets/BuiltInLitSubTarget.cs b/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Targets/BuiltInLitSubTarget.cs index 435ee5aeceb..f954343ebe3 100644 --- a/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Targets/BuiltInLitSubTarget.cs +++ b/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Targets/BuiltInLitSubTarget.cs @@ -4,7 +4,7 @@ using UnityEngine; using UnityEditor.ShaderGraph; using UnityEngine.Rendering; -using UnityEditor.UIElements; + using UnityEngine.UIElements; using UnityEditor.ShaderGraph.Legacy; using static UnityEditor.Rendering.BuiltIn.ShaderUtils; diff --git a/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Targets/BuiltInTarget.cs b/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Targets/BuiltInTarget.cs index 877431a8ea0..2b905f7ac66 100644 --- a/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Targets/BuiltInTarget.cs +++ b/Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Targets/BuiltInTarget.cs @@ -4,7 +4,7 @@ using UnityEngine; using UnityEngine.Rendering; using UnityEngine.UIElements; -using UnityEditor.UIElements; + using UnityEditor.ShaderGraph; using UnityEditor.ShaderGraph.Legacy; using UnityEditor.ShaderGraph.Serialization; diff --git a/Packages/com.unity.shadergraph/Editor/Generation/Targets/CustomRenderTexture/CustomRenderTextureTarget.cs b/Packages/com.unity.shadergraph/Editor/Generation/Targets/CustomRenderTexture/CustomRenderTextureTarget.cs index bbf736ef575..d822f5e3674 100644 --- a/Packages/com.unity.shadergraph/Editor/Generation/Targets/CustomRenderTexture/CustomRenderTextureTarget.cs +++ b/Packages/com.unity.shadergraph/Editor/Generation/Targets/CustomRenderTexture/CustomRenderTextureTarget.cs @@ -6,7 +6,7 @@ using UnityEngine.UIElements; using UnityEditor; using UnityEditor.ShaderGraph; -using UnityEditor.UIElements; + using UnityEditor.ShaderGraph.Serialization; using SubTargetListPool = UnityEngine.Rendering.ListPool; using System.Reflection; diff --git a/Packages/com.unity.shadergraph/Editor/Generation/Targets/CustomRenderTexture/CustomTextureSubTarget.cs b/Packages/com.unity.shadergraph/Editor/Generation/Targets/CustomRenderTexture/CustomTextureSubTarget.cs index a7fd1b68503..bbf75d1dcc3 100644 --- a/Packages/com.unity.shadergraph/Editor/Generation/Targets/CustomRenderTexture/CustomTextureSubTarget.cs +++ b/Packages/com.unity.shadergraph/Editor/Generation/Targets/CustomRenderTexture/CustomTextureSubTarget.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using UnityEditor; + using UnityEditor.ShaderGraph; using UnityEditor.ShaderGraph.Legacy; using UnityEngine; diff --git a/Packages/com.unity.shadergraph/Editor/Generation/Targets/Fullscreen/FullscreenSubTarget.cs b/Packages/com.unity.shadergraph/Editor/Generation/Targets/Fullscreen/FullscreenSubTarget.cs index 20f8f779eb7..fdf58da2805 100644 --- a/Packages/com.unity.shadergraph/Editor/Generation/Targets/Fullscreen/FullscreenSubTarget.cs +++ b/Packages/com.unity.shadergraph/Editor/Generation/Targets/Fullscreen/FullscreenSubTarget.cs @@ -6,7 +6,7 @@ using BlendMode = UnityEngine.Rendering.BlendMode; using BlendOp = UnityEditor.ShaderGraph.BlendOp; using UnityEngine.UIElements; -using UnityEditor.UIElements; + using UnityEngine.Rendering; namespace UnityEditor.Rendering.Fullscreen.ShaderGraph diff --git a/Packages/com.unity.shadergraph/Editor/Importers/ShaderGraphTemplateHelper.cs b/Packages/com.unity.shadergraph/Editor/Importers/ShaderGraphTemplateHelper.cs index dcd8c508c17..0ad2212d83f 100644 --- a/Packages/com.unity.shadergraph/Editor/Importers/ShaderGraphTemplateHelper.cs +++ b/Packages/com.unity.shadergraph/Editor/Importers/ShaderGraphTemplateHelper.cs @@ -34,6 +34,8 @@ public string OpenSaveFileDialog() public GraphViewTemplateWindow.ISaveFileDialogHelper saveFileDialogHelper { get; set; } = new SaveFileDialog(); + public void RaiseImportSampleDependencies(PackageManager.PackageInfo packageInfo, PackageManager.UI.Sample sample) { } + public void RaiseTemplateUsed(GraphViewTemplateDescriptor usedTemplate) => ShaderGraphAnalytics.SendShaderGraphTemplateEvent(usedTemplate); diff --git a/Packages/com.unity.shadergraph/Editor/Util/CompatibilityExtensions.cs b/Packages/com.unity.shadergraph/Editor/Util/CompatibilityExtensions.cs index 0ffc11a52e2..0404077df81 100644 --- a/Packages/com.unity.shadergraph/Editor/Util/CompatibilityExtensions.cs +++ b/Packages/com.unity.shadergraph/Editor/Util/CompatibilityExtensions.cs @@ -7,45 +7,15 @@ namespace UnityEditor.ShaderGraph.Drawing { static class CompatibilityExtensions { -#if !UNITY_2018_3_OR_NEWER - public static void MarkDirtyRepaint(this VisualElement element) - { - element.Dirty(ChangeType.Repaint); - } - -#endif - -#if !UNITY_2018_3_OR_NEWER - public static void CaptureMouse(this VisualElement element) - { - element.TakeMouseCapture(); - } - - public static void ReleaseMouse(this VisualElement element) - { - element.ReleaseMouseCapture(); - } - -#endif - public static void OnToggleChanged(this Toggle toggle, EventCallback> callback) { -#if UNITY_2018_3_OR_NEWER toggle.RegisterValueChangedCallback(callback); -#else - toggle.OnToggle(() => callback(ChangeEvent.GetPooled(!toggle.value, toggle.value))); -#endif } } static class TrickleDownEnum { -#if UNITY_2018_3_OR_NEWER public static readonly TrickleDown NoTrickleDown = TrickleDown.NoTrickleDown; public static readonly TrickleDown TrickleDown = TrickleDown.TrickleDown; -#else - public static readonly Capture NoTrickleDown = Capture.NoCapture; - public static readonly Capture TrickleDown = Capture.Capture; -#endif } } diff --git a/Packages/com.unity.shadergraph/package.json b/Packages/com.unity.shadergraph/package.json index 069448c4bbf..c2959a0f529 100644 --- a/Packages/com.unity.shadergraph/package.json +++ b/Packages/com.unity.shadergraph/package.json @@ -1,11 +1,11 @@ { "name": "com.unity.shadergraph", "description": "The Shader Graph package adds a visual Shader editing tool to Unity. You can use this tool to create Shaders in a visual way instead of writing code. Specific render pipelines can implement specific graph features. Currently, both the High Definition Rendering Pipeline and the Universal Rendering Pipeline support Shader Graph.", - "version": "17.4.0", - "unity": "6000.4", + "version": "17.5.0", + "unity": "6000.5", "displayName": "Shader Graph", "dependencies": { - "com.unity.render-pipelines.core": "17.4.0", + "com.unity.render-pipelines.core": "17.5.0", "com.unity.searcher": "4.9.3" }, "samples": [ diff --git a/Packages/com.unity.visualeffectgraph/CHANGELOG.md b/Packages/com.unity.visualeffectgraph/CHANGELOG.md index c096bea1224..71e114a10a1 100644 --- a/Packages/com.unity.visualeffectgraph/CHANGELOG.md +++ b/Packages/com.unity.visualeffectgraph/CHANGELOG.md @@ -10,6 +10,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. Version Updated The version number for this package has increased due to a version update of a related graphics package. +## [17.4.0] - 2025-10-22 + +This version is compatible with Unity 6000.4.0a4. +For the release notes, refer to the [Unity download archive](https://unity.com/releases/editor/archive). + ## [17.3.0] - 2025-08-27 This version is compatible with Unity 6000.3.0b1. diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Blocks.md b/Packages/com.unity.visualeffectgraph/Documentation~/Blocks.md index 1484f6b0e0c..faa75d66170 100644 --- a/Packages/com.unity.visualeffectgraph/Documentation~/Blocks.md +++ b/Packages/com.unity.visualeffectgraph/Documentation~/Blocks.md @@ -43,10 +43,18 @@ Blocks are essentially Nodes that have a different workflow logic. Blocks are al ## Configuring Blocks -To change the way that the Block looks and behaves, adjust the Block's [Settings](GraphLogicAndPhilosophy.md#settings) in the Node UI or the Inspector. +To change how the Block looks and behaves, adjust the Block's [Settings](GraphLogicAndPhilosophy.md#settings) in the Node UI or the Inspector. For example, if, in the Inspector, you change the Composition Settings of a **Set Velocity** Block from **Overwrite** to **Blend**, this changes the title of the Node to **Blend Velocity** and adds a **Blend** property to the Node UI. +Some Block inputs, such as **Transform**, **Vector**, **Direction**, and **Position**, are [Spaceable Properties](Properties.md#spaceable-properties). Use the dropdown to select the coordinate space in which VFX Graph interprets the values of the Block inputs. VFX Graph automatically converts the value from the selected space to the System's space. If you select **None**, or if both spaces are the same, VFX Graph doesn't perform any conversion. + +![Spaceable Properties dropdown icon: globe (world space), 3D cube (local space), and circle with minus sign (system space)](images/spaceable-properties-dropdown-icon.png) + +**Spaceable Properties dropdown icon** + +For example, a Position type has a Vector3 value and a Spaceable Property. If you set the Spaceable Property to Local [0,1,0], you're referring to the 0,1,0 value in local space. + ## Activation port In addition to its [property](Properties.md) ports, a Block has a special port called the activation port. It is located on the top left of a Block, next to its name. diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/spaceable-properties-dropdown-icon.png b/Packages/com.unity.visualeffectgraph/Documentation~/Images/spaceable-properties-dropdown-icon.png new file mode 100644 index 00000000000..02e793a876c Binary files /dev/null and b/Packages/com.unity.visualeffectgraph/Documentation~/Images/spaceable-properties-dropdown-icon.png differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Properties.md b/Packages/com.unity.visualeffectgraph/Documentation~/Properties.md index 873e21a49f4..c0062343ceb 100644 --- a/Packages/com.unity.visualeffectgraph/Documentation~/Properties.md +++ b/Packages/com.unity.visualeffectgraph/Documentation~/Properties.md @@ -47,13 +47,9 @@ To access components in a script, add an underscore before the component name. F ### Spaceable Properties -Spaceable Properties are Property Types that carry **Space information** (Local/World) with its value. This information is used by the graph to perform automatic space transformations when required. +Spaceable Properties are Property Types that carry **Space information** (Local/World) with their values. The VFX Graph uses this information to perform automatic space transformations when required. -Click on the Space Modifier to the left of the Property Field to change it. - -For Example, a Position type carries a Vector3 value and a Spaceable Property. If you set the Spaceable Property to Local [0,1,0], this tells the graph that we refer to the 0,1,0 value in local space. - -Depending on the [System Simulation Space](Systems.md#system-spaces), the value will be automatically transformed to the simulation space if required. +Depending on the [System Simulation Space](Systems.md#system-spaces), the value is automatically transformed to the simulation space if required. > [!TIP] > You can use the Change Space Operator to manually change a Property Space. diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Systems.md b/Packages/com.unity.visualeffectgraph/Documentation~/Systems.md index 8b438bd79fd..5fc168353ec 100644 --- a/Packages/com.unity.visualeffectgraph/Documentation~/Systems.md +++ b/Packages/com.unity.visualeffectgraph/Documentation~/Systems.md @@ -19,14 +19,17 @@ Some Systems use a simulation space property to define the reference space that * **Local space** Systems simulate the effect locally to the GameObject that holds the [Visual Effect component](VisualEffectComponent.md). * **World space** Systems simulate the effect independently of the GameObject that holds the [Visual Effect component](VisualEffectComponent.md). -Regardless of the System's simulation space, you can use [Spaceable Properties](Properties.md#spaceable-properties) to access Local or World Values. +A VFX System runs in either World or Local space. You set this coordinate space in the Inspector of any context in the system. Changing the space on one context updates it for the whole system. VFX Graph interprets all attributes and operations in this space. ### Setting a System simulation space A System displays its simulation space in the top-right corner of each Context it consists of. This is the System's **simulation space identifier**. The word "Local" in a rounded box stands for "Local space", and the word "World" in a rounded box stands for "World space". If a Context does not use process anything that depends on simulation space, it does not display the simulation space identifier. -To change the simulation space for a System, click the System's simulation space identifier to cycle through the compatible spaces. +To change the simulation space for a System, click the System's simulation space identifier to cycle through the compatible spaces. Because the System space is shared, changing the space on any of its Contexts updates the space for the entire System. ### Simulation space identifiers in Properties -Some [Spaceable Properties](Properties.md) display a smaller version of the simulation space identifier. An "L" in a rounded box stands for "Local space", and a "W" in a rounded box stands for "World space". This does not change the System's simulation space, but instead allows you to express a value in a space that is different from the System's simulation space. For example, a System could simulate in world space but a Property could be a local position. +You can use [Spaceable Properties](Properties.md#spaceable-properties) to select the coordinate space in which VFX Graph interprets the inputs. You can [set spaceable block inputs](Blocks.md) to **Local**, **World**, or **None**: + +- If you select **Local** or **World**, the VFX Graph converts the value from its input space to the System’s space. +- If you select **None**, the value is used as‑is, relative to the System’s current space. diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/TableOfContents.md b/Packages/com.unity.visualeffectgraph/Documentation~/TableOfContents.md index bb93a54f5ce..802734e35e1 100644 --- a/Packages/com.unity.visualeffectgraph/Documentation~/TableOfContents.md +++ b/Packages/com.unity.visualeffectgraph/Documentation~/TableOfContents.md @@ -58,10 +58,10 @@ * [Spawner Callbacks](SpawnerCallbacks.md) * [Realistic smoke lighting](six-way-lighting-landing.md) * [Realistic smoke lighting with six-way lighting](six-way-lighting.md) - * [Use tools to generate six-way lightmap textures](use-tools-generate-six-way-lightmap-textures.md) + * [Generate six-way lightmap textures for visual effects](use-tools-generate-six-way-lightmap-textures.md) * [Import six-way lightmap textures into unity](import-six-way-lightmap-textures-unity.md) - * [Create and configure a six-way lit particle system](create-configure-six-way-lit-particle-system.md) - * [Customize free six-way lighting lightmap textures](create-effects-with-six-way-lighting.md) + * [Create a six-way lit particle system in Visual Effect Graph](create-configure-six-way-lit-particle-system.md) + * [Customize existing six-way lightmap textures](create-effects-with-six-way-lighting.md) * [Six-way smoke lit reference](six-way-lighting-reference.md) * [Node Library](node-library.md) * [Context](Context.md) @@ -97,7 +97,7 @@ * [Collision Depth Buffer](Block-CollideWithDepthBuffer.md) * [Kill Shape](Block-KillShape.md) * [Trigger Shape](Block-TriggerShape.md) - * [Flipbook Player](Block-FlipbookPlayer.md) + * [Flipbook Player](Block-FlipbookPlayer.md) * [Force](Force.md) * [Attractor Shape Signed Distance Field](Block-ConformToSignedDistanceField.md) * [Attractor Shape Sphere](Block-ConformToSphere.md) diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/sg-working-with.md b/Packages/com.unity.visualeffectgraph/Documentation~/sg-working-with.md index 897f48c345f..e1b719d9fd1 100644 --- a/Packages/com.unity.visualeffectgraph/Documentation~/sg-working-with.md +++ b/Packages/com.unity.visualeffectgraph/Documentation~/sg-working-with.md @@ -94,7 +94,7 @@ Shader Graph does not support some features in specific Targets. - [Fog Volume Shader Graph](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest?subfolder=/manual/fog-volume-master-stack-reference.html) - [Motion vectors](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest?subfolder=/manual/Motion-Vectors.html) for vertex animation. - The URP does not support the following: - - [Decal Shader Graph](https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@latest?subfolder=/manual/decal-shader.html. + - [Decal Shader Graph](https://docs.unity3d.com/Documentation/Manual/urp/prebuilt-shader-graphs-urp-decal.html) - The Visual Effect Target (deprecated) does not support: - HDRP or Universal material types. - Access to the shader's Vertex stage. diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/six-way-lighting-landing.md b/Packages/com.unity.visualeffectgraph/Documentation~/six-way-lighting-landing.md index 99e733cb2d4..9cba768bb52 100644 --- a/Packages/com.unity.visualeffectgraph/Documentation~/six-way-lighting-landing.md +++ b/Packages/com.unity.visualeffectgraph/Documentation~/six-way-lighting-landing.md @@ -5,10 +5,11 @@ Implement custom lighting models to have more control over the visual style of s | Page | Description | |-------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------| | [Realistic smoke lighting with six-way lighting]( six-way-lighting.md) | Learn how and why to use six-way lighting in Unity to illuminate smoke. | -| [Use tools to generate six-way lightmap textures](use-tools-generate-six-way-lightmap-textures.md) | Learn how to create six-way lightmap textures in your preferred VFX tool for use in Unity. | +| [Generate six-way lightmap textures for visual effects](use-tools-generate-six-way-lightmap-textures.md) | Learn how to create six-way lightmap textures in your preferred VFX tool for use in Unity. | | [Import six-way lightmap textures into Unity](import-six-way-lightmap-textures-unity.md) | Learn how to import and configure six-way lightmap textures for use in Visual Effect Graph. | -| [Create and configure a six-way lit particle system](create-configure-six-way-lit-particle-system.md) | Learn how to achieve enhanced realism for smoke or explosion effects. | -| [Customize free six-way lighting lightmap textures](create-effects-with-six-way-lighting.md) | Learn how to generate high-quality smoke or dust effects with free lightmap textures. | +| [Create a six-way lit particle system in Visual Effect Graph](create-configure-six-way-lit-particle-system.md) | Learn how to achieve enhanced realism for smoke or explosion effects. | +| [Customize existing six-way lightmap textures](create-effects-with-six-way-lighting.md) | Learn how to generate high-quality smoke or dust effects with free lightmap textures. | +| [Six-way smoke lit reference](six-way-lighting-reference.md) | Explore the properties of the **Smoke Shader UI**.| ## Additional resources diff --git a/Packages/com.unity.visualeffectgraph/Editor/Core/VFXConverter.cs b/Packages/com.unity.visualeffectgraph/Editor/Core/VFXConverter.cs index 5f419eab265..852546742da 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Core/VFXConverter.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Core/VFXConverter.cs @@ -192,7 +192,7 @@ public static object ConvertTo(object value, Type type) { if (value == null) return null; - if (value is UnityObject obj && obj == null && obj.GetInstanceID() != 0) + if (value is UnityObject obj && obj == null && obj.GetEntityId() != EntityId.None) return obj; if (type == typeof(GraphicsBuffer)) return null; diff --git a/Packages/com.unity.visualeffectgraph/Editor/FilterPopup/VFXFilterWindow.cs b/Packages/com.unity.visualeffectgraph/Editor/FilterPopup/VFXFilterWindow.cs index 3a20442301c..ae59a71cf0b 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/FilterPopup/VFXFilterWindow.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/FilterPopup/VFXFilterWindow.cs @@ -1020,7 +1020,9 @@ private float GetTextMatchScore(string text, ref string pattern, string[] patter matchHighlight = text; foreach (var match in s_PatternMatches) { - matchHighlight = matchHighlight.Replace(match, $"#@{match}#", StringComparison.OrdinalIgnoreCase); + int index = matchHighlight.IndexOf(match, StringComparison.InvariantCultureIgnoreCase); + matchHighlight = matchHighlight.Insert(index, "#@"); + matchHighlight = matchHighlight.Insert(index + 2 + match.Length, "#"); } return score / text.Length; diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Blackboard/VFXBlackboard.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Blackboard/VFXBlackboard.cs index a40a35d9431..fd1c53ee866 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Blackboard/VFXBlackboard.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Blackboard/VFXBlackboard.cs @@ -147,6 +147,7 @@ enum ViewMode const string PropertiesCategoryTitle = "Properties"; const string BuiltInAttributesCategoryTitle = "Built-in Attributes"; const string AttributesCategoryTitle = "Attributes"; + const uint MaximumAttemptsToScrollToSelection = 10; static readonly Rect defaultRect = new Rect(100, 100, 300, 500); static System.Reflection.PropertyInfo s_LayoutManual = typeof(VisualElement).GetProperty("isLayoutManual", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); @@ -1229,7 +1230,7 @@ private bool TryGetValidCategoryName(ref string candidateName) void OnAddCategory() { - AddCategory("new category"); + AddCategory("New Category"); } public VFXBlackboardRow GetRowFromController(VFXParameterController parameterController) @@ -1393,17 +1394,10 @@ public void Update(bool force = false) m_Treeview.RefreshItems(); UpdateSubtitle(); SynchronizeExpandState(); - if (m_pendingSelectionItems.Count > 0) + if (m_Treeview.selectedItem != null) { - var lastItemToSelect = m_ParametersController.SelectMany(GetDataRecursive).LastOrDefault(x => m_pendingSelectionItems.Contains(x.data.title)); - if (lastItemToSelect.data != null) - { - m_Treeview.ScrollToItemById(lastItemToSelect.id); - } - else - { - m_pendingSelectionItems.Clear(); - } + EditorApplication.delayCall += () => ScrollToSelection(); + m_pendingSelectionItems.Clear(); } } finally @@ -1412,6 +1406,30 @@ public void Update(bool force = false) } } + /// + /// Scroll to selection and check on next frame if it has properly scrolled. + /// If not try again, but there's a maximum retry attempts to avoid infinite loop + /// + private void ScrollToSelection(uint iteration = 0) + { + if (iteration >= MaximumAttemptsToScrollToSelection) + return; + + m_Treeview.ScrollToItem(m_Treeview.selectedIndex); + EditorApplication.delayCall += () => + { + var element = m_Treeview.GetRootElementForIndex(m_Treeview.selectedIndex); + if (element == null) + { + ScrollToSelection(iteration + 1); + } + else if (!m_Treeview.Q().worldBound.Overlaps(element.worldBound)) + { + ScrollToSelection(iteration + 1); + } + }; + } + private int SortCategory(string category, List parameters) { switch (category) diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Blackboard/VFXBlackboardPropertyView.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Blackboard/VFXBlackboardPropertyView.cs index 3fcdf939e3f..472a0736018 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Blackboard/VFXBlackboardPropertyView.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Blackboard/VFXBlackboardPropertyView.cs @@ -289,6 +289,7 @@ public void SelfChange(int change) } else { + TryUnregisterSubproperties(false); m_Property = null; m_ExposedProperty = null; m_SubProperties = null; @@ -313,15 +314,7 @@ public void SelfChange(int change) private void RecreateSubproperties(ref int insertIndex) { - if (m_SubProperties != null) - { - foreach (var subProperty in m_SubProperties) - { - (subProperty.provider as Controller).UnregisterHandler(this); - subProperty.RemoveFromHierarchy(); - } - } - else + if (!TryUnregisterSubproperties(true)) { m_SubProperties = new List(); } @@ -333,6 +326,23 @@ private void RecreateSubproperties(ref int insertIndex) } } + bool TryUnregisterSubproperties(bool removeFromHierarchy) + { + if (m_SubProperties != null) + { + foreach (var subProperty in m_SubProperties) + { + (subProperty.provider as Controller).UnregisterHandler(this); + if (removeFromHierarchy) + subProperty.RemoveFromHierarchy(); + } + + return true; + } + + return false; + } + void OnAttachToPanel(AttachToPanelEvent e) { RegisterCallback(OnGeometryChanged); diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/Controllers/VFXNodeController.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/Controllers/VFXNodeController.cs index fc89979f8f0..b1bfcd6f3c0 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/Controllers/VFXNodeController.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/Controllers/VFXNodeController.cs @@ -221,6 +221,28 @@ public virtual void OnEdgeFromOutputGoingToBeRemoved(VFXDataAnchorController myO public virtual void WillCreateLink(ref VFXSlot myInput, ref VFXSlot otherOutput, bool revertTypeConstraint = false) { + CheckWillCreateCycle(myInput, otherOutput); + } + + private void CheckWillCreateCycle(VFXSlot input, VFXSlot output) + { + // Break cycles only for GPU events + VFXBasicGPUEvent gpuEvent = null; + VFXBlock triggerBlock = null; + if (output.owner is VFXBasicGPUEvent) + { + gpuEvent = input.owner as VFXBasicGPUEvent; + triggerBlock = input.owner as VFXBlock; + } + else if (input.owner is VFXBasicGPUEvent) + { + gpuEvent = input.owner as VFXBasicGPUEvent; + triggerBlock = output.owner as VFXBlock; + } + if (gpuEvent != null && triggerBlock != null) + { + VFXContext.BreakCyclesHorizontal(triggerBlock.GetParent(), gpuEvent, true); // always notify + } } protected virtual bool UpdateSlots(List newAnchors, IEnumerable slotList, bool expanded, bool input) diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/Controllers/VFXParameterController.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/Controllers/VFXParameterController.cs index 52f94a45eee..01eeca28942 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/Controllers/VFXParameterController.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/Controllers/VFXParameterController.cs @@ -672,51 +672,53 @@ public VFXValueFilter valueFilter static float RangeToFloat(object value) { - if (value != null) - { - if (value.GetType() == typeof(float)) - { - return (float)value; - } - else if (value.GetType() == typeof(int)) - { - return (float)(int)value; - } - else if (value.GetType() == typeof(uint)) - { - return (float)(uint)value; - } - } - return 0.0f; + if (value is float f) + return f; + if (value is int i) + return i; + if (value is uint u) + return u; + return 0f; } public object minValue { - get { return model.min; } + get => model.min; set { if (value != null) { - model.min = value; - if (RangeToFloat(this.value) < RangeToFloat(value)) + var floatValue = RangeToFloat(value); + var maxFloatValue = RangeToFloat(maxValue); + if (floatValue < maxFloatValue || this.model.min == null) { - this.value = value; + model.min = value; + if (RangeToFloat(this.value) < floatValue) + { + this.value = value; + } } + model.Invalidate(VFXModel.InvalidationCause.kParamChanged); } } } public object maxValue { - get { return model.max; } + get => model.max; set { if (value != null) { - model.max = value; - if (RangeToFloat(this.value) > RangeToFloat(value)) + var floatValue = RangeToFloat(value); + var minFloatValue = RangeToFloat(minValue); + if (floatValue > minFloatValue) { - this.value = value; + model.max = value; + if (RangeToFloat(this.value) > floatValue || this.model.max == null) + { + this.value = value; + } } model.Invalidate(VFXModel.InvalidationCause.kParamChanged); @@ -740,11 +742,12 @@ public object value if (valueFilter == VFXValueFilter.Range) { - if (RangeToFloat(value) < RangeToFloat(minValue)) + var floatValue = RangeToFloat(value); + if (floatValue < RangeToFloat(minValue)) { value = minValue; } - if (RangeToFloat(value) > RangeToFloat(maxValue)) + if (floatValue > RangeToFloat(maxValue)) { value = maxValue; } diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/VFXNodeUI.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/VFXNodeUI.cs index f37fe2c98e5..ab9a5e8cd48 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/VFXNodeUI.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/VFXNodeUI.cs @@ -85,7 +85,7 @@ public VFXNodeController controller protected virtual void OnNewController() { if (controller != null) - viewDataKey = $"NodeID-{controller.model.GetInstanceID()}"; + viewDataKey = $"NodeID-{controller.model.GetEntityId()}"; } public void OnSelectionMouseDown(MouseDownEvent e) diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/VFXComponentBoard.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/VFXComponentBoard.cs index 75c801a5368..683a9f36314 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/VFXComponentBoard.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/VFXComponentBoard.cs @@ -861,11 +861,8 @@ void OnSend() } } - [System.Obsolete("VFXComponentBoardBoundsSystemUIFactory is deprecated and will be removed. Use UxmlElementAttribute instead.", false)] - class VFXComponentBoardBoundsSystemUIFactory : UxmlFactory - { } - - class VFXComponentBoardBoundsSystemUI : VisualElement + [UxmlElement] + partial class VFXComponentBoardBoundsSystemUI : VisualElement { public void Setup(VFXView vfxView, string systemName, VFXBoundsRecorder boundsRecorder) { diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Controller/VFXViewController.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Controller/VFXViewController.cs index 4eb39adf348..722db581de8 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Controller/VFXViewController.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Controller/VFXViewController.cs @@ -1557,6 +1557,9 @@ public void ForceReload() Clear(); ModelChanged(model); GraphChanged(); + + var window = VFXViewWindow.GetWindow(this.graph, false, false); + window?.graphView?.blackboard.Update(true); } bool m_Syncing; @@ -1749,6 +1752,15 @@ public void SetCategoryExpanded(string categoryName, bool expanded) } } + private void ReorderParameters() + { + var index = 0; + foreach (var parameter in m_ParameterControllers.OrderBy(x => x.Value.order)) + { + parameter.Value.order = index++; + } + } + private void AddControllersFromModel(VFXModel model) { List newControllers = new List(); @@ -1815,7 +1827,8 @@ private void AddControllersFromModel(VFXModel model) parameter.ValidateNodes(); - m_ParameterControllers[parameter] = new VFXParameterController(parameter, this); + var newParameterController = new VFXParameterController(parameter, this) { order = m_ParameterControllers.Count }; + m_ParameterControllers[parameter] = newParameterController; m_SyncedModels[model] = new List(); } @@ -1856,10 +1869,11 @@ private void RemoveControllersFromModel(VFXModel model) } m_SyncedModels.Remove(model); } - if (model is VFXParameter) + if (model is VFXParameter parameter) { - m_ParameterControllers[model as VFXParameter].OnDisable(); - m_ParameterControllers.Remove(model as VFXParameter); + m_ParameterControllers[parameter].OnDisable(); + m_ParameterControllers.Remove(parameter); + ReorderParameters(); } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Properties/NumericPropertiesRM.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Properties/NumericPropertiesRM.cs index 3888669e86b..fd8001bb1b9 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Properties/NumericPropertiesRM.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Properties/NumericPropertiesRM.cs @@ -198,9 +198,8 @@ public override bool IsCompatible(IPropertyRMProvider provider) if (m_Provider.attributes.Is(VFXPropertyAttributes.Type.Enum)) { - string[] enumValues = m_Provider.attributes.FindEnum(); - - return enumValues.SequenceEqual(m_EnumPopup.choices); + var enumValues = m_Provider.attributes.FindEnum(); + return enumValues.Length == m_EnumPopup.choices.Count(); } return true; } @@ -221,6 +220,20 @@ protected override VisualElement CreateSimpleField(string label) protected override VFXBaseSliderField CreateSliderField(string label) => new VFXLongSliderField(label); + public override void UpdateGUI(bool force) + { + base.UpdateGUI(force); + if (m_Provider.attributes.Is(VFXPropertyAttributes.Type.Enum)) + { + var enumValues = m_Provider.attributes.FindEnum(); + if (!enumValues.SequenceEqual(m_EnumPopup.choices)) + { + var dropdownField = m_EnumPopup.Q(); + dropdownField.choices = enumValues.ToList(); + } + } + } + public override uint Convert(object value) { long longValue = (long)value; diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Properties/PropertyRM.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Properties/PropertyRM.cs index 936bc999d90..2cd35829f81 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Properties/PropertyRM.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Properties/PropertyRM.cs @@ -355,7 +355,7 @@ void OnCatchMouse(MouseDownEvent e) {typeof(string), typeof(StringPropertyRM)} }; - static Type GetPropertyType(IPropertyRMProvider controller) + protected static Type GetPropertyType(IPropertyRMProvider controller) { Type propertyType = null; Type type = controller.portType; diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Properties/VFXParameterEnumValuePropertyRM.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Properties/VFXParameterEnumValuePropertyRM.cs index 6d61eab5494..93bf756732a 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Properties/VFXParameterEnumValuePropertyRM.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Properties/VFXParameterEnumValuePropertyRM.cs @@ -6,6 +6,8 @@ public VFXListParameterEnumValuePropertyRM(IPropertyRMProvider controller, float { } + public override bool IsCompatible(IPropertyRMProvider provider) => GetPropertyType(provider) == typeof(UintPropertyRM); + protected override StringPropertyRM CreateField(IPropertyRMProvider provider) { return new StringPropertyRM(provider, 18); diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXCopy.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXCopy.cs index a1656eaec32..8dfa49c2f7a 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXCopy.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXCopy.cs @@ -270,9 +270,10 @@ Parameter CreateParameter(VFXParameter parameter, ParameterNode[] nodes) { return new Parameter { - originalInstanceID = parameter.GetInstanceID(), + originalInstanceID = parameter.GetEntityId(), name = parameter.exposedName, category = parameter.category, + order = parameter.order, value = new VFXSerializableObject(parameter.type, parameter.value), exposed = parameter.exposed, isOutput = parameter.isOutput, diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXCopyPasteCommon.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXCopyPasteCommon.cs index 7fd5894e1ec..70635318659 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXCopyPasteCommon.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXCopyPasteCommon.cs @@ -135,6 +135,7 @@ protected struct Parameter public int originalInstanceID; public string name; public string category; + public int order; public VFXSerializableObject value; public bool exposed; public VFXValueFilter valueFilter; diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXHelpDropdownButton.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXHelpDropdownButton.cs index ae66df92b3e..31c53e4163d 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXHelpDropdownButton.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXHelpDropdownButton.cs @@ -53,21 +53,27 @@ protected override void OnMainButton() void InstallSample(string sampleName) { - var sample = Sample.FindByPackage(VisualEffectGraphPackageInfo.name, null).SingleOrDefault(x => x.displayName == sampleName); + var searchResult = Sample.FindByPackage(VisualEffectGraphPackageInfo.name, null); + var sample = searchResult.SingleOrDefault(x => x.displayName == sampleName); if (!string.IsNullOrEmpty(sample.displayName)) { - if (!sample.isImported) - { - sample.Import(); - } - else + var importMode = Sample.ImportOptions.None; + if (sample.isImported) { var reinstall = EditorUtility.DisplayDialog("Warning", "This sample package is already installed.\nDo you want to reinstall it?", "Yes", "No"); if (reinstall) { - sample.Import(Sample.ImportOptions.OverridePreviousImports); + importMode = Sample.ImportOptions.OverridePreviousImports; + } + else + { + return; } } + + var packageInfo = PackageManager.PackageInfo.FindForAssetPath(VisualEffectGraphPackageInfo.assetPackagePath); + VFXTemplateHelperInternal.ImportSampleDependencies(packageInfo, sample); + sample.Import(importMode); } else { diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXPaste.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXPaste.cs index 6f99bfb9ee8..a73b9b6e283 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXPaste.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXPaste.cs @@ -824,7 +824,7 @@ private void PasteParameters(VFXViewController viewController, SerializableGraph foreach (var parameter in serializableGraph.parameterNodes) { // if we have a parameter with the same name use it else create it with the copied data - VFXParameter p = viewController.graph.children.OfType().FirstOrDefault(t => t.GetInstanceID() == parameter.originalInstanceID); + VFXParameter p = viewController.graph.children.OfType().FirstOrDefault(t => t.GetEntityId() == parameter.originalInstanceID); if (p == null) { Type type = parameter.value.type; @@ -891,6 +891,9 @@ private void PasteParameters(VFXViewController viewController, SerializableGraph var groupChanged = false; viewController.SyncControllerFromModel(ref groupChanged); + var newVfxParameterController = viewController.GetParameterController(newVfxParameter); + var sourceVFXParameterController = viewController.parameterControllers.Single(x => string.Compare(x.exposedName, parameter.name, StringComparison.InvariantCultureIgnoreCase) == 0); + viewController.SetParametersOrder(newVfxParameterController, sourceVFXParameterController.order + 1); newBlackboardItems.Add(newVfxParameter.exposedName); } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs index ceb9fa87a97..f1c80cc3e3b 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs @@ -2752,6 +2752,7 @@ void InsertFromTemplate(string templatePath, string assetPath) public void AddStickyNote(Vector2 position) { var group = selection.OfType().FirstOrDefault(); + group ??= GetPickedGroupNode(position); position = contentViewContainer.WorldToLocal(position); controller.AddStickyNote(position, group?.controller); } diff --git a/Packages/com.unity.visualeffectgraph/Editor/Inspector/VFXAssetEditor.cs b/Packages/com.unity.visualeffectgraph/Editor/Inspector/VFXAssetEditor.cs index 9d5173a1971..ce739a198ad 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Inspector/VFXAssetEditor.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Inspector/VFXAssetEditor.cs @@ -166,6 +166,11 @@ public static bool OnOpenVFX(EntityId entityId, int line) ReorderableList m_ReorderableList; List m_OutputContexts = new List(); VFXGraph m_CurrentGraph; + bool showUpdateModeCategory = true; + bool showInitialStateCategory = true; + bool showInstancingCategory = true; + bool showShadersCategory = true; + bool showOutputOrderCategory = true; void OnReorder(ReorderableList list) { @@ -174,7 +179,7 @@ void OnReorder(ReorderableList list) m_OutputContexts[i].vfxSystemSortPriority = i; } - if (VFXViewWindow.GetAllWindows().All(x => x.graphView?.controller?.graph.visualEffectResource.GetInstanceID() != m_CurrentGraph.visualEffectResource.GetInstanceID() || !x.hasFocus)) + if (VFXViewWindow.GetAllWindows().All(x => x.graphView?.controller?.graph.visualEffectResource.GetEntityId() != m_CurrentGraph.visualEffectResource.GetEntityId() || !x.hasFocus)) { // Do we need a compileReporter here? AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(m_CurrentGraph.visualEffectResource)); @@ -194,11 +199,6 @@ private void DrawOutputContextItem(Rect rect, int index, bool isActive, bool isF EditorGUI.LabelField(rect, EditorGUIUtility.TempContent(fullName)); } - private void DrawHeader(Rect rect) - { - EditorGUI.LabelField(rect, EditorGUIUtility.TrTextContent("Output Render Order")); - } - static Mesh s_CubeWireFrame; void OnEnable() { @@ -221,12 +221,9 @@ void OnEnable() }; } - m_ReorderableList = new ReorderableList(m_OutputContexts, typeof(IVFXSubRenderer)); - m_ReorderableList.displayRemove = false; - m_ReorderableList.displayAdd = false; + m_ReorderableList = new ReorderableList(m_OutputContexts, typeof(IVFXSubRenderer), true, false, false, false); + m_ReorderableList.showDefaultBackground = false; m_ReorderableList.onReorderCallback = OnReorder; - m_ReorderableList.drawHeaderCallback = DrawHeader; - m_ReorderableList.drawElementCallback = DrawOutputContextItem; var targetResources = targets.Cast().Select(t => t.GetResource()).Where(t => t != null).ToArray(); @@ -658,8 +655,9 @@ public override VisualElement CreateInspectorGUI() if (importers.Count > 0) { root.styleSheets.Add(VFXView.LoadStyleSheet("VisualEffectAssetEditor")); - var header = new Label("Template"); + var header = new Foldout { text = "Template Info" }; header.AddToClassList("inspector-header"); + header.focusable = false; root.Add(header); var allImportersSerializedObject = new SerializedObject(importers.ToArray()); @@ -684,10 +682,10 @@ public override VisualElement CreateInspectorGUI() } } }); - root.Add(useAsTemplateCheckbox); + header.Add(useAsTemplateCheckbox); var expander = new Foldout { text = "Template", style = { marginLeft = 15f } }; - root.Add(expander); + header.Add(expander); // Name field var nameTooltip = targets.Length == 1 @@ -773,121 +771,127 @@ private void OnInspectorGUIEmbedded() var processEveryFrameContent = EditorGUIUtility.TrTextContent("Exact Fixed Time", "Only relevant when using Fixed Delta Time. When enabled, several updates can be processed per frame (e.g.: if a frame is 10ms and the fixed frame rate is set to 5 ms, the effect will update twice with a 5ms deltaTime instead of once with a 10ms deltaTime). This method is expensive and should only be used for high-end scenarios."); var ignoreTimeScaleContent = EditorGUIUtility.TrTextContent("Ignore Time Scale", "When enabled, the computed visual effect delta time ignores the game Time Scale value (Play Rate is still applied)."); - EditorGUI.BeginChangeCheck(); - - VisualEffectEditor.ShowHeader(EditorGUIUtility.TrTextContent("Update mode"), false, false); - bool newFixedDeltaTime = EditorGUILayout.Toggle(deltaTimeContent, initialFixedDeltaTime ?? false); - bool newExactFixedTimeStep = false; - EditorGUI.showMixedValue = !initialProcessEveryFrame.HasValue; - EditorGUI.BeginDisabledGroup((!initialFixedDeltaTime.HasValue || !initialFixedDeltaTime.Value) && !resourceUpdateModeProperty.hasMultipleDifferentValues); - newExactFixedTimeStep = EditorGUILayout.Toggle(processEveryFrameContent, initialProcessEveryFrame ?? false); - EditorGUI.EndDisabledGroup(); - EditorGUI.showMixedValue = !initialIgnoreGameTimeScale.HasValue; - bool newIgnoreTimeScale = EditorGUILayout.Toggle(ignoreTimeScaleContent, initialIgnoreGameTimeScale ?? false); + VisualEffectAsset asset = (VisualEffectAsset)target; + VisualEffectResource resource = asset.GetResource(); - if (EditorGUI.EndChangeCheck()) + using (VisualEffectEditor.ShowAssetHeader(EditorGUIUtility.TrTextContent("Update mode"), showUpdateModeCategory, out showUpdateModeCategory)) { - if (!resourceUpdateModeProperty.hasMultipleDifferentValues) - { - var newUpdateMode = (VFXUpdateMode)0; - if (!newFixedDeltaTime) - newUpdateMode = newUpdateMode | VFXUpdateMode.DeltaTime; - if (newExactFixedTimeStep) - newUpdateMode = newUpdateMode | VFXUpdateMode.ExactFixedTimeStep; - if (newIgnoreTimeScale) - newUpdateMode = newUpdateMode | VFXUpdateMode.IgnoreTimeScale; - - resourceUpdateModeProperty.intValue = (int)newUpdateMode; - resourceObject.ApplyModifiedProperties(); - } - else + if (showUpdateModeCategory) { - var resourceUpdateModeProperties = resourceUpdateModeProperty.serializedObject.targetObjects.Select(o => new SerializedObject(o).FindProperty(resourceUpdateModeProperty.propertyPath)); - foreach (var property in resourceUpdateModeProperties) + EditorGUI.BeginChangeCheck(); + + bool newFixedDeltaTime = EditorGUILayout.Toggle(deltaTimeContent, initialFixedDeltaTime ?? false); + bool newExactFixedTimeStep = false; + EditorGUI.showMixedValue = !initialProcessEveryFrame.HasValue; + EditorGUI.BeginDisabledGroup((!initialFixedDeltaTime.HasValue || !initialFixedDeltaTime.Value) && !resourceUpdateModeProperty.hasMultipleDifferentValues); + newExactFixedTimeStep = EditorGUILayout.Toggle(processEveryFrameContent, initialProcessEveryFrame ?? false); + EditorGUI.EndDisabledGroup(); + EditorGUI.showMixedValue = !initialIgnoreGameTimeScale.HasValue; + bool newIgnoreTimeScale = EditorGUILayout.Toggle(ignoreTimeScaleContent, initialIgnoreGameTimeScale ?? false); + + if (EditorGUI.EndChangeCheck()) { - var updateMode = (VFXUpdateMode)property.intValue; - - if (initialFixedDeltaTime.HasValue) + if (!resourceUpdateModeProperty.hasMultipleDifferentValues) { + var newUpdateMode = (VFXUpdateMode)0; if (!newFixedDeltaTime) - updateMode = updateMode | VFXUpdateMode.DeltaTime; - else - updateMode = updateMode & ~VFXUpdateMode.DeltaTime; + newUpdateMode = newUpdateMode | VFXUpdateMode.DeltaTime; + if (newExactFixedTimeStep) + newUpdateMode = newUpdateMode | VFXUpdateMode.ExactFixedTimeStep; + if (newIgnoreTimeScale) + newUpdateMode = newUpdateMode | VFXUpdateMode.IgnoreTimeScale; + + resourceUpdateModeProperty.intValue = (int)newUpdateMode; + resourceObject.ApplyModifiedProperties(); } else { - if (newFixedDeltaTime) - updateMode = updateMode & ~VFXUpdateMode.DeltaTime; - } + var resourceUpdateModeProperties = resourceUpdateModeProperty.serializedObject.targetObjects.Select(o => new SerializedObject(o).FindProperty(resourceUpdateModeProperty.propertyPath)); + foreach (var property in resourceUpdateModeProperties) + { + var updateMode = (VFXUpdateMode)property.intValue; - if (newExactFixedTimeStep) - updateMode = updateMode | VFXUpdateMode.ExactFixedTimeStep; - else if (initialProcessEveryFrame.HasValue) - updateMode = updateMode & ~VFXUpdateMode.ExactFixedTimeStep; + if (initialFixedDeltaTime.HasValue) + { + if (!newFixedDeltaTime) + updateMode = updateMode | VFXUpdateMode.DeltaTime; + else + updateMode = updateMode & ~VFXUpdateMode.DeltaTime; + } + else + { + if (newFixedDeltaTime) + updateMode = updateMode & ~VFXUpdateMode.DeltaTime; + } - if (newIgnoreTimeScale) - updateMode = updateMode | VFXUpdateMode.IgnoreTimeScale; - else if (initialIgnoreGameTimeScale.HasValue) - updateMode = updateMode & ~VFXUpdateMode.IgnoreTimeScale; + if (newExactFixedTimeStep) + updateMode = updateMode | VFXUpdateMode.ExactFixedTimeStep; + else if (initialProcessEveryFrame.HasValue) + updateMode = updateMode & ~VFXUpdateMode.ExactFixedTimeStep; - property.intValue = (int)updateMode; - property.serializedObject.ApplyModifiedProperties(); + if (newIgnoreTimeScale) + updateMode = updateMode | VFXUpdateMode.IgnoreTimeScale; + else if (initialIgnoreGameTimeScale.HasValue) + updateMode = updateMode & ~VFXUpdateMode.IgnoreTimeScale; + + property.intValue = (int)updateMode; + property.serializedObject.ApplyModifiedProperties(); + } + } } - } - } - VisualEffectAsset asset = (VisualEffectAsset)target; - VisualEffectResource resource = asset.GetResource(); - //The following should be working, and works for newly created systems, but fails for old systems, - //due probably to incorrectly pasting the VFXData when creating them. - // bool hasAutomaticBoundsSystems = resource.GetOrCreateGraph().children - // .OfType().Any(d => d.boundsMode == BoundsSettingMode.Automatic); + //The following should be working, and works for newly created systems, but fails for old systems, + //due probably to incorrectly pasting the VFXData when creating them. + // bool hasAutomaticBoundsSystems = resource.GetOrCreateGraph().children + // .OfType().Any(d => d.boundsMode == BoundsSettingMode.Automatic); - bool hasAutomaticBoundsSystems = resource.GetOrCreateGraph().children - .OfType() - .Select(x => x.GetData()) - .OfType() - .Any(x => x.boundsMode == BoundsSettingMode.Automatic); + bool hasAutomaticBoundsSystems = resource.GetOrCreateGraph().children + .OfType() + .Select(x => x.GetData()) + .OfType() + .Any(x => x.boundsMode == BoundsSettingMode.Automatic); - using (new EditorGUI.DisabledScope(hasAutomaticBoundsSystems)) - { - EditorGUILayout.BeginHorizontal(); - EditorGUI.showMixedValue = cullingFlagsProperty.hasMultipleDifferentValues; - string forceSimulateTooltip = hasAutomaticBoundsSystems - ? " When using systems with Bounds Mode set to Automatic, this has to be set to Always recompute bounds and simulate." - : ""; - EditorGUILayout.PrefixLabel(EditorGUIUtility.TrTextContent("Culling Flags", "Specifies how the system recomputes its bounds and simulates when off-screen." + forceSimulateTooltip)); - EditorGUI.BeginChangeCheck(); + using (new EditorGUI.DisabledScope(hasAutomaticBoundsSystems)) + { + EditorGUILayout.BeginHorizontal(); + EditorGUI.showMixedValue = cullingFlagsProperty.hasMultipleDifferentValues; + string forceSimulateTooltip = hasAutomaticBoundsSystems + ? " When using systems with Bounds Mode set to Automatic, this has to be set to Always recompute bounds and simulate." + : ""; + EditorGUI.BeginChangeCheck(); + int newOption = EditorGUILayout.Popup( + EditorGUIUtility.TrTextContent("Culling Flags", "Specifies how the system recomputes its bounds and simulates when off-screen." + forceSimulateTooltip), + Array.IndexOf(k_CullingOptionsValue, (VFXCullingFlags)cullingFlagsProperty.intValue), + k_CullingOptionsContents); + if (EditorGUI.EndChangeCheck()) + { + cullingFlagsProperty.intValue = (int)k_CullingOptionsValue[newOption]; + resourceObject.ApplyModifiedProperties(); + } + } - int newOption = - EditorGUILayout.Popup( - Array.IndexOf(k_CullingOptionsValue, (VFXCullingFlags)cullingFlagsProperty.intValue), - k_CullingOptionsContents); - if (EditorGUI.EndChangeCheck()) - { - cullingFlagsProperty.intValue = (int)k_CullingOptionsValue[newOption]; - resourceObject.ApplyModifiedProperties(); + EditorGUILayout.EndHorizontal(); } } - EditorGUILayout.EndHorizontal(); - DrawInstancingGUI(); - VisualEffectEditor.ShowHeader(EditorGUIUtility.TrTextContent("Initial state"), false, false); - if (prewarmDeltaTime != null && prewarmStepCount != null) + using (VisualEffectEditor.ShowAssetHeader(EditorGUIUtility.TrTextContent("Initial state"), showInitialStateCategory, out showInitialStateCategory)) { - DisplayPrewarmInspectorGUI(resourceObject, prewarmDeltaTime, prewarmStepCount); - } + if (showInitialStateCategory && prewarmDeltaTime != null && prewarmStepCount != null) + { + DisplayPrewarmInspectorGUI(resourceObject, prewarmDeltaTime, prewarmStepCount); + } - if (initialEventName != null) - { - EditorGUI.BeginChangeCheck(); - EditorGUI.showMixedValue = initialEventName.hasMultipleDifferentValues; - EditorGUILayout.PropertyField(initialEventName, new GUIContent("Initial Event Name", "Sets the name of the event which triggers once the system is activated. Default: ‘OnPlay’.")); - if (EditorGUI.EndChangeCheck()) + if (showInitialStateCategory && initialEventName != null) { - resourceObject.ApplyModifiedProperties(); + EditorGUI.BeginChangeCheck(); + EditorGUI.showMixedValue = initialEventName.hasMultipleDifferentValues; + EditorGUILayout.PropertyField(initialEventName, new GUIContent("Initial Event Name", "Sets the name of the event which triggers once the system is activated. Default: ‘OnPlay’.")); + if (EditorGUI.EndChangeCheck()) + { + resourceObject.ApplyModifiedProperties(); + } } } @@ -899,79 +903,72 @@ private void OnInspectorGUIEmbedded() m_OutputContexts.Clear(); m_OutputContexts.AddRange(resource.GetOrCreateGraph().children.OfType().OrderBy(t => t.vfxSystemSortPriority)); - m_ReorderableList.DoLayoutList(); - - VisualEffectEditor.ShowHeader(EditorGUIUtility.TrTextContent("Shaders"), false, false); - - string assetPath = AssetDatabase.GetAssetPath(asset); - UnityObject[] objects = AssetDatabase.LoadAllAssetsAtPath(assetPath); - string directory = Path.GetDirectoryName(assetPath) + "/" + VFXExternalShaderProcessor.k_ShaderDirectory + "/" + asset.name + "/"; - - foreach (var obj in objects) + using (VisualEffectEditor.ShowAssetHeader(EditorGUIUtility.TrTextContent("Output Render Order"), showOutputOrderCategory, out showOutputOrderCategory)) { - if (obj is ComputeShader || obj is Shader) + if (showOutputOrderCategory) { - GUILayout.BeginHorizontal(); - Rect r = GUILayoutUtility.GetRect(0, 18, GUILayout.ExpandWidth(true)); - - int buttonsWidth = VFXExternalShaderProcessor.allowExternalization ? 240 : 160; - - int index = resource.GetShaderIndex(obj); - var shader = obj; + m_ReorderableList.DoLayoutList(); + } + } - Rect labelR = r; - labelR.width -= buttonsWidth; - GUI.Label(labelR, shader.name.Replace('\n', ' ')); + using (VisualEffectEditor.ShowAssetHeader(EditorGUIUtility.TrTextContent("Shaders"), showShadersCategory, out showShadersCategory)) + { + if (showShadersCategory) + { + string assetPath = AssetDatabase.GetAssetPath(asset); + UnityObject[] objects = AssetDatabase.LoadAllAssetsAtPath(assetPath); + string directory = Path.GetDirectoryName(assetPath) + "/" + VFXExternalShaderProcessor.k_ShaderDirectory + "/" + asset.name + "/"; - if (index >= 0) + foreach (var shader in objects) { - if (VFXExternalShaderProcessor.allowExternalization && index < resource.GetShaderSourceCount()) + if (shader is ComputeShader or Shader) { - string shaderSourceName = resource.GetShaderSourceName(index); - string externalPath = directory + shaderSourceName; + GUILayout.BeginHorizontal(); - externalPath = directory + shaderSourceName.Replace('/', '_') + VFXExternalShaderProcessor.k_ShaderExt; + int index = resource.GetShaderIndex(shader); + EditorGUILayout.LabelField(shader.name.Replace('\n', ' ')); - Rect buttonRect = r; - buttonRect.xMin = labelR.xMax; - buttonRect.width = 80; - labelR.width += 80; - if (System.IO.File.Exists(externalPath)) + if (index >= 0) { - if (GUI.Button(buttonRect, "Reveal External")) + if (VFXExternalShaderProcessor.allowExternalization && index < resource.GetShaderSourceCount()) { - EditorUtility.RevealInFinder(externalPath); + string shaderSourceName = resource.GetShaderSourceName(index); + string externalPath = directory + shaderSourceName; + + externalPath = directory + shaderSourceName.Replace('/', '_') + VFXExternalShaderProcessor.k_ShaderExt; + + if (System.IO.File.Exists(externalPath)) + { + if (GUILayout.Button("Reveal External", GUILayout.Width(80))) + { + EditorUtility.RevealInFinder(externalPath); + } + } + else + { + if (GUILayout.Button("Externalize", GUILayout.Width(80))) + { + Directory.CreateDirectory(directory); + + File.WriteAllText(externalPath, "//" + shaderSourceName + "," + index.ToString() + "\n//Don't delete the previous line or this one\n" + resource.GetShaderSource(index)); + } + } } - } - else - { - if (GUI.Button(buttonRect, "Externalize")) - { - Directory.CreateDirectory(directory); - File.WriteAllText(externalPath, "//" + shaderSourceName + "," + index.ToString() + "\n//Don't delete the previous line or this one\n" + resource.GetShaderSource(index)); + if (GUILayout.Button("Show Generated", GUILayout.Width(110))) + { + resource.ShowGeneratedShaderFile(index); } } - } - Rect buttonR = r; - buttonR.xMin = labelR.xMax; - buttonR.width = 110; - labelR.width += 110; - if (GUI.Button(buttonR, "Show Generated")) - { - resource.ShowGeneratedShaderFile(index); - } - } + if (GUILayout.Button("Select", GUILayout.Width(50))) + { + Selection.activeObject = shader; + } - Rect selectButtonR = r; - selectButtonR.xMin = labelR.xMax; - selectButtonR.width = 50; - if (GUI.Button(selectButtonR, "Select")) - { - Selection.activeObject = shader; + GUILayout.EndHorizontal(); + } } - GUILayout.EndHorizontal(); } } } @@ -981,35 +978,39 @@ private void OnInspectorGUIEmbedded() private void DrawInstancingGUI() { - VisualEffectEditor.ShowHeader(k_InstancingContent, false, false); - - EditorGUI.BeginChangeCheck(); - - VFXInstancingDisabledReason disabledReason = (VFXInstancingDisabledReason)instancingDisabledReasonProperty.intValue; - bool forceDisabled = disabledReason != VFXInstancingDisabledReason.None; - if (forceDisabled) + using (VisualEffectEditor.ShowAssetHeader(k_InstancingContent, showInstancingCategory, out showInstancingCategory)) { - System.Text.StringBuilder reasonString = new System.Text.StringBuilder("Instancing not available:"); - GetInstancingDisabledReasons(reasonString, disabledReason); - EditorGUILayout.HelpBox(reasonString.ToString(), MessageType.Info); - } + if (showInstancingCategory) + { + EditorGUI.BeginChangeCheck(); - VFXInstancingMode instancingMode = forceDisabled ? VFXInstancingMode.Disabled : (VFXInstancingMode)instancingModeProperty.intValue; - EditorGUI.BeginDisabled(forceDisabled); - instancingMode = (VFXInstancingMode)EditorGUILayout.EnumPopup(k_InstancingModeContent, instancingMode); - EditorGUI.EndDisabled(); + VFXInstancingDisabledReason disabledReason = (VFXInstancingDisabledReason)instancingDisabledReasonProperty.intValue; + bool forceDisabled = disabledReason != VFXInstancingDisabledReason.None; + if (forceDisabled) + { + System.Text.StringBuilder reasonString = new System.Text.StringBuilder("Instancing not available:"); + GetInstancingDisabledReasons(reasonString, disabledReason); + EditorGUILayout.HelpBox(reasonString.ToString(), MessageType.Info); + } - int instancingCapacity = instancingCapacityProperty.intValue; - if (instancingMode == VFXInstancingMode.Custom) - { - instancingCapacity = EditorGUILayout.DelayedIntField(k_InstancingCapacityContent, instancingCapacity); - } + VFXInstancingMode instancingMode = forceDisabled ? VFXInstancingMode.Disabled : (VFXInstancingMode)instancingModeProperty.intValue; + EditorGUI.BeginDisabled(forceDisabled); + instancingMode = (VFXInstancingMode)EditorGUILayout.EnumPopup(k_InstancingModeContent, instancingMode); + EditorGUI.EndDisabled(); - if (EditorGUI.EndChangeCheck()) - { - instancingModeProperty.intValue = (int)instancingMode; - instancingCapacityProperty.intValue = System.Math.Max(instancingCapacity, 1); - resourceObject.ApplyModifiedProperties(); + int instancingCapacity = instancingCapacityProperty.intValue; + if (instancingMode == VFXInstancingMode.Custom) + { + instancingCapacity = EditorGUILayout.DelayedIntField(k_InstancingCapacityContent, instancingCapacity); + } + + if (EditorGUI.EndChangeCheck()) + { + instancingModeProperty.intValue = (int)instancingMode; + instancingCapacityProperty.intValue = System.Math.Max(instancingCapacity, 1); + resourceObject.ApplyModifiedProperties(); + } + } } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/Inspector/VisualEffectEditor.cs b/Packages/com.unity.visualeffectgraph/Editor/Inspector/VisualEffectEditor.cs index df33d5b3412..fa06f5159b7 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Inspector/VisualEffectEditor.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Inspector/VisualEffectEditor.cs @@ -670,34 +670,83 @@ protected virtual void EditorModeInspectorButton() { } - public static bool ShowHeader(GUIContent nameContent, bool displayFoldout, bool foldoutState, string preferenceName = null) + private class HeaderScope : IDisposable { - float height = Styles.categoryHeader.CalcHeight(nameContent, 4000) + 3; - - Rect rect = GUILayoutUtility.GetRect(1, height - 1); + public enum HeaderType + { + AssetHeader, + ComponentHeader, + SubHeader, + } - rect.width += rect.x; - rect.x = 0; + readonly HeaderType m_HeaderType; - if (Event.current.type == EventType.Repaint) - Styles.categoryHeader.Draw(rect, nameContent, false, true, true, false); + public bool ShowContent { get; } - bool result = false; - if (displayFoldout) + public HeaderScope(HeaderType headerType, bool foldoutState, GUIContent nameContent, string preferenceName = null) { - rect.x += 14; - rect.width -= 2; - result = EditorGUI.Toggle(rect, foldoutState, Styles.foldoutStyle); + m_HeaderType = headerType; + switch (m_HeaderType) + { + case HeaderType.AssetHeader: + var toggleState = false; + ShowContent = EditorGUILayout.ToggleTitlebar(foldoutState, nameContent, ref toggleState, true); + break; + case HeaderType.ComponentHeader: + ShowContent = EditorGUILayout.BeginFoldoutHeaderGroup(foldoutState, nameContent); + break; + case HeaderType.SubHeader: + EditorGUI.indentLevel += 1; + ShowContent = EditorGUILayout.Foldout(foldoutState, nameContent, true); + break; + default: + throw new ArgumentOutOfRangeException(); + } + if (!string.IsNullOrEmpty(preferenceName)) + { + EditorPrefs.SetBool(preferenceName, ShowContent); + } } - EditorGUI.indentLevel = result ? 1 : 0; - - if (preferenceName != null && result != foldoutState) + public void Dispose() { - EditorPrefs.SetBool(preferenceName, result); + switch (m_HeaderType) + { + case HeaderType.AssetHeader: + break; + case HeaderType.ComponentHeader: + EditorGUILayout.EndFoldoutHeaderGroup(); + break; + case HeaderType.SubHeader: + EditorGUI.indentLevel -= 1; + EditorGUILayout.Space(); + break; + default: + throw new ArgumentOutOfRangeException(); + } } + } - return result; + public static IDisposable ShowSubHeader(GUIContent nameContent, bool foldoutState, out bool showContent, string preferenceName = null) + { + return ShowHeader(HeaderScope.HeaderType.SubHeader, nameContent, foldoutState, out showContent, preferenceName); + } + + public static IDisposable ShowAssetHeader(GUIContent nameContent, bool foldoutState, out bool showContent, string preferenceName = null) + { + return ShowHeader(HeaderScope.HeaderType.AssetHeader, nameContent, foldoutState, out showContent, preferenceName); + } + + public static IDisposable ShowComponentHeader(GUIContent nameContent, bool foldoutState, out bool showContent, string preferenceName = null) + { + return ShowHeader(HeaderScope.HeaderType.ComponentHeader, nameContent, foldoutState, out showContent, preferenceName); + } + + private static IDisposable ShowHeader(HeaderScope.HeaderType headerType, GUIContent nameContent, bool foldoutState, out bool showContent, string preferenceName = null) + { + var indentScope = new HeaderScope(headerType, foldoutState, nameContent, preferenceName); + showContent = indentScope.ShowContent; + return indentScope; } protected virtual void AssetField(VisualEffectResource resource) @@ -740,6 +789,7 @@ void InitialEventField(VisualEffectResource resource) using (new GUILayout.HorizontalScope()) { var rect = EditorGUILayout.GetControlRect(false, GUI.skin.textField.CalcHeight(exampleGUIContent, 10000)); + rect.xMin += 16f; var toggleRect = rect; toggleRect.yMin += 2.0f; toggleRect.width = Styles.overrideWidth; @@ -811,7 +861,7 @@ bool ShowCategory(GUIContent nameContent, bool foldoutState) public override void OnInspectorGUI() { GUILayout.Space(6); - showGeneralCategory = ShowHeader(Contents.headerGeneral, true, showGeneralCategory, kGeneralFoldoutStatePreferenceName); + using (ShowComponentHeader(Contents.headerGeneral, showGeneralCategory, out showGeneralCategory, kGeneralFoldoutStatePreferenceName)) {} m_SingleSerializedObject.Update(); if (m_OtherSerializedObjects != null) // copy the set value to all multi selection by hand, because it might not be at the same array index or already present in the property sheet @@ -848,7 +898,7 @@ public override void OnInspectorGUI() DrawInstancingProperties(); DrawParameters(resource); } - EditorGUI.indentLevel = 0; + if (serializedObject.ApplyModifiedProperties()) { foreach (var window in VFXViewWindow.GetAllWindows()) @@ -867,11 +917,11 @@ protected virtual void DrawParameters(VisualEffectResource resource) if (resource != null) graph = resource.GetOrCreateGraph(); - if (graph == null) { - ShowHeader(Contents.headerProperties, true, showPropertyCategory); - EditorGUILayout.HelpBox(Contents.graphInBundle.text.ToString(), MessageType.Info, true); + using var headerScope = ShowComponentHeader(Contents.headerProperties, showPropertyCategory, out showPropertyCategory, kPropertyFoldoutStatePreferenceName); + if (showPropertyCategory) + EditorGUILayout.HelpBox(Contents.graphInBundle.text.ToString(), MessageType.Info, true); } else { @@ -900,152 +950,121 @@ protected virtual void DrawParameters(VisualEffectResource resource) if (graph.m_ParameterInfo != null) { - showPropertyCategory = ShowHeader(Contents.headerProperties, true, showPropertyCategory, kPropertyFoldoutStatePreferenceName); - - if (showPropertyCategory) + using (ShowComponentHeader(Contents.headerProperties, showPropertyCategory, out showPropertyCategory, kPropertyFoldoutStatePreferenceName)) { - var stack = new List(); - int currentCount = graph.m_ParameterInfo.Length; - if (currentCount == 0) + if (showPropertyCategory) { - GUILayout.Label("No Property exposed in the Visual Effect Graph"); - } - else - { - EditorModeInspectorButton(); - } - - bool ignoreUntilNextCat = false; - - foreach (var param in graph.m_ParameterInfo) - { - EditorGUI.indentLevel = stack.Count; - --currentCount; - - var parameter = param; - if (parameter.descendantCount > 0) + EditorGUI.indentLevel++; + var stack = new List(); + int currentCount = graph.m_ParameterInfo.Length; + if (currentCount == 0) { - stack.Add(currentCount); - currentCount = parameter.descendantCount; + GUILayout.Label("No Property exposed in the Visual Effect Graph"); } + else + { + EditorModeInspectorButton(); + } + + bool ignoreUntilNextCat = false; - if (currentCount == 0 && stack.Count > 0) + foreach (var param in graph.m_ParameterInfo) { - do + EditorGUI.indentLevel = stack.Count; + --currentCount; + + var parameter = param; + if (parameter.descendantCount > 0) { - currentCount = stack.Last(); - stack.RemoveAt(stack.Count - 1); + stack.Add(currentCount); + currentCount = parameter.descendantCount; } - while (currentCount == 0); - } - if (string.IsNullOrEmpty(parameter.sheetType)) - { - if (!string.IsNullOrEmpty(parameter.name)) + if (currentCount == 0 && stack.Count > 0) { - if (string.IsNullOrEmpty(parameter.realType)) // This is a category + do { - bool wasIgnored = ignoreUntilNextCat; - ignoreUntilNextCat = false; - var nameContent = GetGUIContent(parameter.name); - - bool prevState = EditorPrefs.GetBool("VFX-category-" + parameter.name, true); - bool currentState = ShowCategory(nameContent, prevState); + currentCount = stack.Last(); + stack.RemoveAt(stack.Count - 1); + } while (currentCount == 0); + } - if (currentState != prevState) + if (string.IsNullOrEmpty(parameter.sheetType)) + { + if (!string.IsNullOrEmpty(parameter.name)) + { + if (string.IsNullOrEmpty(parameter.realType)) // This is a category { - EditorPrefs.SetBool("VFX-category-" + parameter.name, currentState); - } + bool wasIgnored = ignoreUntilNextCat; + ignoreUntilNextCat = false; + var nameContent = GetGUIContent(parameter.name); + + bool prevState = EditorPrefs.GetBool("VFX-category-" + parameter.name, true); + bool currentState = ShowCategory(nameContent, prevState); - if (!currentState) - ignoreUntilNextCat = true; + if (currentState != prevState) + { + EditorPrefs.SetBool("VFX-category-" + parameter.name, currentState); + } + + if (!currentState) + ignoreUntilNextCat = true; + } + else if (!ignoreUntilNextCat) + EmptyLineControl(parameter.name, parameter.tooltip, parameter.spaceable ? parameter.space : (VFXSpace?)null, stack.Count, resource); } - else if (!ignoreUntilNextCat) - EmptyLineControl(parameter.name, parameter.tooltip, parameter.spaceable ? parameter.space : (VFXSpace?)null, stack.Count, resource); } - } - else if (!ignoreUntilNextCat) - { - SerializedProperty sourceProperty = null; + else if (!ignoreUntilNextCat) + { + SerializedProperty sourceProperty = null; - m_PropertyToProp[parameter.sheetType].TryGetValue(parameter.path, out sourceProperty); + m_PropertyToProp[parameter.sheetType].TryGetValue(parameter.path, out sourceProperty); - //< Prepare potential indirection - bool wasNewProperty = false; - bool wasNotOverriddenProperty = false; + //< Prepare potential indirection + bool wasNewProperty = false; + bool wasNotOverriddenProperty = false; - SerializedProperty actualDisplayedPropertyValue = null; - SerializedProperty actualDisplayedPropertyOverridden = null; - if (sourceProperty == null) - { - s_FakeObjectSerializedCache.Update(); - var fakeField = s_FakeObjectSerializedCache.FindProperty("m_PropertySheet." + parameter.sheetType + ".m_Array"); - fakeField.InsertArrayElementAtIndex(fakeField.arraySize); - var newFakeEntry = fakeField.GetArrayElementAtIndex(fakeField.arraySize - 1); - newFakeEntry.FindPropertyRelative("m_Name").stringValue = param.path; - newFakeEntry.FindPropertyRelative("m_Overridden").boolValue = false; - - actualDisplayedPropertyOverridden = newFakeEntry.FindPropertyRelative("m_Overridden"); - actualDisplayedPropertyValue = newFakeEntry.FindPropertyRelative("m_Value"); - SetObjectValue(actualDisplayedPropertyValue, parameter.defaultValue.Get()); - - wasNewProperty = true; - } - else - { - actualDisplayedPropertyOverridden = sourceProperty.FindPropertyRelative("m_Overridden"); - actualDisplayedPropertyValue = sourceProperty.FindPropertyRelative("m_Value"); - if (!actualDisplayedPropertyOverridden.boolValue) + SerializedProperty actualDisplayedPropertyValue = null; + SerializedProperty actualDisplayedPropertyOverridden = null; + if (sourceProperty == null) { s_FakeObjectSerializedCache.Update(); - - actualDisplayedPropertyOverridden = s_FakeObjectSerializedCache.FindProperty(actualDisplayedPropertyOverridden.propertyPath); - actualDisplayedPropertyValue = s_FakeObjectSerializedCache.FindProperty(actualDisplayedPropertyValue.propertyPath); + var fakeField = s_FakeObjectSerializedCache.FindProperty("m_PropertySheet." + parameter.sheetType + ".m_Array"); + fakeField.InsertArrayElementAtIndex(fakeField.arraySize); + var newFakeEntry = fakeField.GetArrayElementAtIndex(fakeField.arraySize - 1); + newFakeEntry.FindPropertyRelative("m_Name").stringValue = param.path; + newFakeEntry.FindPropertyRelative("m_Overridden").boolValue = false; + + actualDisplayedPropertyOverridden = newFakeEntry.FindPropertyRelative("m_Overridden"); + actualDisplayedPropertyValue = newFakeEntry.FindPropertyRelative("m_Value"); SetObjectValue(actualDisplayedPropertyValue, parameter.defaultValue.Get()); - wasNotOverriddenProperty = true; + wasNewProperty = true; } - } - - //< Actual display - GUIContent nameContent = GetGUIContent(parameter.name, parameter.tooltip); - - bool wasOverriden = actualDisplayedPropertyOverridden.boolValue; - - bool overrideMixed = false; - bool valueMixed = false; - if (m_OtherSerializedObjects != null) // copy the set value to all multi selection by hand, because it might not be at the same array index or already present in the property sheet - { - foreach (var otherObject in m_OtherSerializedObjects) + else { - var otherSourceVfxField = otherObject.FindProperty("m_PropertySheet." + parameter.sheetType + ".m_Array"); - SerializedProperty otherSourceProperty = null; - for (int i = 0; i < otherSourceVfxField.arraySize; ++i) + actualDisplayedPropertyOverridden = sourceProperty.FindPropertyRelative("m_Overridden"); + actualDisplayedPropertyValue = sourceProperty.FindPropertyRelative("m_Value"); + if (!actualDisplayedPropertyOverridden.boolValue) { - otherSourceProperty = otherSourceVfxField.GetArrayElementAtIndex(i); - var nameProperty = otherSourceProperty.FindPropertyRelative("m_Name").stringValue; - if (nameProperty == parameter.path) - { - break; - } - otherSourceProperty = null; - } + s_FakeObjectSerializedCache.Update(); - if (otherSourceProperty != null) - { - overrideMixed = overrideMixed || (wasOverriden != otherSourceProperty.FindPropertyRelative("m_Overridden").boolValue); - } - else - { - overrideMixed = overrideMixed || wasOverriden; + actualDisplayedPropertyOverridden = s_FakeObjectSerializedCache.FindProperty(actualDisplayedPropertyOverridden.propertyPath); + actualDisplayedPropertyValue = s_FakeObjectSerializedCache.FindProperty(actualDisplayedPropertyValue.propertyPath); + SetObjectValue(actualDisplayedPropertyValue, parameter.defaultValue.Get()); + + wasNotOverriddenProperty = true; } - if (overrideMixed) - break; } - if (overrideMixed) - valueMixed = true; - else + //< Actual display + GUIContent nameContent = GetGUIContent(parameter.name, parameter.tooltip); + + bool wasOverriden = actualDisplayedPropertyOverridden.boolValue; + + bool overrideMixed = false; + bool valueMixed = false; + if (m_OtherSerializedObjects != null) // copy the set value to all multi selection by hand, because it might not be at the same array index or already present in the property sheet { foreach (var otherObject in m_OtherSerializedObjects) { @@ -1056,130 +1075,174 @@ protected virtual void DrawParameters(VisualEffectResource resource) otherSourceProperty = otherSourceVfxField.GetArrayElementAtIndex(i); var nameProperty = otherSourceProperty.FindPropertyRelative("m_Name").stringValue; if (nameProperty == parameter.path) + { break; + } + otherSourceProperty = null; } if (otherSourceProperty != null) { - var otherValue = GetObjectValue(otherSourceProperty.FindPropertyRelative("m_Value")); - if (otherValue == null) - valueMixed = valueMixed || GetObjectValue(actualDisplayedPropertyValue) != null; - else - valueMixed = valueMixed || !otherValue.Equals(GetObjectValue(actualDisplayedPropertyValue)); + overrideMixed = overrideMixed || (wasOverriden != otherSourceProperty.FindPropertyRelative("m_Overridden").boolValue); + } + else + { + overrideMixed = overrideMixed || wasOverriden; } - if (valueMixed) + if (overrideMixed) break; } - } - } - bool overridenChanged = false; - if (DisplayProperty(ref parameter, nameContent, actualDisplayedPropertyOverridden, actualDisplayedPropertyValue, overrideMixed, valueMixed, out overridenChanged) || overridenChanged) - { - if (!overridenChanged) // the value has changed - { - if (m_OtherSerializedObjects != null) // copy the set value to all multi selection by hand, because it might not be at the same array index or already present in the property sheet + + if (overrideMixed) + valueMixed = true; + else { foreach (var otherObject in m_OtherSerializedObjects) { - var singleSourceVfxField = otherObject.FindProperty("m_PropertySheet." + parameter.sheetType + ".m_Array"); - SerializedProperty singleSourceProperty = null; - for (int i = 0; i < singleSourceVfxField.arraySize; ++i) + var otherSourceVfxField = otherObject.FindProperty("m_PropertySheet." + parameter.sheetType + ".m_Array"); + SerializedProperty otherSourceProperty = null; + for (int i = 0; i < otherSourceVfxField.arraySize; ++i) { - singleSourceProperty = singleSourceVfxField.GetArrayElementAtIndex(i); - var nameProperty = singleSourceProperty.FindPropertyRelative("m_Name").stringValue; + otherSourceProperty = otherSourceVfxField.GetArrayElementAtIndex(i); + var nameProperty = otherSourceProperty.FindPropertyRelative("m_Name").stringValue; if (nameProperty == parameter.path) - { break; - } - singleSourceProperty = null; + otherSourceProperty = null; } - if (singleSourceProperty == null) - { - singleSourceVfxField.InsertArrayElementAtIndex(singleSourceVfxField.arraySize); - var newEntry = singleSourceVfxField.GetArrayElementAtIndex(singleSourceVfxField.arraySize - 1); - newEntry.FindPropertyRelative("m_Overridden").boolValue = true; - SetObjectValue(newEntry.FindPropertyRelative("m_Value"), GetObjectValue(actualDisplayedPropertyValue)); - newEntry.FindPropertyRelative("m_Name").stringValue = param.path; - PropertyOverrideChanged(); - } - else + if (otherSourceProperty != null) { - singleSourceProperty.FindPropertyRelative("m_Overridden").boolValue = true; - SetObjectValue(singleSourceProperty.FindPropertyRelative("m_Value"), GetObjectValue(actualDisplayedPropertyValue)); + var otherValue = GetObjectValue(otherSourceProperty.FindPropertyRelative("m_Value")); + if (otherValue == null) + valueMixed = valueMixed || GetObjectValue(actualDisplayedPropertyValue) != null; + else + valueMixed = valueMixed || !otherValue.Equals(GetObjectValue(actualDisplayedPropertyValue)); } - otherObject.ApplyModifiedProperties(); + + if (valueMixed) + break; } } } - if (wasNewProperty) - { - var sourceVfxField = m_VFXPropertySheet.FindPropertyRelative(parameter.sheetType + ".m_Array"); - //We start editing a new exposed value which wasn't stored in this Visual Effect Component - sourceVfxField.InsertArrayElementAtIndex(sourceVfxField.arraySize); - var newEntry = sourceVfxField.GetArrayElementAtIndex(sourceVfxField.arraySize - 1); - - newEntry.FindPropertyRelative("m_Overridden").boolValue = true; - SetObjectValue(newEntry.FindPropertyRelative("m_Value"), GetObjectValue(actualDisplayedPropertyValue)); - newEntry.FindPropertyRelative("m_Name").stringValue = param.path; - PropertyOverrideChanged(); - } - else if (wasNotOverriddenProperty && !overridenChanged) - { - if (!actualDisplayedPropertyOverridden.boolValue) - { - //The value has been directly changed, change overridden state and recopy new value - SetObjectValue(sourceProperty.FindPropertyRelative("m_Value"), GetObjectValue(actualDisplayedPropertyValue)); - } - sourceProperty.FindPropertyRelative("m_Overridden").boolValue = true; - PropertyOverrideChanged(); - } - else if (wasOverriden != actualDisplayedPropertyOverridden.boolValue) + + bool overridenChanged = false; + if (DisplayProperty(ref parameter, nameContent, actualDisplayedPropertyOverridden, actualDisplayedPropertyValue, overrideMixed, valueMixed, out overridenChanged) || overridenChanged) { - sourceProperty.FindPropertyRelative("m_Overridden").boolValue = actualDisplayedPropertyOverridden.boolValue; - if (m_OtherSerializedObjects != null) // copy the set value to all multi selection by hand, because it might not be at the same array index or already present in the property sheet + if (!overridenChanged) // the value has changed { - foreach (var otherObject in m_OtherSerializedObjects) + if (m_OtherSerializedObjects != null) // copy the set value to all multi selection by hand, because it might not be at the same array index or already present in the property sheet { - var otherSourceVfxField = otherObject.FindProperty("m_PropertySheet." + parameter.sheetType + ".m_Array"); - SerializedProperty otherSourceProperty = null; - for (int i = 0; i < otherSourceVfxField.arraySize; ++i) + foreach (var otherObject in m_OtherSerializedObjects) { - otherSourceProperty = otherSourceVfxField.GetArrayElementAtIndex(i); - var nameProperty = otherSourceProperty.FindPropertyRelative("m_Name").stringValue; - if (nameProperty == parameter.path) + var singleSourceVfxField = otherObject.FindProperty("m_PropertySheet." + parameter.sheetType + ".m_Array"); + SerializedProperty singleSourceProperty = null; + for (int i = 0; i < singleSourceVfxField.arraySize; ++i) { - break; + singleSourceProperty = singleSourceVfxField.GetArrayElementAtIndex(i); + var nameProperty = singleSourceProperty.FindPropertyRelative("m_Name").stringValue; + if (nameProperty == parameter.path) + { + break; + } + + singleSourceProperty = null; } - otherSourceProperty = null; - } - if (otherSourceProperty == null) - { - if (!wasOverriden) + + if (singleSourceProperty == null) { - otherSourceVfxField.InsertArrayElementAtIndex(otherSourceVfxField.arraySize); - var newEntry = otherSourceVfxField.GetArrayElementAtIndex(otherSourceVfxField.arraySize - 1); + singleSourceVfxField.InsertArrayElementAtIndex(singleSourceVfxField.arraySize); + var newEntry = singleSourceVfxField.GetArrayElementAtIndex(singleSourceVfxField.arraySize - 1); newEntry.FindPropertyRelative("m_Overridden").boolValue = true; SetObjectValue(newEntry.FindPropertyRelative("m_Value"), GetObjectValue(actualDisplayedPropertyValue)); newEntry.FindPropertyRelative("m_Name").stringValue = param.path; PropertyOverrideChanged(); } + else + { + singleSourceProperty.FindPropertyRelative("m_Overridden").boolValue = true; + SetObjectValue(singleSourceProperty.FindPropertyRelative("m_Value"), GetObjectValue(actualDisplayedPropertyValue)); + } + + otherObject.ApplyModifiedProperties(); } - else + } + } + + if (wasNewProperty) + { + var sourceVfxField = m_VFXPropertySheet.FindPropertyRelative(parameter.sheetType + ".m_Array"); + //We start editing a new exposed value which wasn't stored in this Visual Effect Component + sourceVfxField.InsertArrayElementAtIndex(sourceVfxField.arraySize); + var newEntry = sourceVfxField.GetArrayElementAtIndex(sourceVfxField.arraySize - 1); + + newEntry.FindPropertyRelative("m_Overridden").boolValue = true; + SetObjectValue(newEntry.FindPropertyRelative("m_Value"), GetObjectValue(actualDisplayedPropertyValue)); + newEntry.FindPropertyRelative("m_Name").stringValue = param.path; + PropertyOverrideChanged(); + } + else if (wasNotOverriddenProperty && !overridenChanged) + { + if (!actualDisplayedPropertyOverridden.boolValue) + { + //The value has been directly changed, change overridden state and recopy new value + SetObjectValue(sourceProperty.FindPropertyRelative("m_Value"), GetObjectValue(actualDisplayedPropertyValue)); + } + + sourceProperty.FindPropertyRelative("m_Overridden").boolValue = true; + PropertyOverrideChanged(); + } + else if (wasOverriden != actualDisplayedPropertyOverridden.boolValue) + { + sourceProperty.FindPropertyRelative("m_Overridden").boolValue = actualDisplayedPropertyOverridden.boolValue; + if (m_OtherSerializedObjects != null) // copy the set value to all multi selection by hand, because it might not be at the same array index or already present in the property sheet + { + foreach (var otherObject in m_OtherSerializedObjects) { - otherSourceProperty.FindPropertyRelative("m_Overridden").boolValue = !wasOverriden; - PropertyOverrideChanged(); + var otherSourceVfxField = otherObject.FindProperty("m_PropertySheet." + parameter.sheetType + ".m_Array"); + SerializedProperty otherSourceProperty = null; + for (int i = 0; i < otherSourceVfxField.arraySize; ++i) + { + otherSourceProperty = otherSourceVfxField.GetArrayElementAtIndex(i); + var nameProperty = otherSourceProperty.FindPropertyRelative("m_Name").stringValue; + if (nameProperty == parameter.path) + { + break; + } + + otherSourceProperty = null; + } + + if (otherSourceProperty == null) + { + if (!wasOverriden) + { + otherSourceVfxField.InsertArrayElementAtIndex(otherSourceVfxField.arraySize); + var newEntry = otherSourceVfxField.GetArrayElementAtIndex(otherSourceVfxField.arraySize - 1); + + newEntry.FindPropertyRelative("m_Overridden").boolValue = true; + SetObjectValue(newEntry.FindPropertyRelative("m_Value"), GetObjectValue(actualDisplayedPropertyValue)); + newEntry.FindPropertyRelative("m_Name").stringValue = param.path; + PropertyOverrideChanged(); + } + } + else + { + otherSourceProperty.FindPropertyRelative("m_Overridden").boolValue = !wasOverriden; + PropertyOverrideChanged(); + } + + otherObject.ApplyModifiedProperties(); } - otherObject.ApplyModifiedProperties(); } + + PropertyOverrideChanged(); } - PropertyOverrideChanged(); + m_SingleSerializedObject.ApplyModifiedProperties(); } - m_SingleSerializedObject.ApplyModifiedProperties(); } } } @@ -1193,27 +1256,29 @@ protected virtual void PropertyOverrideChanged() { } private void DrawRendererProperties() { - showRendererCategory = ShowHeader(Contents.headerRenderer, true, showRendererCategory, kRendererFoldoutStatePreferenceName); - - if (showRendererCategory) - m_RendererEditor.OnInspectorGUI(); + using (ShowComponentHeader(Contents.headerRenderer, showRendererCategory, out showRendererCategory, kRendererFoldoutStatePreferenceName)) + { + if (showRendererCategory) + m_RendererEditor.OnInspectorGUI(); + } } private void DrawInstancingProperties() { - showInstancingCategory = ShowHeader(Contents.headerInstancing, true, showInstancingCategory, kInstancingFoldoutStatePreferenceName); - - if (showInstancingCategory) + using (ShowComponentHeader(Contents.headerInstancing, showInstancingCategory, out showInstancingCategory, kInstancingFoldoutStatePreferenceName)) { - EditorGUI.BeginChangeCheck(); - EditorGUILayout.PropertyField(m_AllowInstancing, Contents.allowInstancing); - if (EditorGUI.EndChangeCheck()) + if (showInstancingCategory) { - serializedObject.ApplyModifiedProperties(); - - foreach (var visualEffect in targets.OfType()) + EditorGUI.BeginChangeCheck(); + EditorGUILayout.PropertyField(m_AllowInstancing, Contents.allowInstancing); + if (EditorGUI.EndChangeCheck()) { - visualEffect.RecreateData(); + serializedObject.ApplyModifiedProperties(); + + foreach (var visualEffect in targets.OfType()) + { + visualEffect.RecreateData(); + } } } } @@ -1300,111 +1365,95 @@ public void OnInspectorGUI() { m_SerializedRenderers.Update(); - EditorGUI.indentLevel += 1; - // Ugly hack to indent the header group because "indentLevel" is not taken into account - var x = EditorStyles.inspectorDefaultMargins.padding.left; - EditorStyles.inspectorDefaultMargins.padding.left -= 24; - bool showProbesCategory = EditorGUILayout.BeginFoldoutHeaderGroup(m_ShowProbesCategory, Contents.probeSettings); - if (showProbesCategory != m_ShowProbesCategory) + using (ShowSubHeader(Contents.probeSettings, m_ShowProbesCategory, out m_ShowProbesCategory, kRendererProbesFoldoutStatePreferenceName)) { - m_ShowProbesCategory = showProbesCategory; - EditorPrefs.SetBool(kRendererProbesFoldoutStatePreferenceName, m_ShowProbesCategory); - } - - if (m_ShowProbesCategory) - { - bool showReflectionProbeUsage = m_ReflectionProbeUsage != null && SupportedRenderingFeatures.active.reflectionProbes; - - var srpAssetType = GraphicsSettings.currentRenderPipelineAssetType; - if (srpAssetType is not null && srpAssetType.ToString().Contains("UniversalRenderPipeline")) + if (m_ShowProbesCategory) { - //Reflection Probe Usage option has been removed in URP but the VFXRenderer uses ReflectionProbeUsage.Off by default - //We are temporarily letting this option reachable until the C++ doesn't change the default value - showReflectionProbeUsage = m_ReflectionProbeUsage != null; - } + bool showReflectionProbeUsage = m_ReflectionProbeUsage != null && SupportedRenderingFeatures.active.reflectionProbes; - if (showReflectionProbeUsage) - { - Rect r = EditorGUILayout.GetControlRect(true, EditorGUI.kSingleLineHeight, EditorStyles.popup); - EditorGUI.BeginProperty(r, Contents.reflectionProbeUsageStyle, m_ReflectionProbeUsage); - EditorGUI.BeginChangeCheck(); - var newValue = EditorGUI.EnumPopup(r, Contents.reflectionProbeUsageStyle, (ReflectionProbeUsage)m_ReflectionProbeUsage.intValue); - if (EditorGUI.EndChangeCheck()) - m_ReflectionProbeUsage.intValue = (int)(ReflectionProbeUsage)newValue; - EditorGUI.EndProperty(); - } - - if (m_LightProbeUsage != null) - { - Rect r = EditorGUILayout.GetControlRect(true, EditorGUI.kSingleLineHeight, EditorStyles.popup); - EditorGUI.BeginProperty(r, Contents.lightProbeUsageStyle, m_LightProbeUsage); - EditorGUI.BeginChangeCheck(); - var newValue = EditorGUI.EnumPopup(r, Contents.lightProbeUsageStyle, (LightProbeUsage)m_LightProbeUsage.intValue); - if (EditorGUI.EndChangeCheck()) - m_LightProbeUsage.intValue = (int)(LightProbeUsage)newValue; - EditorGUI.EndProperty(); + var srpAssetType = GraphicsSettings.currentRenderPipelineAssetType; + if (srpAssetType is not null && srpAssetType.ToString().Contains("UniversalRenderPipeline")) + { + //Reflection Probe Usage option has been removed in URP but the VFXRenderer uses ReflectionProbeUsage.Off by default + //We are temporarily letting this option reachable until the C++ doesn't change the default value + showReflectionProbeUsage = m_ReflectionProbeUsage != null; + } - if (!m_LightProbeUsage.hasMultipleDifferentValues && m_LightProbeUsage.intValue == (int)LightProbeUsage.UseProxyVolume) + if (showReflectionProbeUsage) { - if (!LightProbeProxyVolume.isFeatureSupported || !SupportedRenderingFeatures.active.lightProbeProxyVolumes) - EditorGUILayout.HelpBox(Contents.lightProbeVolumeUnsupportedNote.text, MessageType.Warning); - EditorGUILayout.PropertyField(m_LightProbeVolumeOverride, Contents.lightProbeVolumeOverrideStyle); + Rect r = EditorGUILayout.GetControlRect(true, EditorGUI.kSingleLineHeight, EditorStyles.popup); + EditorGUI.BeginProperty(r, Contents.reflectionProbeUsageStyle, m_ReflectionProbeUsage); + EditorGUI.BeginChangeCheck(); + var newValue = EditorGUI.EnumPopup(r, Contents.reflectionProbeUsageStyle, (ReflectionProbeUsage)m_ReflectionProbeUsage.intValue); + if (EditorGUI.EndChangeCheck()) + m_ReflectionProbeUsage.intValue = (int)(ReflectionProbeUsage)newValue; + EditorGUI.EndProperty(); } - } - bool useReflectionProbes = m_ReflectionProbeUsage != null && !m_ReflectionProbeUsage.hasMultipleDifferentValues && (ReflectionProbeUsage)m_ReflectionProbeUsage.intValue != ReflectionProbeUsage.Off; - bool lightProbesEnabled = m_LightProbeUsage != null && !m_LightProbeUsage.hasMultipleDifferentValues && (LightProbeUsage)m_LightProbeUsage.intValue != LightProbeUsage.Off; - bool needsProbeAnchor = useReflectionProbes || lightProbesEnabled; + if (m_LightProbeUsage != null) + { + Rect r = EditorGUILayout.GetControlRect(true, EditorGUI.kSingleLineHeight, EditorStyles.popup); + EditorGUI.BeginProperty(r, Contents.lightProbeUsageStyle, m_LightProbeUsage); + EditorGUI.BeginChangeCheck(); + var newValue = EditorGUI.EnumPopup(r, Contents.lightProbeUsageStyle, (LightProbeUsage)m_LightProbeUsage.intValue); + if (EditorGUI.EndChangeCheck()) + m_LightProbeUsage.intValue = (int)(LightProbeUsage)newValue; + EditorGUI.EndProperty(); - if (needsProbeAnchor) - EditorGUILayout.PropertyField(m_ProbeAnchor, Contents.lightProbeAnchorStyle); - } - EditorGUILayout.EndFoldoutHeaderGroup(); + if (!m_LightProbeUsage.hasMultipleDifferentValues && m_LightProbeUsage.intValue == (int)LightProbeUsage.UseProxyVolume) + { + if (!LightProbeProxyVolume.isFeatureSupported || !SupportedRenderingFeatures.active.lightProbeProxyVolumes) + EditorGUILayout.HelpBox(Contents.lightProbeVolumeUnsupportedNote.text, MessageType.Warning); + EditorGUILayout.PropertyField(m_LightProbeVolumeOverride, Contents.lightProbeVolumeOverrideStyle); + } + } - var showAdditionnalCategory = EditorGUILayout.BeginFoldoutHeaderGroup(m_ShowAdditionnalCategory, Contents.otherSettings); - if (showAdditionnalCategory != m_ShowAdditionnalCategory) - { - m_ShowAdditionnalCategory = showAdditionnalCategory; - EditorPrefs.SetBool(kRendererAdditionnalSettingsFoldoutStatePreferenceName, m_ShowAdditionnalCategory); + bool useReflectionProbes = m_ReflectionProbeUsage != null && !m_ReflectionProbeUsage.hasMultipleDifferentValues && (ReflectionProbeUsage)m_ReflectionProbeUsage.intValue != ReflectionProbeUsage.Off; + bool lightProbesEnabled = m_LightProbeUsage != null && !m_LightProbeUsage.hasMultipleDifferentValues && (LightProbeUsage)m_LightProbeUsage.intValue != LightProbeUsage.Off; + bool needsProbeAnchor = useReflectionProbes || lightProbesEnabled; + + if (needsProbeAnchor) + EditorGUILayout.PropertyField(m_ProbeAnchor, Contents.lightProbeAnchorStyle); + } } - if (showAdditionnalCategory) + using (ShowSubHeader(Contents.otherSettings, m_ShowAdditionnalCategory, out m_ShowAdditionnalCategory, kRendererAdditionnalSettingsFoldoutStatePreferenceName)) { - if (m_RenderingLayerMask != null && GraphicsSettings.isScriptableRenderPipelineEnabled) + if (m_ShowAdditionnalCategory) { - var mask = m_Renderers[0].renderingLayerMask; - - EditorGUI.BeginChangeCheck(); - mask = EditorGUILayout.RenderingLayerMaskField(Contents.renderingLayerMaskStyle, mask); - if (EditorGUI.EndChangeCheck()) + if (m_RenderingLayerMask != null && GraphicsSettings.isScriptableRenderPipelineEnabled) { - Undo.RecordObjects(m_SerializedRenderers.targetObjects, "Set rendering layer mask"); - for (var i = 0; i < m_SerializedRenderers.targetObjects.Length; i++) + var mask = m_Renderers[0].renderingLayerMask; + + EditorGUI.BeginChangeCheck(); + mask = EditorGUILayout.RenderingLayerMaskField(Contents.renderingLayerMaskStyle, mask); + if (EditorGUI.EndChangeCheck()) { - var r = m_SerializedRenderers.targetObjects[i] as VFXRenderer; - if (r == null) - continue; - r.renderingLayerMask = mask; - EditorUtility.SetDirty(r); + Undo.RecordObjects(m_SerializedRenderers.targetObjects, "Set rendering layer mask"); + for (var i = 0; i < m_SerializedRenderers.targetObjects.Length; i++) + { + var r = m_SerializedRenderers.targetObjects[i] as VFXRenderer; + if (r == null) + continue; + r.renderingLayerMask = mask; + EditorUtility.SetDirty(r); + } } } - } - if (m_RendererPriority != null && SupportedRenderingFeatures.active.rendererPriority) - { - EditorGUILayout.PropertyField(m_RendererPriority, Contents.rendererPriorityStyle); - } + if (m_RendererPriority != null && SupportedRenderingFeatures.active.rendererPriority) + { + EditorGUILayout.PropertyField(m_RendererPriority, Contents.rendererPriorityStyle); + } - if (m_SortingOrder != null && m_SortingLayerID != null) - { - var hasPrefabOverride = HasPrefabOverride(m_SortingLayerID); - SortingLayerField(Contents.sortingLayerStyle, m_SortingLayerID, hasPrefabOverride ? Contents.boldPopupStyle : EditorStyles.popup, hasPrefabOverride ? EditorStyles.boldLabel : EditorStyles.label); - EditorGUILayout.PropertyField(m_SortingOrder, Contents.sortingOrderStyle); + if (m_SortingOrder != null && m_SortingLayerID != null) + { + var hasPrefabOverride = HasPrefabOverride(m_SortingLayerID); + SortingLayerField(Contents.sortingLayerStyle, m_SortingLayerID, hasPrefabOverride ? Contents.boldPopupStyle : EditorStyles.popup, hasPrefabOverride ? EditorStyles.boldLabel : EditorStyles.label); + EditorGUILayout.PropertyField(m_SortingOrder, Contents.sortingOrderStyle); + } } } - EditorGUILayout.EndFoldoutHeaderGroup(); - EditorStyles.inspectorDefaultMargins.padding.left = x; - EditorGUI.indentLevel -= 1; m_SerializedRenderers.ApplyModifiedProperties(); } @@ -1505,30 +1554,16 @@ protected static class Styles public static readonly GUIStyle toggleStyle; public static readonly GUIStyle toggleMixedStyle; - public static readonly GUIStyle categoryHeader; - public static readonly GUILayoutOption MiniButtonWidth = GUILayout.Width(56); - public static readonly GUILayoutOption PlayControlsHeight = GUILayout.Height(24); public const float overrideWidth = 16; static Styles() { var builtInSkin = GetCurrentSkin(); foldoutStyle = new GUIStyle(EditorStyles.foldout); - foldoutStyle.fontStyle = FontStyle.Bold; - toggleStyle = new GUIStyle(builtInSkin.GetStyle("ShurikenToggle")); toggleMixedStyle = new GUIStyle(builtInSkin.GetStyle("ShurikenCheckMarkMixed")); - categoryHeader = new GUIStyle(builtInSkin.label); - categoryHeader.fontStyle = FontStyle.Bold; - categoryHeader.border.left = 2; - categoryHeader.padding.left = 32; - categoryHeader.padding.top = 2; - categoryHeader.border.right = 2; - - //TODO change to editor resources calls - categoryHeader.normal.background = (Texture2D)AssetDatabase.LoadAssetAtPath(VisualEffectAssetEditorUtility.editorResourcesPath + (EditorGUIUtility.isProSkin ? "/VFX/cat-background-dark.png" : "/VFX/cat-background-light.png")); } } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/Collision/CollisionSDF.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/Collision/CollisionSDF.cs index 1c69f7bf7c4..4f451d3adbe 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/Collision/CollisionSDF.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/Collision/CollisionSDF.cs @@ -34,7 +34,7 @@ public override IEnumerable GetParameters(CollisionBase coll yield return p; } - + var w = new VFXExpressionCastUintToFloat(new VFXExpressionTextureWidth(SDF)); var h = new VFXExpressionCastUintToFloat(new VFXExpressionTextureHeight(SDF)); var d = new VFXExpressionCastUintToFloat(new VFXExpressionTextureDepth(SDF)); @@ -92,7 +92,16 @@ public override string GetSource(CollisionBase collisionBase) int i = 0; hit = false; float maxDist = length(tDelta * textureDimInvScale); - for(i = 0; i < ITERATION_COUNT; i++) + + int iterationCount = ITERATION_COUNT; + if(dist < VFX_EPSILON) + { + hit = true; + tHit = 0; + iterationCount = 0; + } + + for(i = 0; i < iterationCount; i++) { uvw = uvw + tDir * textureDimScale * dist; float newDist = colliderSign * (SampleSDF(DistanceField, uvw) - radiusOffset); @@ -119,14 +128,18 @@ public override string GetSource(CollisionBase collisionBase) string projectOnSurfaceCode = @" hit = true; - const int ITERATION_COUNT = 4; - int i = 0; + float3 uvw = saturate(tPos + 0.5f); float3 sdfNormal = normalize(SampleSDFUnscaledDerivatives(DistanceField, uvw, uvStep)); float radiusOffset = colliderSign * dot(sdfNormal*sdfNormal ,invScale * textureDimInvScale) * radius; + const int ITERATION_COUNT = 4; + int i = 0; for(i = 0; i < ITERATION_COUNT; i++) { + float dist = colliderSign * (SampleSDF(DistanceField, uvw) - radiusOffset); + if(abs(dist) < VFX_EPSILON) + break; uvw = IterateTowardSDFSurface(DistanceField, uvw, uvStep, radiusOffset, stepSizeMeter, sdfNormal); } tPos = uvw - 0.5f; @@ -136,7 +149,6 @@ public override string GetSource(CollisionBase collisionBase) tHit = 0; "; - var Source = new StringBuilder($@" if (isZeroScaled) return; diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/HLSL/CustomHLSL.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/HLSL/CustomHLSL.cs index 0f3a82ca75a..9a6df5fa796 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/HLSL/CustomHLSL.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/HLSL/CustomHLSL.cs @@ -235,7 +235,7 @@ public override void GetImportDependentAssets(HashSet dependencies) base.GetImportDependentAssets(dependencies); if (!ReferenceEquals(m_ShaderFile, null)) { - dependencies.Add(m_ShaderFile.GetInstanceID()); + dependencies.Add(m_ShaderFile.GetEntityId()); } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/Spawn/VFXSpawnerCustomWrapper.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/Spawn/VFXSpawnerCustomWrapper.cs index 3bfcf24416b..b9b5be9310f 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/Spawn/VFXSpawnerCustomWrapper.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/Spawn/VFXSpawnerCustomWrapper.cs @@ -86,7 +86,7 @@ public override void GetImportDependentAssets(HashSet dependencies) base.GetImportDependentAssets(dependencies); if (customBehavior != null) { - dependencies.Add(customBehavior.GetInstanceID()); + dependencies.Add(customBehavior.GetEntityId()); } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/VFXSubgraphBlock.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/VFXSubgraphBlock.cs index 4363f9986db..121cb483c8a 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/VFXSubgraphBlock.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/VFXSubgraphBlock.cs @@ -27,7 +27,7 @@ public override void GetImportDependentAssets(HashSet dependencies) base.GetImportDependentAssets(dependencies); if (!object.ReferenceEquals(m_Subgraph, null)) { - dependencies.Add(m_Subgraph.GetInstanceID()); + dependencies.Add(m_Subgraph.GetEntityId()); } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/Implementations/VFXComposedShading.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/Implementations/VFXComposedShading.cs index c7ee59cff23..0caf5788226 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/Implementations/VFXComposedShading.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/Implementations/VFXComposedShading.cs @@ -52,7 +52,7 @@ ShaderGraphVfxAsset GetOrRefreshShaderGraphObject(List<(string error, VFXErrorTy errors.Add(("DeprecatedOldShaderGraph", VFXErrorType.Error, ParticleShadingShaderGraph.kErrorOldSG)); currentShaderGraph = VFXResources.errorFallbackShaderGraph; - } + } else if (VFXLibrary.currentSRPBinder != null && !VFXLibrary.currentSRPBinder.IsShaderVFXCompatible(currentShaderGraph)) { if (errors != null) @@ -191,7 +191,7 @@ public override void GetImportDependentAssets(HashSet dependencies) base.GetImportDependentAssets(dependencies); if (!ReferenceEquals(shaderGraph, null)) { - dependencies.Add(shaderGraph.GetInstanceID()); + dependencies.Add(shaderGraph.GetEntityId()); } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/Implementations/VFXStaticMeshOutput.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/Implementations/VFXStaticMeshOutput.cs index 9dee93e077b..e634605c3de 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/Implementations/VFXStaticMeshOutput.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/Implementations/VFXStaticMeshOutput.cs @@ -64,7 +64,7 @@ private Shader GetOrRefreshShaderGraphObject(bool refreshErrors = true) var wasShaderGraphMissing = m_IsShaderGraphMissing; var meshShader = ((VFXDataMesh)GetData()).shader; //This is the only place where shader property is updated or read - if (meshShader == null && !object.ReferenceEquals(meshShader, null) && meshShader.GetInstanceID() != 0) + if (meshShader == null && !object.ReferenceEquals(meshShader, null) && meshShader.GetEntityId() != EntityId.None) { var assetPath = AssetDatabase.GetAssetPath(meshShader.GetEntityId()); @@ -109,7 +109,7 @@ public override void GetImportDependentAssets(HashSet dependencies) base.GetImportDependentAssets(dependencies); if (!object.ReferenceEquals(shader, null)) { - dependencies.Add(shader.GetInstanceID()); + dependencies.Add(shader.GetEntityId()); } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/VFXAbstractComposedParticleOutput.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/VFXAbstractComposedParticleOutput.cs index ad6480cf8e7..6c3a9ccd83e 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/VFXAbstractComposedParticleOutput.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/VFXAbstractComposedParticleOutput.cs @@ -421,11 +421,17 @@ public sealed override void CheckGraphBeforeImport() { if (m_Topology != null && m_Shading != null) { + var currentName = name; MarkCacheAsDirty(); base.CheckGraphBeforeImport(); if (!VFXGraph.explicitCompile) { - ResyncSlots(true); + bool slotChanged = ResyncSlots(true); + if (!slotChanged && currentName != name) + { + //`Invalidate(this, InvalidationCause.kUIChangedTransient)` won't trigger Modified/onModified + Invalidate(InvalidationCause.kUIChangedTransient); + } } } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/VFXContext.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/VFXContext.cs index cefa53d77a0..745bd795c05 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/VFXContext.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/VFXContext.cs @@ -449,6 +449,8 @@ protected static void InnerLink(VFXContext from, VFXContext to, int fromIndex, i } } + BreakCyclesVertical(from, to, notify); + if (VFXData.CanConvert(from.ownedType, to.ownedType) && from.ownedType.HasFlag(VFXDataType.Particle)) to.InnerSetData(from.GetData(), false); @@ -477,6 +479,95 @@ private static void InnerUnlink(VFXContext from, VFXContext to, int fromIndex = } } + private static readonly string k_BreakCycleWarning = "The newly connected edge created a cycle in the graph, disconnecting another edge."; + public static bool BreakCyclesVertical(VFXContext from, VFXContext to, bool notify) => BreakCyclesVertical(from, to, notify, new HashSet()); + + private static bool BreakCyclesVertical(VFXContext from, VFXContext to, bool notify, HashSet contexts, bool first = true) + { + bool found = false; + if (from == to) + { + found = true; + } + else if (!contexts.Contains(from)) + { + contexts.Add(from); + if (from is VFXBasicGPUEvent gpuEvent) + { + Debug.Assert(gpuEvent.inputSlots.Count == 1); + var fromSlot = from.inputSlots[0]; + foreach (var toSlot in fromSlot.LinkedSlots.ToArray()) // TODO: Remove copy + { + var block = toSlot.owner as VFXBlock; + if (BreakCyclesVertical(block.GetParent(), to, notify, contexts, false)) + { + // Try to break horizontal links that cause a cycle + if (first) + { + Debug.LogWarning(k_BreakCycleWarning); + fromSlot.Unlink(toSlot, notify); + } + found |= true; + } + } + } + else + { + foreach (var inputSlot in from.inputFlowSlot) + { + foreach (var link in inputSlot.link) + { + found |= BreakCyclesVertical(link.context, to, notify, contexts, first); + } + } + } + } + return found; + } + + public static bool BreakCyclesHorizontal(VFXContext from, VFXContext to, bool notify) => BreakCyclesHorizontal(from, to, notify, new HashSet()); + + private static bool BreakCyclesHorizontal(VFXContext from, VFXContext to, bool notify, HashSet contexts) + { + bool found = false; + if (!contexts.Contains(from)) + { + contexts.Add(from); + if (from is VFXBasicGPUEvent gpuEvent) + { + Debug.Assert(gpuEvent.inputSlots.Count == 1); + var fromSlot = from.inputSlots[0]; + foreach (var toSlot in fromSlot.LinkedSlots) + { + var block = toSlot.owner as VFXBlock; + found |= BreakCyclesHorizontal(block.GetParent(), to, notify, contexts); + } + } + else + { + for (int slotIndex = 0; slotIndex < from.inputFlowSlot.Length; ++slotIndex) + { + var inputSlot = from.inputFlowSlot[slotIndex]; + foreach (var link in inputSlot.link.ToArray()) + { + // Try to break vertical links that cause a cycle + if (link.context == to) + { + Debug.LogWarning(k_BreakCycleWarning); + InnerUnlink(link.context, from, link.slotIndex, slotIndex, notify); + found = true; + } + else + { + found |= BreakCyclesHorizontal(link.context, to, notify, contexts); + } + } + } + } + } + return found; + } + public VFXContextSlot[] inputFlowSlot { get { return m_InputFlowSlot == null ? new VFXContextSlot[] { } : m_InputFlowSlot; } } public VFXContextSlot[] outputFlowSlot { get { return m_OutputFlowSlot == null ? new VFXContextSlot[] { } : m_OutputFlowSlot; } } protected virtual int inputFlowCount { get { return 1; } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/VFXSubgraphContext.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/VFXSubgraphContext.cs index 27792a11ba2..5f4c87bd947 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/VFXSubgraphContext.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/VFXSubgraphContext.cs @@ -44,7 +44,7 @@ public override void GetImportDependentAssets(HashSet dependencies) base.GetImportDependentAssets(dependencies); if (!object.ReferenceEquals(m_Subgraph, null)) { - dependencies.Add(m_Subgraph.GetInstanceID()); + dependencies.Add(m_Subgraph.GetEntityId()); } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/Implementations/CustomHLSL.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/Implementations/CustomHLSL.cs index 1e3efc4d25d..d90b5bc27d8 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/Implementations/CustomHLSL.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/Implementations/CustomHLSL.cs @@ -228,7 +228,7 @@ public override void GetImportDependentAssets(HashSet dependencies) base.GetImportDependentAssets(dependencies); if (!ReferenceEquals(m_ShaderFile, null)) { - dependencies.Add(m_ShaderFile.GetInstanceID()); + dependencies.Add(m_ShaderFile.GetEntityId()); } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/Implementations/LookAt.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/Implementations/LookAt.cs index e4bd869d448..7a4d83bc7af 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/Implementations/LookAt.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/Implementations/LookAt.cs @@ -32,8 +32,8 @@ protected override VFXExpression[] BuildExpression(VFXExpression[] inputExpressi VFXExpression viewVector = to - from; - VFXExpression z = VFXOperatorUtility.Normalize(viewVector); - VFXExpression x = VFXOperatorUtility.Normalize(VFXOperatorUtility.Cross(up, z)); + VFXExpression z = VFXOperatorUtility.SafeNormalize(viewVector); + VFXExpression x = VFXOperatorUtility.SafeNormalize(VFXOperatorUtility.Cross(up, z)); VFXExpression y = VFXOperatorUtility.Cross(z, x); VFXExpression matrix = new VFXExpressionAxisToMatrix(x, y, z, from); diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/VFXSubgraphOperator.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/VFXSubgraphOperator.cs index cf4d5a66b39..99a8db383b3 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/VFXSubgraphOperator.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/VFXSubgraphOperator.cs @@ -191,7 +191,7 @@ public override void GetImportDependentAssets(HashSet dependencies) base.GetImportDependentAssets(dependencies); if (!object.ReferenceEquals(m_Subgraph, null)) { - dependencies.Add(m_Subgraph.GetInstanceID()); + dependencies.Add(m_Subgraph.GetEntityId()); } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs index 82503b02cdf..7333b3bb253 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs @@ -1710,6 +1710,7 @@ private VFXGraphCompiledData compiledData [SerializeField] private int m_ResourceVersion; + [NonSerialized] private bool m_GraphSanitized = false; private bool m_ExpressionGraphDirty = true; private bool m_ExpressionValuesDirty = true; diff --git a/Packages/com.unity.visualeffectgraph/Editor/ShaderGraph/VFXShaderGraphParticleOutput.cs b/Packages/com.unity.visualeffectgraph/Editor/ShaderGraph/VFXShaderGraphParticleOutput.cs index 1ecb6c294be..c683a1defb7 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/ShaderGraph/VFXShaderGraphParticleOutput.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/ShaderGraph/VFXShaderGraphParticleOutput.cs @@ -99,7 +99,7 @@ public override void GetImportDependentAssets(HashSet dependencies) base.GetImportDependentAssets(dependencies); if (!object.ReferenceEquals(shaderGraph, null)) { - dependencies.Add(shaderGraph.GetInstanceID()); + dependencies.Add(shaderGraph.GetEntityId()); } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/TemplateWindow/VFXTemplateHelperInternal.cs b/Packages/com.unity.visualeffectgraph/Editor/TemplateWindow/VFXTemplateHelperInternal.cs index 4c17b9c2c33..1a7dfedd433 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/TemplateWindow/VFXTemplateHelperInternal.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/TemplateWindow/VFXTemplateHelperInternal.cs @@ -1,6 +1,7 @@ using System; - +using System.Reflection; using UnityEditor.Experimental.GraphView; +using UnityEngine; namespace UnityEditor.VFX { @@ -35,6 +36,33 @@ public string OpenSaveFileDialog() public GraphViewTemplateWindow.ISaveFileDialogHelper saveFileDialogHelper { get; set; } = new SaveFileDialog(); + public static void ImportSampleDependencies(PackageManager.PackageInfo packageInfo, PackageManager.UI.Sample sample) + { + try + { + var sampleDependencyImporterType = typeof(Rendering.DebugState).Assembly.GetType("SampleDependencyImporter"); + var instanceProperty = sampleDependencyImporterType.GetProperty("instance", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static); + var importerInstance = instanceProperty.GetValue(null); + var importSampleDependenciesMethod = sampleDependencyImporterType.GetMethod( + "ImportSampleDependencies", + BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, + null, + new Type[] { typeof(PackageManager.PackageInfo), typeof(PackageManager.UI.Sample) }, + null); + importSampleDependenciesMethod.Invoke(importerInstance, new object[] { packageInfo, sample }); + } + catch (Exception e) + { + Debug.LogError("ImportSampleDependencies unexpected failure, SampleDependencyImporter might have been changed or has been moved."); + Debug.LogException(e); + } + } + + public void RaiseImportSampleDependencies(PackageManager.PackageInfo packageInfo, PackageManager.UI.Sample sample) + { + ImportSampleDependencies(packageInfo, sample); + } + /// /// This method is called each time a template is used. /// This is the good place to implement analytics diff --git a/Packages/com.unity.visualeffectgraph/Editor/UIResources/VFX/cat-background-dark.png b/Packages/com.unity.visualeffectgraph/Editor/UIResources/VFX/cat-background-dark.png deleted file mode 100644 index 4d10cda3334..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Editor/UIResources/VFX/cat-background-dark.png and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Editor/UIResources/VFX/cat-background-dark.png.meta b/Packages/com.unity.visualeffectgraph/Editor/UIResources/VFX/cat-background-dark.png.meta deleted file mode 100644 index 56dfd883e76..00000000000 --- a/Packages/com.unity.visualeffectgraph/Editor/UIResources/VFX/cat-background-dark.png.meta +++ /dev/null @@ -1,130 +0,0 @@ -fileFormatVersion: 2 -guid: d333db22a2cc31e48a5aba38045265db -TextureImporter: - internalIDToNameTable: [] - externalObjects: {} - serializedVersion: 13 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 1 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapsPreserveCoverage: 0 - alphaTestReferenceValue: 0.5 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - flipGreenChannel: 0 - isReadable: 0 - streamingMipmaps: 0 - streamingMipmapsPriority: 0 - vTOnly: 0 - ignoreMipmapLimit: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - serializedVersion: 2 - filterMode: 1 - aniso: 1 - mipBias: 0 - wrapU: 1 - wrapV: 1 - wrapW: 0 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spritePixelsToUnits: 100 - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spriteGenerateFallbackPhysicsShape: 1 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - singleChannelComponent: 0 - flipbookRows: 1 - flipbookColumns: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - ignorePngGamma: 0 - applyGammaDecoding: 1 - swizzle: 50462976 - cookieLightType: 1 - platformSettings: - - serializedVersion: 4 - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - ignorePlatformSupport: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 4 - buildTarget: Standalone - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - ignorePlatformSupport: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 4 - buildTarget: CloudRendering - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - ignorePlatformSupport: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - customData: - physicsShape: [] - bones: [] - spriteID: - internalID: 0 - vertices: [] - indices: - edges: [] - weights: [] - secondaryTextures: [] - spriteCustomMetadata: - entries: [] - nameFileIdTable: {} - mipmapLimitGroupName: - pSDRemoveMatte: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.visualeffectgraph/Editor/UIResources/VFX/cat-background-light.png b/Packages/com.unity.visualeffectgraph/Editor/UIResources/VFX/cat-background-light.png deleted file mode 100644 index c342a2795a8..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Editor/UIResources/VFX/cat-background-light.png and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Editor/UIResources/VFX/cat-background-light.png.meta b/Packages/com.unity.visualeffectgraph/Editor/UIResources/VFX/cat-background-light.png.meta deleted file mode 100644 index 5b3e648f33a..00000000000 --- a/Packages/com.unity.visualeffectgraph/Editor/UIResources/VFX/cat-background-light.png.meta +++ /dev/null @@ -1,130 +0,0 @@ -fileFormatVersion: 2 -guid: ccda2131ef139a440a193699457e1561 -TextureImporter: - internalIDToNameTable: [] - externalObjects: {} - serializedVersion: 13 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 1 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapsPreserveCoverage: 0 - alphaTestReferenceValue: 0.5 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - flipGreenChannel: 0 - isReadable: 0 - streamingMipmaps: 0 - streamingMipmapsPriority: 0 - vTOnly: 0 - ignoreMipmapLimit: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - serializedVersion: 2 - filterMode: 1 - aniso: 1 - mipBias: 0 - wrapU: 1 - wrapV: 1 - wrapW: 0 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spritePixelsToUnits: 100 - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spriteGenerateFallbackPhysicsShape: 1 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - singleChannelComponent: 0 - flipbookRows: 1 - flipbookColumns: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - ignorePngGamma: 0 - applyGammaDecoding: 1 - swizzle: 50462976 - cookieLightType: 1 - platformSettings: - - serializedVersion: 4 - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - ignorePlatformSupport: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 4 - buildTarget: Standalone - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - ignorePlatformSupport: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 4 - buildTarget: CloudRendering - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - ignorePlatformSupport: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - customData: - physicsShape: [] - bones: [] - spriteID: - internalID: 0 - vertices: [] - indices: - edges: [] - weights: [] - secondaryTextures: [] - spriteCustomMetadata: - entries: [] - nameFileIdTable: {} - mipmapLimitGroupName: - pSDRemoveMatte: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXFilterWindow.uss b/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXFilterWindow.uss index 78f41cf7ec7..6ebce066842 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXFilterWindow.uss +++ b/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXFilterWindow.uss @@ -112,6 +112,7 @@ Label { padding: 0; flex-grow: 0; color: var(--unity-colors-default-text); + white-space: pre; } .nodes-label-spacer { diff --git a/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VisualEffectAssetEditor.uss b/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VisualEffectAssetEditor.uss index dacd20e36d0..412c1345012 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VisualEffectAssetEditor.uss +++ b/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VisualEffectAssetEditor.uss @@ -1,12 +1,25 @@ .inspector-header { - -unity-font-style: bold; - margin: 4px 0; - height: 19px; - padding-left: 32px; + margin: 0 -4px 4px 0; + padding: 0 4px 0 15px; -unity-text-align: middle-left; +} + +.inspector-header > .unity-foldout__toggle { + margin: 0 0px 4px -15px; + padding-left: 4px; + height: 21px; border-width: 1px 0 0 0; border-color: var(--unity-colors-default-border); - background-color: var(--unity-colors-tab-background); + background-color: var(--unity-colors-inspector_titlebar-background); +} + +.inspector-header > .unity-foldout__toggle:hover { + background-color: var(--unity-colors-inspector_titlebar-background-hover); +} + +.inspector-header > .unity-foldout__toggle Label { + margin-left: 16px; + -unity-font-style: bold; } .unity-base-text-field__input--multiline { @@ -14,3 +27,4 @@ max-height: 128px; white-space: normal; } + diff --git a/Packages/com.unity.visualeffectgraph/Editor/VFXAnalytics.cs b/Packages/com.unity.visualeffectgraph/Editor/VFXAnalytics.cs index b0f061680b8..2bfd029af48 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/VFXAnalytics.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/VFXAnalytics.cs @@ -123,7 +123,7 @@ public void UpdateGraphData(VFXView view) return; } - var instanceId = view.controller.model.asset.GetInstanceID(); + var instanceId = view.controller.model.asset.GetEntityId(); var graphInfo = openedGraphInfo.SingleOrDefault(x => x.graph_id == instanceId); if (graphInfo.graph_id > 0) { diff --git a/Packages/com.unity.visualeffectgraph/Editor/VFXAssetEditorUtility.cs b/Packages/com.unity.visualeffectgraph/Editor/VFXAssetEditorUtility.cs index ef0e7893ee3..2512589d565 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/VFXAssetEditorUtility.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/VFXAssetEditorUtility.cs @@ -180,7 +180,7 @@ public override void Action(EntityId entityId, string pathName, string resourceF { CreateTemplateAsset(pathName, templatePath); var resource = VisualEffectResource.GetResourceAtPath(pathName); - ProjectWindowUtil.FrameObjectInProjectWindow(resource.asset.GetInstanceID()); + ProjectWindowUtil.FrameObjectInProjectWindow(resource.asset.GetEntityId()); } } @@ -189,7 +189,7 @@ internal class DoCreateNewSubgraphOperator : AssetCreationEndAction public override void Action(EntityId entityId, string pathName, string resourceFile) { var sg = CreateNew(pathName); - ProjectWindowUtil.FrameObjectInProjectWindow(sg.GetInstanceID()); + ProjectWindowUtil.FrameObjectInProjectWindow(sg.GetEntityId()); } } @@ -242,7 +242,7 @@ public static void CreateVisualEffectSubgraph(string fileName, string temp { templateString = System.IO.File.ReadAllText(templatePath + templateName); - ProjectWindowUtil.CreateAssetWithContent(fileName, templateString, texture); + ProjectWindowUtil.CreateAssetWithTextContent(fileName, templateString, texture); } catch (System.Exception e) { diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/AngularVelocity.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/AngularVelocity.vfx.meta index 5f2f864a227..b0ca76ce65f 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/AngularVelocity.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/AngularVelocity.vfx.meta @@ -8,7 +8,7 @@ VisualEffectImporter: category: Learning Templates description: This VFX explains the usage of the Angular velocity attribute that can be used to control particles rotation. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 711415350ba8e734199e4d3ef52f18c6, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/BasicTexIndex.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/BasicTexIndex.vfx.meta index 762d7261ae4..6a5fb348df8 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/BasicTexIndex.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/BasicTexIndex.vfx.meta @@ -8,7 +8,7 @@ VisualEffectImporter: category: Learning Templates description: This VFX shows how to set the output settings to use a flipbook and their relationship with the texIndex attribute. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: ec5b3fc4b1b065c48aa4944f0496294a, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/BoundsGizmo.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/BoundsGizmo.vfx.meta index 7e0e227d529..698da5c8555 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/BoundsGizmo.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/BoundsGizmo.vfx.meta @@ -9,7 +9,7 @@ VisualEffectImporter: description: The Bounds are used to cull the VFX when it's not in the camera frustum. This VFX explains the importance of Bounds and how to properly set them. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: ebac51e649dc3cd418ec7486775452ad, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/Capacity.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/Capacity.vfx.meta index cb6ecbc9c66..3dabbdaf593 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/Capacity.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/Capacity.vfx.meta @@ -9,7 +9,7 @@ VisualEffectImporter: description: 'Capacity Count is used for the particle Memory allocation of a system. This VFX explains what capacity is and how to use the VFX Control to set the Capacity. ' - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 4564276fcad6d6c4fba693a4a9552555, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/CollisionAdvanced.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/CollisionAdvanced.vfx.meta index 9c36bfe6df3..1dafe3bb6aa 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/CollisionAdvanced.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/CollisionAdvanced.vfx.meta @@ -8,7 +8,7 @@ VisualEffectImporter: category: Learning Templates description: This VFX explains how to use a Signed Distance Field Collider, which can be very useful when you want particles to collide with complex shapes. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 009b7316c3ad821499a08d63c2b179e4, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/CollisionBasicProperties.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/CollisionBasicProperties.vfx.meta index 1d8c6f26d9c..c34177cb1ea 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/CollisionBasicProperties.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/CollisionBasicProperties.vfx.meta @@ -9,7 +9,7 @@ VisualEffectImporter: description: This VFX Graph, shows the use of a standard Collider Block and how the different Collision Properties like Bounce, Friction and/or Roughness can influence the collision response of the particles. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: c95ee797abda9044db03398c3f647520, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/CollisionSimple.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/CollisionSimple.vfx.meta index f9d040eea26..17ff4eb7ec2 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/CollisionSimple.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/CollisionSimple.vfx.meta @@ -8,7 +8,7 @@ VisualEffectImporter: category: Learning Templates description: This VFX shows some usage of the different collider blocks available to allow particles to collide with simple shapes. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: de6ccea3a4ae74245b8f069b29a51210, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/Context&Flow.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/Context&Flow.vfx.meta index c6829b4657e..1fb4defd9b6 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/Context&Flow.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/Context&Flow.vfx.meta @@ -9,7 +9,7 @@ VisualEffectImporter: description: This VFX is intended to provide an overview and basic understanding of how data flow is articulated in VFX Graph. It also presents an overview of the most frequently used Context Blocks. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 7fe3e7cbc6de1f9479895e82ad729e23, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/DecalParticles.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/DecalParticles.vfx.meta index 1b3c024a04d..e0c208a5fbb 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/DecalParticles.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/DecalParticles.vfx.meta @@ -8,7 +8,7 @@ VisualEffectImporter: category: Learning Templates description: This example shows how to leverage the Decal Output to stick and project animated decals onto an animated skinned mesh renderer. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 79996b38f37551f40bad61027b8f1e0b, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/FlipbookBlending.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/FlipbookBlending.vfx.meta index 1c6e108f7f0..bbd7e318ede 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/FlipbookBlending.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/FlipbookBlending.vfx.meta @@ -8,7 +8,7 @@ VisualEffectImporter: category: Learning Templates description: This VFX illustrates the differences between a traditional frame blending and a frame blending using motion vectors. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 952793e298fc73447af1c50dbaaeae35, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/FlipbookMode.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/FlipbookMode.vfx.meta index 4dbe3496d86..44b2fcc7fad 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/FlipbookMode.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/FlipbookMode.vfx.meta @@ -9,7 +9,7 @@ VisualEffectImporter: description: 'This VFX shows how to set up the output settings to use a Sprite sheet. It also shows the differences between Flipbook Uvs and Flipbook Blend Uvs and the basic usage of the Flipbook Player Block to animate the texture. ' - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 519de46f323653c4ba92a6e1c1ac56df, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultiStripGPUEvents.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultiStripGPUEvents.vfx.meta index 3d520ec41ca..76e4d225d29 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultiStripGPUEvents.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultiStripGPUEvents.vfx.meta @@ -12,7 +12,7 @@ VisualEffectImporter: the creation of one strip per Parent''s particle when dealing with trigger events. Each headphone jack is made of a particle mesh and spawns particles along its path. ' - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 1e7dce32229b8194691947a4f42f7b70, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultiStripSingleBurst.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultiStripSingleBurst.vfx.meta index ab5b5c971e2..da894b78188 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultiStripSingleBurst.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultiStripSingleBurst.vfx.meta @@ -10,7 +10,7 @@ VisualEffectImporter: strips, this can have some implications for how you need to set up your VFX. This example shows you how to make multiple trails with one single burst of particles. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 19ccc7b20971d2948ba209ca9352967d, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultiStripsPeriodicBurst.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultiStripsPeriodicBurst.vfx.meta index b29a935f8eb..99d1d43a286 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultiStripsPeriodicBurst.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultiStripsPeriodicBurst.vfx.meta @@ -10,7 +10,7 @@ VisualEffectImporter: strips, this can have some implications for how you need to set up your VFX. This example shows you how to make a new trail for each periodic burst within a single VFX system. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: ae0d422301fa1ef47871f86b8c7f2ad4, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultiStripsSpawnRate.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultiStripsSpawnRate.vfx.meta index f9a355bc1eb..420dd8f51b0 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultiStripsSpawnRate.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultiStripsSpawnRate.vfx.meta @@ -10,7 +10,7 @@ VisualEffectImporter: strips, this can have some implications for how you need to set up your VFX. This example shows you how to make multiple trails out of a continuous spawn rate of particles. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: fe70339a289765e48b1d8950b4737299, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultipleOutputs.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultipleOutputs.vfx.meta index 368ddd012c5..0f2b03ed68b 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultipleOutputs.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultipleOutputs.vfx.meta @@ -8,7 +8,7 @@ VisualEffectImporter: category: Learning Templates description: This VFX Graph shows how you can add several outputs to render each particle multiple times. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 1ac2a2a6763112b4ea3929fb00f980ba, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/OrientAdvanced.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/OrientAdvanced.vfx.meta index 35d6655fc19..434a93207c3 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/OrientAdvanced.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/OrientAdvanced.vfx.meta @@ -8,7 +8,7 @@ VisualEffectImporter: category: Learning Templates description: This example shows how to use the Advanced mode of the orient block, which allows you to control how a particle is being oriented. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: fa359bb45eebf334abfc735206cd5e80, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/OrientFaceCamera.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/OrientFaceCamera.vfx.meta index 0554ef6b56c..2fc868f602c 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/OrientFaceCamera.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/OrientFaceCamera.vfx.meta @@ -8,7 +8,7 @@ VisualEffectImporter: category: Learning Templates description: This VFX is an example to demonstrate the use of the Orient Block and how to make particles always face the camera's position. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: f3ff69036f241894985f257fb3924148, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/OrientFixedAxis.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/OrientFixedAxis.vfx.meta index a82595b247b..7b95c5ea581 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/OrientFixedAxis.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/OrientFixedAxis.vfx.meta @@ -9,7 +9,7 @@ VisualEffectImporter: description: This VFX is an example to demonstrate the use of the Orient Block and to align particles in a specific direction while still facing the camera plane. This mode is often used for rendering particles of grass. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 04febbab5a711e04aa699f6fd56723c8, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/PivotAdvanced.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/PivotAdvanced.vfx.meta index b9d13a77fa8..260c830f9f4 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/PivotAdvanced.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/PivotAdvanced.vfx.meta @@ -9,7 +9,7 @@ VisualEffectImporter: description: 'This VFX gives an example of how to manipulate the pivot of your particle to get interesting motion. This example also demonstrates the ShaderGraph integration and how you can control ShaderGraph through VFX Graph. ' - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 29251384520d95f4fa010437bf43287e, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/PivotAttribute.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/PivotAttribute.vfx.meta index 3d956ddd5c9..aee79c08bb8 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/PivotAttribute.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/PivotAttribute.vfx.meta @@ -8,7 +8,7 @@ VisualEffectImporter: category: Learning Templates description: The VFX is a basic example to help understand what the particle pivot attribute is and how to manipulate it. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: f297419265452a34ab1ce86a44ca54f4, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/RotationAngle.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/RotationAngle.vfx.meta index 754b589acdc..c73eb4848fc 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/RotationAngle.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/RotationAngle.vfx.meta @@ -8,7 +8,7 @@ VisualEffectImporter: category: Learning Templates description: It's often really useful to be able to rotate particles. This VFX shows how to rotate particles thanks to the Angle attribute. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 0fb02ec51733f84499bed29bbbb0b51e, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SampleMesh.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SampleMesh.vfx.meta index 414dd285608..315c57a66c4 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SampleMesh.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SampleMesh.vfx.meta @@ -8,7 +8,7 @@ VisualEffectImporter: category: Learning Templates description: This VFX gives an example of how to sample a Mesh to spawn particles on its surface and inherit its Vertex Color. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: cf5431c245bed834286ccdc9b3fd2622, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SampleSDF.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SampleSDF.vfx.meta index 548eb50a72b..34ddf48f8fd 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SampleSDF.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SampleSDF.vfx.meta @@ -8,7 +8,7 @@ VisualEffectImporter: category: Learning Templates description: 'This VFX demonstrates how to sample an SDF to have particles crawling on the surface of a mesh. ' - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: a3c11027cf8e8584b96716d5079df100, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SampleSkinnedMesh.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SampleSkinnedMesh.vfx.meta index 9d56a0f5cbf..1c8adb8b1ea 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SampleSkinnedMesh.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SampleSkinnedMesh.vfx.meta @@ -8,7 +8,7 @@ VisualEffectImporter: category: Learning Templates description: This basic example shows how to sample a Skinned Mesh and spawn particles on its surface. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 57b45e399d8fe394a98a5675906c287d, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SampleTexture2D.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SampleTexture2D.vfx.meta index 9df6053f7a8..a74f2ef70d4 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SampleTexture2D.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SampleTexture2D.vfx.meta @@ -8,7 +8,7 @@ VisualEffectImporter: category: Learning Templates description: This VFX demonstrates how to use the texture2D sample operator to determine the color of particles and perform rejection sampling. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 3d351a536d397c14ab916464f774d4f2, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SpawnContext.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SpawnContext.vfx.meta index 3b760717125..dce409318db 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SpawnContext.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SpawnContext.vfx.meta @@ -9,7 +9,7 @@ VisualEffectImporter: description: This VFX is intended to provide information related to the Spawn Contex. What is the Spawn Context, what options can be found in the inspector but also extra informations - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 92301f5ec2ae13446a380b57f6d3614f, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/StripGPUEvent.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/StripGPUEvent.vfx.meta index ace1846b14e..8a8494da4fa 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/StripGPUEvent.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/StripGPUEvent.vfx.meta @@ -12,7 +12,7 @@ VisualEffectImporter: strips. This example shows an example of a growing mushroom's VFX, with the mushroom\u2019s hat being particle meshes and the mushroom\u2019s foot made with particle strips." - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 9ffdc5aacc959004da707eadc155e7ef, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/StripProperties.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/StripProperties.vfx.meta index 9d7f6311331..e141ed3c8ec 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/StripProperties.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/StripProperties.vfx.meta @@ -11,7 +11,7 @@ VisualEffectImporter: to draw a quad between each particle. This example demonstrates a straightforward Strip setup. It explains the various strip properties and attributes that control its visual appearance and behavior. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 4dbffa047362c514b908a7a03ae268c0, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/StripSpawnRate.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/StripSpawnRate.vfx.meta index cbafb150da5..7d1d2483347 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/StripSpawnRate.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/StripSpawnRate.vfx.meta @@ -10,7 +10,7 @@ VisualEffectImporter: strips, this can have some implications for how you need to set up your VFX. This example shows you how to make a single trail out of a continuous spawn rate of particles. ' - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 2d93269a4dab963498f57d6e5b488bb1, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/TexIndexAdvanced.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/TexIndexAdvanced.vfx.meta index 2b940c2cb78..9f147caf541 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/TexIndexAdvanced.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/TexIndexAdvanced.vfx.meta @@ -9,7 +9,7 @@ VisualEffectImporter: description: 'This complex VFX is composed of several systems that are playing with the texIndex attribute in a creative way in order to: Control the texIndex thanks to time, noise, and even particle position. ' - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 80592822edf375347952a1be729773d2, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/TriggerEventCollide.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/TriggerEventCollide.vfx.meta index c876f71dafb..92d705cc1cb 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/TriggerEventCollide.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/TriggerEventCollide.vfx.meta @@ -8,7 +8,7 @@ VisualEffectImporter: category: Learning Templates description: This VFX is displaying an advanced usage of the Trigger on Collide block that allows you to spawn particles when the particle collides. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: af98832125f677e4abbc689a14b778b9, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/package.json b/Packages/com.unity.visualeffectgraph/package.json index 41bd8b8dd6f..05e9a2a915e 100644 --- a/Packages/com.unity.visualeffectgraph/package.json +++ b/Packages/com.unity.visualeffectgraph/package.json @@ -1,8 +1,8 @@ { "name": "com.unity.visualeffectgraph", "displayName": "Visual Effect Graph", - "version": "17.4.0", - "unity": "6000.4", + "version": "17.5.0", + "unity": "6000.5", "description": "The Visual Effect Graph is a node based visual effect editor. It allows you to author next generation visual effects that Unity simulates directly on the GPU. The Visual Effect Graph is production-ready for the High Definition Render Pipeline and runs on all platforms supported by it. Full support for the Universal Render Pipeline and compatible mobile devices is still in development.", "keywords": [ "vfx", @@ -12,8 +12,8 @@ "particles" ], "dependencies": { - "com.unity.shadergraph": "17.4.0", - "com.unity.render-pipelines.core": "17.4.0" + "com.unity.shadergraph": "17.5.0", + "com.unity.render-pipelines.core": "17.5.0" }, "samples": [ { diff --git a/Tests/SRPTests/Packages/com.unity.testing.brg/Scripts/RenderBRG.cs b/Tests/SRPTests/Packages/com.unity.testing.brg/Scripts/RenderBRG.cs index fc954bf83f2..e2084bb145c 100644 --- a/Tests/SRPTests/Packages/com.unity.testing.brg/Scripts/RenderBRG.cs +++ b/Tests/SRPTests/Packages/com.unity.testing.brg/Scripts/RenderBRG.cs @@ -117,7 +117,6 @@ public unsafe class RenderBRG : MonoBehaviour private BatchRendererGroup m_BatchRendererGroup; private GraphicsBuffer m_GPUPersistentInstanceData; - private GraphicsBuffer m_Globals; private bool m_initialized; @@ -813,12 +812,6 @@ void Start() m_drawBatches = new NativeList(Allocator.Persistent); m_drawRanges = new NativeList(Allocator.Persistent); - // Fill global data (shared between all batches) - m_Globals = new GraphicsBuffer(GraphicsBuffer.Target.Constant, - 1, - UnsafeUtility.SizeOf()); - m_Globals.SetData(new [] { BatchRendererGroupGlobals.Default }); - m_brgBufferTarget = BatchRendererGroup.BufferTarget; m_instances = new NativeList(1024, Allocator.Persistent); @@ -1167,10 +1160,6 @@ private static void ExtractMatrices( void Update() { - // TODO: Implement delta update for transforms - // https://docs.unity3d.com/ScriptReference/Transform-hasChanged.html - // https://docs.unity3d.com/ScriptReference/Jobs.TransformAccess.html - Shader.SetGlobalConstantBuffer(BatchRendererGroupGlobals.kGlobalsPropertyId, m_Globals, 0, m_Globals.stride); } private void OnDisable() @@ -1182,7 +1171,6 @@ private void OnDisable() if (m_initialized) { m_GPUPersistentInstanceData.Dispose(); - m_Globals.Dispose(); m_renderers.Dispose(); m_pickingIDs.Dispose(); diff --git a/Tests/SRPTests/Packages/com.unity.testing.urp/Scripts/Editor/MultipleViewGCTest.cs b/Tests/SRPTests/Packages/com.unity.testing.urp/Scripts/Editor/MultipleViewGCTest.cs index 798ea1366fc..731084a73d8 100644 --- a/Tests/SRPTests/Packages/com.unity.testing.urp/Scripts/Editor/MultipleViewGCTest.cs +++ b/Tests/SRPTests/Packages/com.unity.testing.urp/Scripts/Editor/MultipleViewGCTest.cs @@ -4,6 +4,7 @@ using UnityEngine.Profiling; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; +using UnityEngine.TestTools; [TestFixture] public class MultipleViewGCTest : MonoBehaviour @@ -46,9 +47,15 @@ public void SetUp() m_RenderRequest = new UniversalRenderPipeline.SingleCameraRequest { destination = m_RenderTexture }; - // Render first frame where gc is ok - m_sceneView.Repaint(); - RenderPipeline.SubmitRenderRequest(Camera.main, m_RenderRequest); + // Render a couple of frames to absorb any transitory GC allocations + // See https://unity.slack.com/archives/C02LJ5VSV97/p1761922938875599 + const int numFramesToWarmup = 3; + + for (int i = 0; i < numFramesToWarmup; i++) + { + m_sceneView.Repaint(); + RenderPipeline.SubmitRenderRequest(Camera.main, m_RenderRequest); + } } [OneTimeTearDown] @@ -58,6 +65,9 @@ public void TearDown() } [Test] + [UnityPlatform(exclude = new RuntimePlatform[] { + RuntimePlatform.WindowsEditor // Disabled for Instability https://jira.unity3d.com/browse/UUM-125567 + })] public void RenderSceneAndGameView() { Profiler.BeginSample("GC_Alloc_URP_MultipleViews"); diff --git a/Tests/SRPTests/Packages/com.unity.testing.urp/Scripts/Runtime/OutputTextureFeature.cs b/Tests/SRPTests/Packages/com.unity.testing.urp/Scripts/Runtime/OutputTextureFeature.cs index 8be40a8340b..765a2c7b3db 100644 --- a/Tests/SRPTests/Packages/com.unity.testing.urp/Scripts/Runtime/OutputTextureFeature.cs +++ b/Tests/SRPTests/Packages/com.unity.testing.urp/Scripts/Runtime/OutputTextureFeature.cs @@ -55,7 +55,7 @@ class OutputTexturePass : ScriptableRenderPass public OutputTexturePass(string profilerTag) { - m_ProfilingSampler = new ProfilingSampler(profilerTag); + profilingSampler = new ProfilingSampler(profilerTag); m_PassData = new PassData(); } @@ -69,7 +69,6 @@ public void Setup(ScriptableRenderer renderer, Material material, ScriptableRend private class PassData { - internal ProfilingSampler profilingSampler; internal Material material; internal Vector4 outputAdjust; } @@ -78,11 +77,10 @@ private class PassData static readonly int s_CameraNormalsTextureID = Shader.PropertyToID("_CameraNormalsTexture"); private static void ExecutePass(PassData passData, RasterCommandBuffer cmd) { - using (new ProfilingScope(cmd, passData.profilingSampler)) - { + passData.material.SetVector(s_OutputAdjustParamsID, passData.outputAdjust); Blitter.BlitTexture(cmd, Vector2.one, passData.material, 0); - } + } public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) @@ -90,14 +88,13 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer UniversalResourceData resourceData = frameData.Get(); UniversalCameraData cameraData = frameData.Get(); - using (var builder = renderGraph.AddRasterRenderPass("Output Texture Pass", out var passData, m_ProfilingSampler)) + using (var builder = renderGraph.AddRasterRenderPass("Output Texture Pass", out var passData, profilingSampler)) { builder.UseAllGlobalTextures(true); builder.SetRenderAttachment(resourceData.activeColorTexture, 0, AccessFlags.Write); builder.AllowPassCulling(false); - passData.profilingSampler = m_ProfilingSampler; passData.material = m_Material; passData.outputAdjust = m_OutputAdjustParams; diff --git a/Tests/SRPTests/Packages/com.unity.testing.urp/Scripts/Runtime/UniversalGraphicsTestBase.cs b/Tests/SRPTests/Packages/com.unity.testing.urp/Scripts/Runtime/UniversalGraphicsTestBase.cs index 4d7516de39f..3062bb20c5d 100644 --- a/Tests/SRPTests/Packages/com.unity.testing.urp/Scripts/Runtime/UniversalGraphicsTestBase.cs +++ b/Tests/SRPTests/Packages/com.unity.testing.urp/Scripts/Runtime/UniversalGraphicsTestBase.cs @@ -20,46 +20,21 @@ namespace Unity.Rendering.Universal.Tests { public class UniversalGraphicsTestBase { - protected readonly RenderGraphGlobalContext renderGraphContext; - protected readonly RenderGraphContext requestedRGContext; - protected readonly RenderGraphContext previousRGContext; - protected readonly GpuResidentDrawerGlobalContext gpuResidentDrawerContext; protected readonly GpuResidentDrawerContext requestedGRDContext; protected readonly GpuResidentDrawerContext previousGRDContext; - public UniversalGraphicsTestBase(RenderGraphContext rgContext) - : this(rgContext, GpuResidentDrawerContext.None) + public UniversalGraphicsTestBase(GpuResidentDrawerContext grdContext) { - requestedGRDContext = previousGRDContext; - - GraphicsTestLogger.DebugLog($"RenderGraphContext: {requestedRGContext}"); - GraphicsTestLogger.DebugLog($"GpuResidentDrawerContext: {requestedGRDContext}"); - } - - public UniversalGraphicsTestBase( - RenderGraphContext rgContext, - GpuResidentDrawerContext grdContext - ) - { - requestedRGContext = rgContext; requestedGRDContext = grdContext; - // Register context - renderGraphContext = - GlobalContextManager.RegisterGlobalContext(typeof(RenderGraphGlobalContext)) - as RenderGraphGlobalContext; - gpuResidentDrawerContext = GlobalContextManager.RegisterGlobalContext(typeof(GpuResidentDrawerGlobalContext)) as GpuResidentDrawerGlobalContext; - // Cache previous state to avoid state leak - previousRGContext = (RenderGraphContext)renderGraphContext.Context; previousGRDContext = (GpuResidentDrawerContext)gpuResidentDrawerContext.Context; // Activate new context - renderGraphContext.ActivateContext(requestedRGContext); gpuResidentDrawerContext.ActivateContext(requestedGRDContext); } @@ -78,18 +53,14 @@ public IEnumerator OneTimeSetup() [SetUp] public void SetUpContext() { - renderGraphContext.ActivateContext(requestedRGContext); gpuResidentDrawerContext.ActivateContext(requestedGRDContext); - GlobalContextManager.AssertContextIs(requestedRGContext); GlobalContextManager.AssertContextIs(requestedGRDContext); } [TearDown] public void TearDown() { - GlobalContextManager.AssertContextIs(requestedRGContext); - Debug.ClearDeveloperConsole(); #if ENABLE_VR XRGraphicsAutomatedTests.running = false; @@ -101,10 +72,8 @@ public void OneTimeTearDown() { SceneManager.LoadScene("GraphicsTestTransitionScene", LoadSceneMode.Single); - renderGraphContext.ActivateContext(previousRGContext); gpuResidentDrawerContext.ActivateContext(previousGRDContext); - GlobalContextManager.UnregisterGlobalContext(typeof(RenderGraphGlobalContext)); GlobalContextManager.UnregisterGlobalContext(typeof(GpuResidentDrawerGlobalContext)); } } @@ -116,14 +85,12 @@ public static IEnumerable FixtureParams get { yield return new TestFixtureData( - RenderGraphContext.RenderGraphMode, GpuResidentDrawerContext.GRDDisabled ); if (GraphicsTestPlatform.Current.IsEditorPlatform) { yield return new TestFixtureData( - RenderGraphContext.RenderGraphMode, GpuResidentDrawerContext.GRDEnabled ); } diff --git a/Tests/SRPTests/Packages/com.unity.testing.urp/Scripts/Runtime/UniversalGraphicsTests.cs b/Tests/SRPTests/Packages/com.unity.testing.urp/Scripts/Runtime/UniversalGraphicsTests.cs index 6b446718d23..8a0df1234e0 100644 --- a/Tests/SRPTests/Packages/com.unity.testing.urp/Scripts/Runtime/UniversalGraphicsTests.cs +++ b/Tests/SRPTests/Packages/com.unity.testing.urp/Scripts/Runtime/UniversalGraphicsTests.cs @@ -23,31 +23,6 @@ public static class UniversalGraphicsTests static bool wasFirstSceneRan = false; const int firstSceneAdditionalFrames = 3; #endif - - private static bool GPUResidentDrawerRequested() - { - bool forcedOn = false; - foreach (var arg in Environment.GetCommandLineArgs()) - { - if ( - arg.Equals( - "-force-gpuresidentdrawer", - StringComparison.InvariantCultureIgnoreCase - ) - ) - { - forcedOn = true; - break; - } - } - - var renderPipelineAsset = GraphicsSettings.currentRenderPipeline; - if (renderPipelineAsset is IGPUResidentRenderPipeline mbAsset) - return forcedOn || mbAsset.gpuResidentDrawerMode != GPUResidentDrawerMode.Disabled; - - return false; - } - public static IEnumerator RunGraphicsTest(SceneGraphicsTestCase testCase) { Watermark.showDeveloperWatermark = false; @@ -79,20 +54,6 @@ public static IEnumerator RunGraphicsTest(SceneGraphicsTestCase testCase) XRDevice.DisableAutoXRCameraTracking(Camera.main, true); #endif - - if (!settings.gpuDrivenCompatible && GPUResidentDrawerRequested()) - Assert.Ignore("Test scene is not compatible with GPU Driven and and will be skipped."); - - // Check for RenderGraph compatibility and skip test if needed. - bool isUsingRenderGraph = RenderGraphGlobalContext.IsRenderGraphActive(); - - if (isUsingRenderGraph && settings.renderBackendCompatibility == - UniversalGraphicsTestSettings.RenderBackendCompatibility.NonRenderGraph) - Assert.Ignore("Test scene is not compatible with Render Graph and will be skipped."); - else if (!isUsingRenderGraph && settings.renderBackendCompatibility == - UniversalGraphicsTestSettings.RenderBackendCompatibility.RenderGraph) - Assert.Ignore("Test scene is not compatible with non-Render Graph and will be skipped."); - int waitFrames = 1; // for OCULUS_SDK or OPENXR_SDK, this ensures we wait for a reliable image rendering before screen capture and image comparison diff --git a/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/Data/Repro_114261.unitypackage b/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/Data/Repro_114261.unitypackage new file mode 100644 index 00000000000..890aab574d0 --- /dev/null +++ b/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/Data/Repro_114261.unitypackage @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:de336b15867e0b4bc642367631c7b5a92fd788137673aeeafe2d0dd0340d2974 +size 8407 diff --git a/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/360_Shader_Graphs_UITK.unity.meta b/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/Data/Repro_114261.unitypackage.meta similarity index 74% rename from Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/360_Shader_Graphs_UITK.unity.meta rename to Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/Data/Repro_114261.unitypackage.meta index 62d5f19143b..d0e474eaee5 100644 --- a/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/360_Shader_Graphs_UITK.unity.meta +++ b/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/Data/Repro_114261.unitypackage.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 131227f8302d12c49aa595b7f090a7a7 +guid: 1e6864d5f25f95f40b7b3df2ba067e83 DefaultImporter: externalObjects: {} userData: diff --git a/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/VFXAdditionalPackageTest.cs b/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/VFXAdditionalPackageTest.cs index 60cb9400ede..18ea4c1b569 100644 --- a/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/VFXAdditionalPackageTest.cs +++ b/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/VFXAdditionalPackageTest.cs @@ -18,6 +18,16 @@ public class VFXAdditionalPackageTest private static readonly string kSampleExpectedPath = "Assets/Samples"; + [Test] + public void ImportSampleDependencies_Reflection_Still_Valid() + { + var packageInfo = PackageManager.PackageInfo.FindForAssetPath(VisualEffectGraphPackageInfo.assetPackagePath); + var sample = Sample.FindByPackage(VisualEffectGraphPackageInfo.name, null).FirstOrDefault(); + Assert.IsNotNull(packageInfo); + Assert.IsNotNull(sample); + VFXTemplateHelperInternal.ImportSampleDependencies(packageInfo, sample); + } + [SerializeField] private string m_CurrentMatch; @@ -55,7 +65,7 @@ public IEnumerator Check_Additional_Doesnt_Generate_Any_Errors([ValueSource(name //Workaround for UUM-63664 var current = matching[0]; { - SampleDependencyImporter.instance.ImportSampleDependencies(searchRequest.Result[0], current); + VFXTemplateHelperInternal.ImportSampleDependencies(searchRequest.Result[0], current); } var result = current.Import(Sample.ImportOptions.HideImportWindow | Sample.ImportOptions.OverridePreviousImports); diff --git a/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/VFXViewWindowTest.cs b/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/VFXViewWindowTest.cs index d4c31148281..f53407ba5d7 100644 --- a/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/VFXViewWindowTest.cs +++ b/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/VFXViewWindowTest.cs @@ -8,6 +8,7 @@ using UnityEditor.VFX.UI; using UnityEngine; using UnityEngine.TestTools; +using UnityEngine.UIElements; using UnityEngine.VFX; namespace UnityEditor.VFX.Test @@ -208,5 +209,34 @@ public IEnumerator Repro_CustomHLSL_In_Subgraph() AssetDatabase.SaveAssets(); Assert.IsFalse(EditorUtility.IsDirty(vfxGraph)); } + + [UnityTest, Description("Repro UUM-114261")] + public IEnumerator Switch_SG_And_Name_Updated_In_VFX_Controller() + { + var packagePath = "Packages/com.unity.testing.visualeffectgraph/Tests/Editor/Data/Repro_114261.unitypackage"; + var vfxPath = VFXTestCommon.tempBasePath + "/VFX_114261.vfx"; + var sgUnlitPath = VFXTestCommon.tempBasePath + "/SG_114261_Unlit.shadergraph"; + var sgLitPath = VFXTestCommon.tempBasePath + "/SG_114261_Lit.shadergraph"; + + AssetDatabase.ImportPackageImmediately(packagePath); + + var resource = VisualEffectResource.GetResourceAtPath(vfxPath); + var window = VFXViewWindow.GetWindow(resource, true, true); + window.LoadResource(resource, null); + yield return null; + + var vfxContextUI = window.graphView.GetAllContexts().Single(o => o.controller.model is VFXAbstractComposedParticleOutput); + var subtitle = vfxContextUI.Q