diff --git a/Packages/com.unity.render-pipelines.core/Documentation~/custom-material-inspector.md b/Packages/com.unity.render-pipelines.core/Documentation~/custom-material-inspector.md index 64d6a5bb3d6..69dc9bb9147 100644 --- a/Packages/com.unity.render-pipelines.core/Documentation~/custom-material-inspector.md +++ b/Packages/com.unity.render-pipelines.core/Documentation~/custom-material-inspector.md @@ -6,7 +6,7 @@ Custom Material Inspectors enable you to define how Unity displays properties in The implementation for custom Material Inspectors differs between URP and HDRP. For example, for compatibility purposes, every custom Material Inspector in HDRP must inherit from `HDShaderGUI` which does not exist in URP. For information on how to create custom Material Inspectors for the respective render pipelines, see: -- **HDRP**: [HDRP custom Material Inspectors](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest?subfolder=/manual/hdrp-custom-material-inspector.html). +- **HDRP**: [HDRP custom Material Inspectors](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest?subfolder=/manual/custom-material-inspectors.html). - **URP**: [Unity Custom Shader GUI](https://docs.unity3d.com/Manual/SL-CustomShaderGUI.html). ## Assigning a custom Material Inspector diff --git a/Packages/com.unity.render-pipelines.core/Documentation~/render-graph-writing-a-render-pipeline.md b/Packages/com.unity.render-pipelines.core/Documentation~/render-graph-writing-a-render-pipeline.md index 32e71759b9b..4d3ede8ac0b 100644 --- a/Packages/com.unity.render-pipelines.core/Documentation~/render-graph-writing-a-render-pipeline.md +++ b/Packages/com.unity.render-pipelines.core/Documentation~/render-graph-writing-a-render-pipeline.md @@ -15,7 +15,7 @@ public class MyRenderPipeline : RenderPipeline void InitializeRenderGraph() { - m_RenderGraph = new RenderGraph(“MyRenderGraph”); + m_RenderGraph = new RenderGraph("MyRenderGraph"); } void CleanupRenderGraph() diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Utilities/Blitter.cs b/Packages/com.unity.render-pipelines.core/Runtime/Utilities/Blitter.cs index cb6dec82102..16bdb345dbf 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Utilities/Blitter.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/Utilities/Blitter.cs @@ -190,7 +190,6 @@ static private void DrawTriangle(CommandBuffer cmd, Material material, int shade cmd.DrawMesh(s_TriangleMesh, Matrix4x4.identity, material, 0, shaderPass, s_PropertyBlock); else cmd.DrawProcedural(Matrix4x4.identity, material, shaderPass, MeshTopology.Triangles, 3, 1, s_PropertyBlock); - s_PropertyBlock.Clear(); } static internal void DrawQuad(CommandBuffer cmd, Material material, int shaderPass) @@ -199,7 +198,6 @@ static internal void DrawQuad(CommandBuffer cmd, Material material, int shaderPa cmd.DrawMesh(s_QuadMesh, Matrix4x4.identity, material, 0, shaderPass, s_PropertyBlock); else cmd.DrawProcedural(Matrix4x4.identity, material, shaderPass, MeshTopology.Quads, 4, 1, s_PropertyBlock); - s_PropertyBlock.Clear(); } /// @@ -274,6 +272,7 @@ public static void BlitTexture(CommandBuffer cmd, RTHandle source, Vector4 scale /// Pass idx within the material to invoke. public static void BlitTexture(CommandBuffer cmd, RenderTargetIdentifier source, Vector4 scaleBias, Material material, int pass) { + s_PropertyBlock.Clear(); s_PropertyBlock.SetVector(BlitShaderIDs._BlitScaleBias, scaleBias); // Unfortunately there is no function bind a RenderTargetIdentifier with a property block so we have to bind it globally. cmd.SetGlobalTexture(BlitShaderIDs._BlitTexture, source); @@ -290,6 +289,8 @@ public static void BlitTexture(CommandBuffer cmd, RenderTargetIdentifier source, /// Pass idx within the material to invoke. public static void BlitTexture(CommandBuffer cmd, RenderTargetIdentifier source, RenderTargetIdentifier destination, Material material, int pass) { + s_PropertyBlock.Clear(); + s_PropertyBlock.SetVector(BlitShaderIDs._BlitScaleBias, Vector2.one); // Unfortunately there is no function bind a RenderTargetIdentifier with a property block so we have to bind it globally. cmd.SetGlobalTexture(BlitShaderIDs._BlitTexture, source); cmd.SetRenderTarget(destination); @@ -308,6 +309,8 @@ public static void BlitTexture(CommandBuffer cmd, RenderTargetIdentifier source, /// Pass idx within the material to invoke. public static void BlitTexture(CommandBuffer cmd, RenderTargetIdentifier source, RenderTargetIdentifier destination, RenderBufferLoadAction loadAction, RenderBufferStoreAction storeAction, Material material, int pass) { + s_PropertyBlock.Clear(); + s_PropertyBlock.SetVector(BlitShaderIDs._BlitScaleBias, Vector2.one); // Unfortunately there is no function bind a RenderTargetIdentifier with a property block so we have to bind it globally. cmd.SetGlobalTexture(BlitShaderIDs._BlitTexture, source); cmd.SetRenderTarget(destination, loadAction, storeAction); diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Frame-Settings-API.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Frame-Settings-API.md index 75b6cacd1ae..babd533061c 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Frame-Settings-API.md +++ b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Frame-Settings-API.md @@ -44,7 +44,7 @@ Finally, access the Frame Settings structure itself. This controls the actual va - **Camera**: `HDAdditionalCameraData.renderingPathCustomFrameSettings` - **Reflection Probe**: `HDAdditionalReflectionData.frameSettings` -For information on the API available for `FrameSettings`, including how to edit the value of a Frame Setting, see [FrameSettings Scripting API](framesettings-scripting-api). +For information on the API available for `FrameSettings`, including how to edit the value of a Frame Setting, see [FrameSettings Scripting API](#framesettings-scripting-api). ## Frame Setting enumerations diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/shadow-matte.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/shadow-matte.md index d6cb6c832f5..b7e08041c98 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/shadow-matte.md +++ b/Packages/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/shadow-matte.md @@ -2,5 +2,8 @@ Shadow Matte -Indicates whether or not the Shader receives shadows. Shadow matte only supports shadow maps. It does not support Screen Space Shadows, Ray-Traced Shadows, or Contact Shadows. +Indicates whether the shader receives shadows. Shadow matte only supports shadow maps. +It doesn't support screen-space shadows, ray-traced Shadows, or contact shadows.
+Enable **Shadow Matte** if you add a custom Node that samples shadow maps, otherwise shadows might not render correctly. + diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs index 359ddafb3d4..f61a0cb89b0 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs @@ -966,7 +966,8 @@ TextureHandle RenderTransparentUI(RenderGraph renderGraph, HDCamera hdCamera) context.cmd.ClearRenderTarget(false, true, Color.clear); context.renderContext.ExecuteCommandBuffer(context.cmd); context.cmd.Clear(); - context.renderContext.DrawUIOverlay(data.camera); + if (data.camera.targetTexture == null) + context.renderContext.DrawUIOverlay(data.camera); }); } } diff --git a/Packages/com.unity.render-pipelines.universal/Documentation~/InstallURPIntoAProject.md b/Packages/com.unity.render-pipelines.universal/Documentation~/InstallURPIntoAProject.md index 85b0f422f3e..d4ccab1f261 100644 --- a/Packages/com.unity.render-pipelines.universal/Documentation~/InstallURPIntoAProject.md +++ b/Packages/com.unity.render-pipelines.universal/Documentation~/InstallURPIntoAProject.md @@ -61,4 +61,5 @@ When you upgrade a project from the Built-in Render Pipeline (BiRP) to the Unive * [Render Pipeline Converter](features/rp-converter.md) * [Upgrade custom shaders for URP compatibility](urp-shaders/birp-urp-custom-shader-upgrade-guide.md) * [Find graphics quality settings in URP](birp-onboarding/quality-settings-location.md) -* [Update graphics quality levels for URP](quality-presets.md) +* [Update graphics quality levels for URP](birp-onboarding/quality-presets.md) + diff --git a/Packages/com.unity.render-pipelines.universal/Documentation~/features/rendering-layers.md b/Packages/com.unity.render-pipelines.universal/Documentation~/features/rendering-layers.md index f6d7a6096dc..c5334054a96 100644 --- a/Packages/com.unity.render-pipelines.universal/Documentation~/features/rendering-layers.md +++ b/Packages/com.unity.render-pipelines.universal/Documentation~/features/rendering-layers.md @@ -140,4 +140,4 @@ This section contains information related to the impact of Rendering Layers on p * When using Rendering Layers only for Lights in the Forward Rendering Path, the performance impact is insignificant. -* Performance impact grows more significantly when the Rendering Layer count exceeds a multiple of 8. For example: increasing the layer count from 8 to 9 layers has a bigger relative impact than increasing the layer count from 9 to 10 layers. \ No newline at end of file +* Performance impact grows more significantly when the Rendering Layer count exceeds a multiple of 8. For example: increasing the layer count from 8 to 9 layers has a bigger relative impact than increasing the layer count from 9 to 10 layers. The same consideration applies to increasing the count from 16 to 17, from 24 to 25 and so on. \ No newline at end of file diff --git a/Packages/com.unity.render-pipelines.universal/Documentation~/integration-with-post-processing.md b/Packages/com.unity.render-pipelines.universal/Documentation~/integration-with-post-processing.md index 515a6fedb64..522fce12ded 100644 --- a/Packages/com.unity.render-pipelines.universal/Documentation~/integration-with-post-processing.md +++ b/Packages/com.unity.render-pipelines.universal/Documentation~/integration-with-post-processing.md @@ -49,7 +49,7 @@ To configure post-processing in a new Scene: Now you can use the Volume Override to enable and adjust the settings for the post-processing effect. > [!NOTE] -> The GameObject which contains the volume and the camera you wish to apply post-processing to must be on the same Layer. +> Post-processing effects from a volume apply to a camera only if a value in the **Volume Mask** property of the camera contains the layer that the volume belongs to. Refer to [Understand Volumes](Volumes.md) for more information. diff --git a/Packages/com.unity.render-pipelines.universal/Documentation~/renderer-feature-decal.md b/Packages/com.unity.render-pipelines.universal/Documentation~/renderer-feature-decal.md index 025b7dac530..6120830249e 100644 --- a/Packages/com.unity.render-pipelines.universal/Documentation~/renderer-feature-decal.md +++ b/Packages/com.unity.render-pipelines.universal/Documentation~/renderer-feature-decal.md @@ -95,6 +95,8 @@ The maximum distance from the Camera at which Unity renders decals. Select this check box to enable the [Rendering Layers](features/rendering-layers.md) functionality. +For more information, refer to [How to use Rendering Layers with Decals](features/rendering-layers#how-to-rendering-layers-decals). + If you enable **Use Rendering Layers**, URP creates a DepthNormal prepass. This makes decals less efficient on GPUs that implement tile-based rendering. ## Decal Projector component diff --git a/Packages/com.unity.render-pipelines.universal/Documentation~/renderer-features/scriptable-renderer-features/inject-a-pass-using-a-scriptable-renderer-feature.md b/Packages/com.unity.render-pipelines.universal/Documentation~/renderer-features/scriptable-renderer-features/inject-a-pass-using-a-scriptable-renderer-feature.md index 61aa233ef75..6ec7e259f6f 100644 --- a/Packages/com.unity.render-pipelines.universal/Documentation~/renderer-features/scriptable-renderer-features/inject-a-pass-using-a-scriptable-renderer-feature.md +++ b/Packages/com.unity.render-pipelines.universal/Documentation~/renderer-features/scriptable-renderer-features/inject-a-pass-using-a-scriptable-renderer-feature.md @@ -99,7 +99,7 @@ This section uses the example `RedTintRenderPass` Scriptable Render Pass from th material = CoreUtils.CreateEngineMaterial(shader); redTintRenderPass = new RedTintRenderPass(material); - renderPassEvent = RenderPassEvent.AfterRenderingSkybox; + redTintRenderPass.renderPassEvent = RenderPassEvent.AfterRenderingSkybox; } ``` @@ -136,6 +136,7 @@ public class MyRendererFeature : ScriptableRendererFeature { if (shader == null) { + Debug.LogError("Ensure that you've set a shader in the Scriptable Renderer Feature."); return; } material = CoreUtils.CreateEngineMaterial(shader); @@ -147,12 +148,13 @@ public class MyRendererFeature : ScriptableRendererFeature public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData) { - if (renderingData.cameraData.cameraType == CameraType.Game) + if (redTintRenderPass != null && + renderingData.cameraData.cameraType == CameraType.Game) { renderer.EnqueuePass(redTintRenderPass); } } - public override void Dispose(bool disposing) + protected override void Dispose(bool disposing) { CoreUtils.Destroy(material); } diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Passes/Render2DLightingPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Passes/Render2DLightingPass.cs index 17cf6253095..0a00ee9e3e2 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Passes/Render2DLightingPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Passes/Render2DLightingPass.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using UnityEngine.Profiling; +using UnityEngine.Experimental.Rendering.Universal; namespace UnityEngine.Rendering.Universal { @@ -368,6 +369,15 @@ public override void Execute(ScriptableRenderContext context, ref RenderingData LayerUtility.InitializeBudget(m_Renderer2DData.lightRenderTextureMemoryBudget); ShadowRendering.InitializeBudget(m_Renderer2DData.shadowRenderTextureMemoryBudget); + // Set screenParams when pixel perfect camera is used with the reference resolution + camera.TryGetComponent(out PixelPerfectCamera pixelPerfectCamera); + if (pixelPerfectCamera != null && pixelPerfectCamera.enabled && pixelPerfectCamera.offscreenRTSize != Vector2Int.zero) + { + var cameraWidth = pixelPerfectCamera.offscreenRTSize.x; + var cameraHeight = pixelPerfectCamera.offscreenRTSize.y; + renderingData.commandBuffer.SetGlobalVector(ShaderPropertyId.screenParams, new Vector4(cameraWidth, cameraHeight, 1.0f + 1.0f / cameraWidth, 1.0f + 1.0f / cameraHeight)); + } + var isSceneLit = m_Renderer2DData.lightCullResult.IsSceneLit(); if (isSceneLit) { 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 7ff7fd0447a..9ddad06f7f5 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/AdditionalLightsShadowCasterPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/AdditionalLightsShadowCasterPass.cs @@ -860,10 +860,7 @@ bool SetupForEmptyRendering(ref RenderingData renderingData) /// public override void Configure(CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescriptor) { - // UUM-63146 - glClientWaitSync: Expected application to have kicked everything until job: 96089 (possibly by calling glFlush)" are thrown in the Android Player on some devices with PowerVR Rogue GE8320 - // Resetting of target would clean up the color attachment buffers and depth attachment buffers, which inturn is preventing the leak in the said platform. This is likely a symptomatic fix, but is solving the problem for now. - if (Application.platform == RuntimePlatform.Android && PlatformAutoDetect.isRunningOnPowerVRGPU) - ResetTarget(); + if (m_CreateEmptyShadowmap) { // Reset pass RTs to null 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 49db2e77cab..2a3a5ff21ec 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/MainLightShadowCasterPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/MainLightShadowCasterPass.cs @@ -171,10 +171,7 @@ bool SetupForEmptyRendering(ref RenderingData renderingData) /// public override void Configure(CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescriptor) { - // UUM-63146 - glClientWaitSync: Expected application to have kicked everything until job: 96089 (possibly by calling glFlush)" are thrown in the Android Player on some devices with PowerVR Rogue GE8320 - // Resetting of target would clean up the color attachment buffers and depth attachment buffers, which inturn is preventing the leak in the said platform. This is likely a symptomatic fix, but is solving the problem for now. - if (Application.platform == RuntimePlatform.Android && PlatformAutoDetect.isRunningOnPowerVRGPU) - ResetTarget(); + if (m_CreateEmptyShadowmap) { // Reset pass RTs to null diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs index 449a8ec0e56..f8decb40c48 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs @@ -128,6 +128,7 @@ public override int SupportedCameraStackingTypes() internal RTHandle m_ActiveCameraDepthAttachment; internal RTHandle m_CameraDepthAttachment; RTHandle m_XRTargetHandleAlias; + internal RTHandle m_CameraDepthAttachment_D3d_11; internal RTHandle m_DepthTexture; RTHandle m_NormalsTexture; RTHandle m_DecalLayersTexture; @@ -392,6 +393,7 @@ internal override void ReleaseRenderTargets() m_AdditionalLightsShadowCasterPass?.Dispose(); m_CameraDepthAttachment?.Release(); + m_CameraDepthAttachment_D3d_11?.Release(); m_DepthTexture?.Release(); m_NormalsTexture?.Release(); m_DecalLayersTexture?.Release(); @@ -806,7 +808,11 @@ public override void Setup(ScriptableRenderContext context, ref RenderingData re // Doesn't create texture for Overlay cameras as they are already overlaying on top of created textures. if (intermediateRenderTexture) + { CreateCameraRenderTarget(context, ref cameraTargetDescriptor, useDepthPriming, cmd, ref cameraData); + if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D11) + cmd.CopyTexture(m_CameraDepthAttachment, m_CameraDepthAttachment_D3d_11); + } m_RenderOpaqueForwardPass.m_IsActiveTargetBackBuffer = !intermediateRenderTexture; m_RenderTransparentForwardPass.m_IsActiveTargetBackBuffer = !intermediateRenderTexture; @@ -1532,7 +1538,14 @@ void CreateCameraRenderTarget(ScriptableRenderContext context, ref RenderTexture depthDescriptor.graphicsFormat = GraphicsFormat.None; depthDescriptor.depthStencilFormat = k_DepthStencilFormat; RenderingUtils.ReAllocateIfNeeded(ref m_CameraDepthAttachment, depthDescriptor, FilterMode.Point, TextureWrapMode.Clamp, name: "_CameraDepthAttachment"); - cmd.SetGlobalTexture(m_CameraDepthAttachment.name, m_CameraDepthAttachment.nameID); + + if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D11) + { + RenderingUtils.ReAllocateIfNeeded(ref m_CameraDepthAttachment_D3d_11, depthDescriptor, FilterMode.Point, TextureWrapMode.Clamp, name: "_CameraDepthAttachment_Temp"); + cmd.SetGlobalTexture(m_CameraDepthAttachment.name, m_CameraDepthAttachment_D3d_11.nameID); + } + else + cmd.SetGlobalTexture(m_CameraDepthAttachment.name, m_CameraDepthAttachment.nameID); // update the descriptor to match the depth attachment descriptor.depthStencilFormat = depthDescriptor.depthStencilFormat; diff --git a/Packages/com.unity.shadergraph/Editor/Data/Graphs/GroupData.cs b/Packages/com.unity.shadergraph/Editor/Data/Graphs/GroupData.cs index acab2ec9abb..363ce4000bb 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Graphs/GroupData.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Graphs/GroupData.cs @@ -5,7 +5,7 @@ namespace UnityEditor.ShaderGraph { [Serializable] - public class GroupData : JsonObject + public class GroupData : JsonObject, IRectInterface { [SerializeField] string m_Title; @@ -16,6 +16,7 @@ public string title set { m_Title = value; } } + [SerializeField] Vector2 m_Position; @@ -25,6 +26,16 @@ public Vector2 position set { m_Position = value; } } + Rect IRectInterface.rect + { + get => new Rect(position, Vector2.one); + set + { + position = value.position; + } + } + + public GroupData() : base() { } public GroupData(string title, Vector2 position) diff --git a/Packages/com.unity.shadergraph/Editor/Drawing/Views/MaterialGraphView.cs b/Packages/com.unity.shadergraph/Editor/Drawing/Views/MaterialGraphView.cs index 64cbb5f170c..d90b8d682dd 100644 --- a/Packages/com.unity.shadergraph/Editor/Drawing/Views/MaterialGraphView.cs +++ b/Packages/com.unity.shadergraph/Editor/Drawing/Views/MaterialGraphView.cs @@ -1482,7 +1482,12 @@ internal static void InsertCopyPasteGraph(this MaterialGraphView graphView, Copy { var nodeList = copyGraph.GetNodes(); - ClampNodesWithinView(graphView, new List().Union(nodeList).Union(copyGraph.stickyNotes)); + ClampNodesWithinView(graphView, + new List() + .Union(nodeList) + .Union(copyGraph.stickyNotes) + .Union(copyGraph.groups) + ); graphView.graph.PasteGraph(copyGraph, remappedNodes, remappedEdges); diff --git a/Packages/com.unity.shadergraph/Editor/Drawing/Views/ShaderGroup.cs b/Packages/com.unity.shadergraph/Editor/Drawing/Views/ShaderGroup.cs index 92c3b46df6b..02b2fda1376 100644 --- a/Packages/com.unity.shadergraph/Editor/Drawing/Views/ShaderGroup.cs +++ b/Packages/com.unity.shadergraph/Editor/Drawing/Views/ShaderGroup.cs @@ -53,5 +53,13 @@ public override bool AcceptsElement(GraphElement element, ref string reasonWhyNo return true; } + + protected override void SetScopePositionOnly(Rect newPos) + { + base.SetScopePositionOnly(newPos); + + userData.position = newPos.position; + } + } } diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/ComponentAPI.md b/Packages/com.unity.visualeffectgraph/Documentation~/ComponentAPI.md index 5e4d361ae06..4531a6787e9 100644 --- a/Packages/com.unity.visualeffectgraph/Documentation~/ComponentAPI.md +++ b/Packages/com.unity.visualeffectgraph/Documentation~/ComponentAPI.md @@ -179,7 +179,7 @@ If you want to manage multiple Visual Effect instances in the same Scene and wan VisualEffect visualEffect; VFXEventAttribute eventAttribute; -static readonly ExposedProperty positionAttribute = "Position" +static readonly ExposedProperty positionAttribute = "position" static readonly ExposedProperty enteredTriggerEvent = "EnteredTrigger" void Start() diff --git a/Tests/SRPTests/Projects/BatchRendererGroup_HDRP/Assets/HDRPSettings/HDRenderPipelineAsset.asset b/Tests/SRPTests/Projects/BatchRendererGroup_HDRP/Assets/HDRPSettings/HDRenderPipelineAsset.asset index 4f65a8a8ddc..effacbcc6d8 100644 --- a/Tests/SRPTests/Projects/BatchRendererGroup_HDRP/Assets/HDRPSettings/HDRenderPipelineAsset.asset +++ b/Tests/SRPTests/Projects/BatchRendererGroup_HDRP/Assets/HDRPSettings/HDRenderPipelineAsset.asset @@ -51,6 +51,7 @@ MonoBehaviour: decalNormalBufferHP: 0 msaaSampleCount: 1 supportMotionVectors: 1 + supportDataDrivenLensFlare: 1 supportRuntimeAOVAPI: 0 supportDitheringCrossFade: 1 supportTerrainHole: 0 @@ -72,7 +73,7 @@ MonoBehaviour: maxEnvLightsOnScreen: 64 reflectionCacheCompressed: 0 reflectionProbeFormat: 74 - reflectionProbeTexCacheSize: 1073750016 + reflectionProbeTexCacheSize: 2048 reflectionProbeTexLastValidCubeMip: 3 reflectionProbeTexLastValidPlanarMip: 0 reflectionProbeDecreaseResToFit: 1 @@ -151,6 +152,8 @@ MonoBehaviour: forcedPercentage: 100 lowResTransparencyMinimumThreshold: 0 rayTracingHalfResThreshold: 50 + lowResSSGIMinimumThreshold: 0 + lowResVolumetricCloudsMinimumThreshold: 50 lowresTransparentSettings: enabled: 1 checkerboardDepthBuffer: 1 @@ -182,7 +185,7 @@ MonoBehaviour: ChromaticAberrationMaxSamples: 03000000060000000c000000 lightSettings: useContactShadow: - m_Values: + m_Values: 000000 m_SchemaId: m_Id: maximumLODLevel: @@ -293,6 +296,8 @@ MonoBehaviour: diffusionProfileSettings: {fileID: 0} virtualTexturingSettings: streamingCpuCacheSizeInMegaBytes: 256 + streamingMipPreloadTexturesPerFrame: 0 + streamingPreloadMipCount: 1 streamingGpuCacheSettings: - format: 0 sizeInMegaBytes: 128 diff --git a/Tests/SRPTests/Projects/ShaderGraph/Assets/CommonAssets/Editor/GroupTests.cs b/Tests/SRPTests/Projects/ShaderGraph/Assets/CommonAssets/Editor/GroupTests.cs new file mode 100644 index 00000000000..0226578be08 --- /dev/null +++ b/Tests/SRPTests/Projects/ShaderGraph/Assets/CommonAssets/Editor/GroupTests.cs @@ -0,0 +1,122 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using UnityEngine.UIElements; +using NUnit.Framework; +using UnityEngine; +using UnityEngine.TestTools; +using UnityEditor.Graphing; +using UnityEditor.ShaderGraph.Drawing; +using UnityEditor.ShaderGraph.Internal; + + +namespace UnityEditor.ShaderGraph.UnitTests +{ + [TestFixture] + internal class GroupTests + { + static string kGraphName = "Assets/CommonAssets/Graphs/Group.shadergraph"; + GraphData m_Graph; + + GraphEditorView m_GraphEditorView; + MaterialGraphEditWindow m_Window; + + [OneTimeSetUp] + public void LoadGraph() + { + List lti; + var assetCollection = new AssetCollection(); + ShaderGraphImporter.GetShaderText(kGraphName, out lti, assetCollection, out m_Graph); + Assert.NotNull(m_Graph, $"Invalid graph data found for {kGraphName}"); + + m_Graph.ValidateGraph(); + // Open up the window + if (!ShaderGraphImporterEditor.ShowGraphEditWindow(kGraphName)) + { + Assert.Fail("ShaderGraphImporterEditor.ShowGraphEditWindow could not open " + kGraphName); + } + + m_Window = EditorWindow.GetWindow(); + if (m_Window == null) + { + Assert.Fail("Could not open window"); + } + + // EditorWindow.GetWindow will return a new window if one is not found. A new window will have graphObject == null. + if (m_Window.graphObject == null) + { + Assert.Fail("Existing Shader Graph window of " + kGraphName + " not found."); + } + + m_GraphEditorView = m_Window.graphEditorView; + + } + + class TestExecuteCommandEvent : ExecuteCommandEvent + { + public void SetCommandName(string command) + { + commandName = command; + } + } + + [UnityTest] + public IEnumerator TestEmptyGroupPastePosition() + { + var materialGraphView = m_GraphEditorView.graphView; + var materialGraphViewType = typeof(MaterialGraphView); + + var cutMethodInfo = materialGraphViewType.GetMethod("CutSelectionCallback", + BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); + var pasteMethodInfo = materialGraphViewType.GetMethod("PasteCallback", + BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); + + var mousePositionPropertyInfo = materialGraphViewType.GetProperty("cachedMousePosition", + typeof(Vector2)); + + Assert.NotNull(cutMethodInfo, "CutSelectionCallback method not found."); + Assert.NotNull(pasteMethodInfo, "PasteCallback method not found."); + Assert.NotNull(mousePositionPropertyInfo, "cachedMousePosition property not found."); + + var groupList = materialGraphView.Query() + .Where(x => x.userData.title == "Empty Group") + .ToList(); + + Assert.AreEqual(1, groupList.Count()); + + + + materialGraphView.ClearSelection(); + materialGraphView.AddToSelection(groupList[0]); + + cutMethodInfo.Invoke(materialGraphView, null); + yield return null; + + groupList = materialGraphView.Query() + .Where(x => x.userData.title == "Empty Group") + .ToList(); + + Assert.AreEqual(0, groupList.Count()); + + mousePositionPropertyInfo.SetValue(materialGraphView, new Vector2(100,100)); + pasteMethodInfo.Invoke(materialGraphView, null); + yield return null; + + mousePositionPropertyInfo.SetValue(materialGraphView, new Vector2(100,200)); + pasteMethodInfo.Invoke(materialGraphView, null); + yield return null; + + groupList = materialGraphView.Query() + .Where(x => x.userData.title == "Empty Group") + .ToList(); + + Assert.AreEqual(2, groupList.Count()); + + Assert.AreNotEqual(groupList[0].GetPosition().position, groupList[1].GetPosition().position, + "When the cursor position changes, the pasted group's position should be adjusted accordingly"); + } + + } +} diff --git a/Tests/SRPTests/Projects/ShaderGraph/Assets/CommonAssets/Editor/GroupTests.cs.meta b/Tests/SRPTests/Projects/ShaderGraph/Assets/CommonAssets/Editor/GroupTests.cs.meta new file mode 100644 index 00000000000..e68bdf11d62 --- /dev/null +++ b/Tests/SRPTests/Projects/ShaderGraph/Assets/CommonAssets/Editor/GroupTests.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 680b4886bf42f4e469e5be34a62e46df \ No newline at end of file diff --git a/Tests/SRPTests/Projects/ShaderGraph/Assets/CommonAssets/Graphs/Group.shadergraph b/Tests/SRPTests/Projects/ShaderGraph/Assets/CommonAssets/Graphs/Group.shadergraph new file mode 100644 index 00000000000..fa1af318b80 --- /dev/null +++ b/Tests/SRPTests/Projects/ShaderGraph/Assets/CommonAssets/Graphs/Group.shadergraph @@ -0,0 +1,480 @@ +{ + "m_SGVersion": 3, + "m_Type": "UnityEditor.ShaderGraph.GraphData", + "m_ObjectId": "2e2fb2d41f3140e6bf6c2cd71c34aae7", + "m_Properties": [], + "m_Keywords": [], + "m_Dropdowns": [], + "m_CategoryData": [ + { + "m_Id": "4502e1e5b9644594b2df22af116ad5ea" + } + ], + "m_Nodes": [ + { + "m_Id": "af0264ee1a9b49c18fdf9101cf9ae081" + }, + { + "m_Id": "c12d6a9b6653476ca32727965d4298cb" + }, + { + "m_Id": "97cc969e84a14cb09a9260436cd21d3c" + }, + { + "m_Id": "f855f815da12498382d7f7fa2bd05ee1" + }, + { + "m_Id": "2c226297ac7b4ec4a7776745f36c9d64" + }, + { + "m_Id": "52e4d268f589446bb73efac7dccf48c7" + } + ], + "m_GroupDatas": [ + { + "m_Id": "f694401d3c6c402d97536e786e32ec07" + } + ], + "m_StickyNoteDatas": [], + "m_Edges": [], + "m_VertexContext": { + "m_Position": { + "x": 0.0, + "y": 0.0 + }, + "m_Blocks": [ + { + "m_Id": "af0264ee1a9b49c18fdf9101cf9ae081" + }, + { + "m_Id": "c12d6a9b6653476ca32727965d4298cb" + }, + { + "m_Id": "97cc969e84a14cb09a9260436cd21d3c" + } + ] + }, + "m_FragmentContext": { + "m_Position": { + "x": 0.0, + "y": 200.0 + }, + "m_Blocks": [ + { + "m_Id": "f855f815da12498382d7f7fa2bd05ee1" + }, + { + "m_Id": "2c226297ac7b4ec4a7776745f36c9d64" + }, + { + "m_Id": "52e4d268f589446bb73efac7dccf48c7" + } + ] + }, + "m_PreviewData": { + "serializedMesh": { + "m_SerializedMesh": "{\"mesh\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "preventRotation": false + }, + "m_Path": "Shader Graphs", + "m_GraphPrecision": 0, + "m_PreviewMode": 2, + "m_OutputNode": { + "m_Id": "" + }, + "m_SubDatas": [], + "m_ActiveTargets": [ + { + "m_Id": "a9167bc70a5241adb50893132cec17c1" + } + ] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.TangentMaterialSlot", + "m_ObjectId": "1af599a5b6874ae8a4a3c9d3b49e82db", + "m_Id": 0, + "m_DisplayName": "Tangent", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Tangent", + "m_StageCapability": 1, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_Space": 0 +} + +{ + "m_SGVersion": 2, + "m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalUnlitSubTarget", + "m_ObjectId": "20a4d9d22d5145b89d5fc43b68551665" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "2c226297ac7b4ec4a7776745f36c9d64", + "m_Group": { + "m_Id": "" + }, + "m_Name": "SurfaceDescription.Alpha", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "e7f99533600e469cb17d6a460403a30a" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.Alpha" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.CategoryData", + "m_ObjectId": "4502e1e5b9644594b2df22af116ad5ea", + "m_Name": "", + "m_ChildObjectList": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "52e4d268f589446bb73efac7dccf48c7", + "m_Group": { + "m_Id": "" + }, + "m_Name": "SurfaceDescription.AlphaClipThreshold", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "df4ecaa19f1d40b88c55203480c21185" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.AlphaClipThreshold" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot", + "m_ObjectId": "685a41ca509448b0a5afa62b66767f9d", + "m_Id": 0, + "m_DisplayName": "Base Color", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "BaseColor", + "m_StageCapability": 2, + "m_Value": { + "x": 0.7353569269180298, + "y": 0.7353569269180298, + "z": 0.7353569269180298 + }, + "m_DefaultValue": { + "x": 0.5, + "y": 0.5, + "z": 0.5 + }, + "m_Labels": [], + "m_ColorMode": 0, + "m_DefaultColor": { + "r": 0.5, + "g": 0.5, + "b": 0.5, + "a": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "97cc969e84a14cb09a9260436cd21d3c", + "m_Group": { + "m_Id": "" + }, + "m_Name": "VertexDescription.Tangent", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "1af599a5b6874ae8a4a3c9d3b49e82db" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "VertexDescription.Tangent" +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalTarget", + "m_ObjectId": "a9167bc70a5241adb50893132cec17c1", + "m_Datas": [], + "m_ActiveSubTarget": { + "m_Id": "20a4d9d22d5145b89d5fc43b68551665" + }, + "m_AllowMaterialOverride": false, + "m_SurfaceType": 0, + "m_ZTestMode": 4, + "m_ZWriteControl": 0, + "m_AlphaMode": 0, + "m_RenderFace": 2, + "m_AlphaClip": true, + "m_CastShadows": true, + "m_ReceiveShadows": true, + "m_DisableTint": false, + "m_AdditionalMotionVectorMode": 0, + "m_AlembicMotionVectors": false, + "m_SupportsLODCrossFade": false, + "m_CustomEditorGUI": "", + "m_SupportVFX": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "af0264ee1a9b49c18fdf9101cf9ae081", + "m_Group": { + "m_Id": "" + }, + "m_Name": "VertexDescription.Position", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "f224ffc6fb50427aaa44ece0fadf34b1" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "VertexDescription.Position" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.NormalMaterialSlot", + "m_ObjectId": "b8f3d744ba1c4249a953b9d29df5ea96", + "m_Id": 0, + "m_DisplayName": "Normal", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Normal", + "m_StageCapability": 1, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_Space": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "c12d6a9b6653476ca32727965d4298cb", + "m_Group": { + "m_Id": "" + }, + "m_Name": "VertexDescription.Normal", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "b8f3d744ba1c4249a953b9d29df5ea96" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "VertexDescription.Normal" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "df4ecaa19f1d40b88c55203480c21185", + "m_Id": 0, + "m_DisplayName": "Alpha Clip Threshold", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "AlphaClipThreshold", + "m_StageCapability": 2, + "m_Value": 0.5, + "m_DefaultValue": 0.5, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "e7f99533600e469cb17d6a460403a30a", + "m_Id": 0, + "m_DisplayName": "Alpha", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Alpha", + "m_StageCapability": 2, + "m_Value": 1.0, + "m_DefaultValue": 1.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PositionMaterialSlot", + "m_ObjectId": "f224ffc6fb50427aaa44ece0fadf34b1", + "m_Id": 0, + "m_DisplayName": "Position", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Position", + "m_StageCapability": 1, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_Space": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.GroupData", + "m_ObjectId": "f694401d3c6c402d97536e786e32ec07", + "m_Title": "Empty Group", + "m_Position": { + "x": -433.0, + "y": 112.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "f855f815da12498382d7f7fa2bd05ee1", + "m_Group": { + "m_Id": "" + }, + "m_Name": "SurfaceDescription.BaseColor", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "685a41ca509448b0a5afa62b66767f9d" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.BaseColor" +} + diff --git a/Tests/SRPTests/Projects/ShaderGraph/Assets/CommonAssets/Graphs/Group.shadergraph.meta b/Tests/SRPTests/Projects/ShaderGraph/Assets/CommonAssets/Graphs/Group.shadergraph.meta new file mode 100644 index 00000000000..5d1a45e9e9e --- /dev/null +++ b/Tests/SRPTests/Projects/ShaderGraph/Assets/CommonAssets/Graphs/Group.shadergraph.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: dc1e3482bafaf6f4eb9452812d08215e +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}