diff --git a/Packages/com.unity.render-pipelines.core/Editor/Debugging/DebugState.cs b/Packages/com.unity.render-pipelines.core/Editor/Debugging/DebugState.cs index 2e72da47421..c9dafbe881b 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/Debugging/DebugState.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/Debugging/DebugState.cs @@ -182,6 +182,35 @@ public sealed class DebugStateInt : DebugState { } [Serializable, DebugState(typeof(DebugUI.ObjectPopupField), typeof(DebugUI.CameraSelector), typeof(DebugUI.ObjectField))] public sealed class DebugStateObject : DebugState { + [SerializeField] string m_UserData; + + /// + public override void SetValue(object value, DebugUI.IValueField field) + { + // DebugStateObject is used to serialize the selected camera reference in DebugUI.CameraSelector. For SceneView Camera this doesn't work because + // the camera is never saved and always recreated. So we use a special string to identify this case and restore the reference later. + if (field is DebugUI.CameraSelector && SceneView.lastActiveSceneView != null && (Camera)value == SceneView.lastActiveSceneView.camera) + { + m_UserData = "SceneViewCamera"; + } + else + { + m_UserData = null; + } + base.SetValue(value, field); + } + + /// + public override object GetValue() + { + if (value == null && m_UserData != null && m_UserData == "SceneViewCamera" && SceneView.lastActiveSceneView != null && SceneView.lastActiveSceneView.camera != null) + { + value = SceneView.lastActiveSceneView.camera; + } + + return base.GetValue(); + } + /// /// Returns the hash code of the Debug Item. /// diff --git a/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.VirtualOffset.cs b/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.VirtualOffset.cs index 821eccab346..2a753ba6090 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.VirtualOffset.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.VirtualOffset.cs @@ -109,7 +109,7 @@ public override void Initialize(ProbeVolumeBakingSet bakingSet, NativeArray !s.isDirty) || EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo()) { foreach (var scene in scenesToUnload) - EditorSceneManager.CloseScene(scene, false); + EditorSceneManager.CloseScene(scene, string.IsNullOrEmpty(scene.path)); // Remove the scene from the hierarchy iff it has never been saved. } break; } diff --git a/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/VirtualOffset/TraceVirtualOffset.urtshader b/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/VirtualOffset/TraceVirtualOffset.urtshader index f15265fdf19..5686adf863c 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/VirtualOffset/TraceVirtualOffset.urtshader +++ b/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/VirtualOffset/TraceVirtualOffset.urtshader @@ -87,21 +87,22 @@ void RayGenExecute(UnifiedRT::DispatchInfo dispatchInfo) if (!hit.IsValid() || hit.isFrontFace) { validHits++; - continue; } - - float distanceDiff = hit.hitDistance - minDist; - if (distanceDiff < DISTANCE_THRESHOLD) + else if (hit.IsValid()) { - UnifiedRT::HitGeomAttributes attributes = UnifiedRT::FetchHitGeomAttributes(hit, UnifiedRT::kGeomAttribFaceNormal); - float dotSurface = dot(ray.direction, attributes.faceNormal); - - // If new distance is smaller by at least kDistanceThreshold, or if ray is at least DOT_THRESHOLD more colinear with normal - if (distanceDiff < -DISTANCE_THRESHOLD || dotSurface - maxDotSurface > DOT_THRESHOLD) + float distanceDiff = hit.hitDistance - minDist; + if (distanceDiff < DISTANCE_THRESHOLD) { - outDirection = ray.direction; - maxDotSurface = dotSurface; - minDist = hit.hitDistance; + UnifiedRT::HitGeomAttributes attributes = UnifiedRT::FetchHitGeomAttributes(hit, UnifiedRT::kGeomAttribFaceNormal); + float dotSurface = dot(ray.direction, attributes.faceNormal); + + // If new distance is smaller by at least kDistanceThreshold, or if ray is at least DOT_THRESHOLD more colinear with normal + if (distanceDiff < -DISTANCE_THRESHOLD || dotSurface - maxDotSurface > DOT_THRESHOLD) + { + outDirection = ray.direction; + maxDotSurface = dotSurface; + minDist = hit.hitDistance; + } } } } diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettingsVolumes.cs b/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettingsVolumes.cs index 87296a7fb0e..74a13be298b 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettingsVolumes.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettingsVolumes.cs @@ -59,23 +59,10 @@ public Type selectedComponentType /// Current camera to debug. public Camera selectedCamera { - get - { -#if UNITY_EDITOR - // By default pick the one scene camera - if (m_SelectedCamera == null && SceneView.lastActiveSceneView != null) - { - var sceneCamera = SceneView.lastActiveSceneView.camera; - if (sceneCamera != null) - m_SelectedCamera = sceneCamera; - } -#endif - - return m_SelectedCamera; - } + get => m_SelectedCamera; set { - if (value != null && value != m_SelectedCamera) + if (value != m_SelectedCamera) { m_SelectedCamera = value; OnSelectionChanged(); @@ -333,7 +320,7 @@ public static DebugUI.EnumField CreateComponentSelector(SettingsPanel panel, Act }; } - public static DebugUI.ObjectPopupField CreateCameraSelector(SettingsPanel panel, Action, Object> refresh) + public static DebugUI.CameraSelector CreateCameraSelector(SettingsPanel panel, Action, Object> refresh) { return new DebugUI.CameraSelector() { @@ -708,7 +695,14 @@ public override void Dispose() public SettingsPanel(DebugDisplaySettingsVolume data) : base(data) { - AddWidget(WidgetFactory.CreateCameraSelector(this, (_, __) => Refresh())); + var cameraSelector = WidgetFactory.CreateCameraSelector(this, (_, __) => Refresh()); + + // Select first camera if none is selected + var availableCameras = cameraSelector.getObjects() as List; + if (data.selectedCamera == null && availableCameras is { Count: > 0 }) + data.selectedCamera = availableCameras[0]; + + AddWidget(cameraSelector); AddWidget(WidgetFactory.CreateComponentSelector(this, (_, __) => Refresh())); Func hiddenCallback = () => data.selectedCamera == null || data.selectedComponent <= 0; diff --git a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/ResourcesData.cs b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/ResourcesData.cs index c1330b14715..852e7998e43 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/ResourcesData.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/ResourcesData.cs @@ -146,7 +146,7 @@ public void SetWritingPass(CompilerContextData ctx, ResourceHandle h, int passId public void RegisterReadingPass(CompilerContextData ctx, ResourceHandle h, int passId, int index) { #if DEVELOPMENT_BUILD || UNITY_EDITOR - if (numReaders >= ctx.resources.MaxReaders) + if (numReaders >= ctx.resources.MaxReaders[h.iType]) { string passName = ctx.GetPassName(passId); string resourceName = ctx.GetResourceName(h); @@ -194,8 +194,8 @@ internal class ResourcesData public NativeList[] versionedData; // Flattened fixed size array storing up to MaxVersions versions per resource id. public NativeList[] readerData; // Flattened fixed size array storing up to MaxReaders per resource id per version. - public int MaxVersions; - public int MaxReaders; + public int[] MaxVersions; + public int[] MaxReaders; public DynamicArray[] resourceNames; @@ -205,6 +205,8 @@ public ResourcesData() versionedData = new NativeList[(int)RenderGraphResourceType.Count]; readerData = new NativeList[(int)RenderGraphResourceType.Count]; resourceNames = new DynamicArray[(int)RenderGraphResourceType.Count]; + MaxVersions = new int[(int)RenderGraphResourceType.Count]; + MaxReaders = new int[(int)RenderGraphResourceType.Count]; for (int t = 0; t < (int)RenderGraphResourceType.Count; t++) resourceNames[t] = new DynamicArray(0); // T in NativeList cannot contain managed types, so the names are stored separately @@ -241,14 +243,14 @@ void AllocateAndResizeNativeListIfNeeded(ref NativeList nativeList, int si public void Initialize(RenderGraphResourceRegistry resources) { - uint maxReaders = 0; - uint maxWriters = 0; - for (int t = 0; t < (int)RenderGraphResourceType.Count; t++) { RenderGraphResourceType resourceType = (RenderGraphResourceType) t; var numResources = resources.GetResourceCount(resourceType); + uint maxReaders = 0; + uint maxWriters = 0; + // We don't clear the list as we reinitialize it right after AllocateAndResizeNativeListIfNeeded(ref unversionedData[t], numResources, NativeArrayOptions.UninitializedMemory); @@ -308,12 +310,12 @@ public void Initialize(RenderGraphResourceRegistry resources) } // The first resource is a null resource, so we need to add 1 to the count. - MaxReaders = (int)maxReaders + 1; - MaxVersions = (int)maxWriters + 1; + MaxReaders[t] = (int)maxReaders + 1; + MaxVersions[t] = (int)maxWriters + 1; // Clear the other caching structures, they will be filled later - AllocateAndResizeNativeListIfNeeded(ref versionedData[t], MaxVersions * numResources, NativeArrayOptions.ClearMemory); - AllocateAndResizeNativeListIfNeeded(ref readerData[t], MaxVersions * MaxReaders * numResources, NativeArrayOptions.ClearMemory); + AllocateAndResizeNativeListIfNeeded(ref versionedData[t], MaxVersions[t] * numResources, NativeArrayOptions.ClearMemory); + AllocateAndResizeNativeListIfNeeded(ref readerData[t], MaxVersions[t] * MaxReaders[t] * numResources, NativeArrayOptions.ClearMemory); } } @@ -322,10 +324,10 @@ public void Initialize(RenderGraphResourceRegistry resources) public int Index(ResourceHandle h) { #if UNITY_EDITOR // Hot path - if (h.version < 0 || h.version >= MaxVersions) + if (h.version < 0 || h.version >= MaxVersions[h.iType]) throw new Exception("Invalid version: " + h.version); #endif - return h.index * MaxVersions + h.version; + return h.index * MaxVersions[h.iType] + h.version; } // Flatten array index @@ -333,12 +335,12 @@ public int Index(ResourceHandle h) public int IndexReader(ResourceHandle h, int readerID) { #if UNITY_EDITOR // Hot path - if (h.version < 0 || h.version >= MaxVersions) + if (h.version < 0 || h.version >= MaxVersions[h.iType]) throw new Exception("Invalid version"); - if (readerID < 0 || readerID >= MaxReaders) + if (readerID < 0 || readerID >= MaxReaders[h.iType]) throw new Exception("Invalid reader"); #endif - return (h.index * MaxVersions + h.version) * MaxReaders + readerID; + return (h.index * MaxVersions[h.iType] + h.version) * MaxReaders[h.iType] + readerID; } // Lookup data for a given handle diff --git a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraph.cs b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraph.cs index 879207a009e..095838f5900 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraph.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraph.cs @@ -591,7 +591,7 @@ internal void ForceCleanup() nativeCompiler?.Cleanup(); - m_CompilationCache?.Clear(); + m_CompilationCache?.Cleanup(); DelegateHashCodeUtils.ClearCache(); } diff --git a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphCompilationCache.cs b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphCompilationCache.cs index fb21fca2270..85323cf493f 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphCompilationCache.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphCompilationCache.cs @@ -96,14 +96,41 @@ public bool GetCompilationCache(int hash, int frameIndex, out CompilerContextDat return GetCompilationCache(hash, frameIndex, out outGraph, m_NativeHashEntries, m_NativeCompiledGraphPool, s_NativeEntryComparer); } - public void Clear() + public void Cleanup() { + // We clear the contents of the pools but not the pool themselves, because they are only + // filled at the beginning of the renderer pipeline and never after. This means when we call + // Cleanup() after an error, if we were clearing the pools, the render graph could not gracefully start + // back up because the cache would have a size of 0 (so no room to cache anything). + + // Cleanup compiled graphs currently in the cache for (int i = 0; i < m_HashEntries.size; ++i) - m_CompiledGraphPool.Push(m_HashEntries[i].compiledGraph); + { + var compiledGraph = m_HashEntries[i].compiledGraph; + compiledGraph.Clear(); + } m_HashEntries.Clear(); + // Cleanup compiled graphs that might be left in the pool + var compiledGraphs = m_CompiledGraphPool.ToArray(); + for (int i = 0; i < compiledGraphs.Length; ++i) + { + compiledGraphs[i].Clear(); + } + + // Dispose of CompilerContextData currently in the cache for (int i = 0; i < m_NativeHashEntries.size; ++i) - m_NativeCompiledGraphPool.Push(m_NativeHashEntries[i].compiledGraph); + { + var compiledGraph = m_NativeHashEntries[i].compiledGraph; + compiledGraph.Dispose(); + } m_NativeHashEntries.Clear(); + + // Dispose of CompilerContextData that might be left in the pool + var nativeCompiledGraphs = m_NativeCompiledGraphPool.ToArray(); + for (int i = 0; i < nativeCompiledGraphs.Length; ++i) + { + nativeCompiledGraphs[i].Dispose(); + } } } diff --git a/Packages/com.unity.render-pipelines.core/Tests/Editor/NativePassCompilerRenderGraphTests.cs b/Packages/com.unity.render-pipelines.core/Tests/Editor/NativePassCompilerRenderGraphTests.cs index 66fcbb22243..a63c555a701 100644 --- a/Packages/com.unity.render-pipelines.core/Tests/Editor/NativePassCompilerRenderGraphTests.cs +++ b/Packages/com.unity.render-pipelines.core/Tests/Editor/NativePassCompilerRenderGraphTests.cs @@ -1053,11 +1053,11 @@ public void MaxReadersAndMaxVersionsAreCorrectForBuffers() // The resource with the biggest MaxReaders is buffer2: // 1 implicit read (TestPass0) + 1 explicit read (TestPass1) + 1 for the offset. - Assert.AreEqual(result.contextData.resources.MaxReaders, 3); + Assert.AreEqual(result.contextData.resources.MaxReaders[(int)RenderGraphResourceType.Buffer], 3); // The resource with the biggest MaxVersion is buffer2: // 1 explicit write (TestPass0) + 1 explicit readwrite (TestPass1) + 1 for the offset - Assert.AreEqual(result.contextData.resources.MaxVersions, 3); + Assert.AreEqual(result.contextData.resources.MaxVersions[(int)RenderGraphResourceType.Buffer], 3); } [Test] @@ -1094,11 +1094,11 @@ public void MaxReadersAndMaxVersionsAreCorrectForTextures() // Resources with the biggest MaxReaders are extraBuffers[0] and depthBuffer (both being equal): // 1 implicit read (TestPass0) + 2 explicit read (TestPass1 & TestPass2) + 1 for the offset - Assert.AreEqual(result.contextData.resources.MaxReaders, 4); + Assert.AreEqual(result.contextData.resources.MaxReaders[(int)RenderGraphResourceType.Texture], 4); // The resource with the biggest MaxVersion is extraBuffers[0]: // 1 explicit write (TestPass0) + 1 explicit read-write (TestPass1) + 1 for the offset - Assert.AreEqual(result.contextData.resources.MaxVersions, 3); + Assert.AreEqual(result.contextData.resources.MaxVersions[(int)RenderGraphResourceType.Texture], 3); } [Test] @@ -1136,11 +1136,88 @@ public void MaxReadersAndMaxVersionsAreCorrectForBuffersMultiplePasses() // The resource with the biggest MaxReaders is buffer2: // 5 implicit read (TestPass0-2-4-6-8) + 5 explicit read (TestPass1-3-5-7-9) + 1 for the offset. - Assert.AreEqual(result.contextData.resources.MaxReaders, 11); + Assert.AreEqual(result.contextData.resources.MaxReaders[(int)RenderGraphResourceType.Buffer], 11); // The resource with the biggest MaxVersion is buffer2: // 5 explicit write (TestPass0-2-4-6-8) + 5 explicit readwrite (TestPass1-3-5-7-9) + 1 for the offset - Assert.AreEqual(result.contextData.resources.MaxVersions, 11); + Assert.AreEqual(result.contextData.resources.MaxVersions[(int)RenderGraphResourceType.Buffer], 11); + } + + [Test] + public void ResourcesData_MaxReadersAndVersionsPerResourceType() + { + var g = AllocateRenderGraph(); + var renderTargets = ImportAndCreateBuffers(g); + + var desc = new BufferDesc(1024, 16); + var buffer = g.CreateBuffer(desc); + + int indexName = 0; + + // TEXTURE PASSES: Create 2 versions with different reader counts + // Texture Pass 0: Create version 1 of extraBuffers[0] (ReadWrite = 1 write + 1 implicit read) + using (var builder = g.AddRasterRenderPass("TestPassTexture" + indexName++, out var passData)) + { + builder.AllowPassCulling(false); + builder.SetRenderAttachment(renderTargets.extraBuffers[0], 0, AccessFlags.ReadWrite); + builder.SetRenderFunc((RenderGraphTestPassData data, RasterGraphContext context) => { }); + } + // Texture Pass 1: Create version 2 of extraBuffers[0] (ReadWrite = 1 write + 1 explicit read of version 1) + using (var builder = g.AddRasterRenderPass("TestPassTexture" + indexName++, out var passData)) + { + builder.AllowPassCulling(false); + builder.SetRenderAttachment(renderTargets.extraBuffers[0], 0, AccessFlags.ReadWrite); + builder.SetRenderFunc((RenderGraphTestPassData data, RasterGraphContext context) => { }); + } + + // BUFFER PASSES: Create many versions to test higher reader/version counts + indexName = 0; + for (int i = 0; i < 5; ++i) + { + // Buffer Pass (Write): Creates version N (1 write + 1 implicit read from previous version) + using (var builder = g.AddRasterRenderPass("TestPassBuffer" + indexName++, out var passData)) + { + builder.AllowPassCulling(false); + builder.UseBufferRandomAccess(buffer, 0, AccessFlags.Write); + builder.SetRenderFunc((RenderGraphTestPassData data, RasterGraphContext context) => { }); + } + // Buffer Pass (ReadWrite): Creates version N+1 (1 write + 1 explicit read from version N) + using (var builder = g.AddRasterRenderPass("TestPassBuffer" + indexName++, out var passData)) + { + builder.AllowPassCulling(false); + builder.UseBufferRandomAccess(buffer, 0, AccessFlags.ReadWrite); + builder.SetRenderFunc((RenderGraphTestPassData data, RasterGraphContext context) => { }); + } + } + + var result = g.CompileNativeRenderGraph(g.ComputeGraphHash()); + var passes = result.contextData.GetNativePasses(); + + // VERIFY: MaxReaders and MaxVersions are calculated PER RESOURCE TYPE + // TEXTURE TYPE: + // 2 readwrite operations = 2 versions + 1 offset = 3 versions/readers. + Assert.AreEqual(result.contextData.resources.MaxReaders[(int)RenderGraphResourceType.Texture], 3); + Assert.AreEqual(result.contextData.resources.MaxVersions[(int)RenderGraphResourceType.Texture], 3); + + // BUFFER TYPE: + // 5 write operations + 5 readwrite operations = 10 versions + 1 offset = 11 versions/readers. + Assert.AreEqual(result.contextData.resources.MaxReaders[(int)RenderGraphResourceType.Buffer], 11); + Assert.AreEqual(result.contextData.resources.MaxVersions[(int)RenderGraphResourceType.Buffer], 11); + + // VERIFY: Index calculations work correctly with per-type maximums + // Get the texture handle from the first native pass attachment + var textureHandle = passes[0].attachments[0].handle; + Assert.AreEqual(renderTargets.extraBuffers[0].handle.index, passes[0].attachments[0].handle.index); + + // Test Index() calculation uses correct MaxVersions for texture type + int indexExpected = textureHandle.index * result.contextData.resources.MaxVersions[(int)RenderGraphResourceType.Texture] + textureHandle.version; + Assert.AreEqual(result.contextData.resources.Index(textureHandle), indexExpected); + Assert.IsTrue(indexExpected < result.contextData.resources.versionedData[(int)RenderGraphResourceType.Texture].Capacity); + + // Test IndexReader() calculation uses correct MaxReaders for texture type + int indexReaderExpected = indexExpected * result.contextData.resources.MaxReaders[(int)RenderGraphResourceType.Texture] + 0; + Assert.AreEqual(result.contextData.resources.IndexReader(textureHandle, 0), indexReaderExpected); + Assert.IsTrue(indexExpected < result.contextData.resources.readerData[(int)RenderGraphResourceType.Texture].Capacity); } [Test] @@ -1509,7 +1586,7 @@ public void UpdateSubpassAttachmentIndices_WhenDepthAttachmentIsAdded() builder.SetRenderFunc((RenderGraphTestPassData data, RasterGraphContext context) => { }); builder.AllowPassCulling(false); } - + // Render Pass // attachments: [extraBuffers[0], extraBuffers[1]] // subpass 0: color outputs : [0] diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/canvas-master-stack-reference.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/canvas-master-stack-reference.md index efa077e5724..ce06104815a 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Documentation~/canvas-master-stack-reference.md +++ b/Packages/com.unity.render-pipelines.high-definition/Documentation~/canvas-master-stack-reference.md @@ -62,4 +62,4 @@ The following table describes the Surface options: [!include[](snippets/shader-properties/surface-options/material-type.md)] [!include[](snippets/shader-properties/surface-options/alpha-clipping.md)] - +[!include[](snippets/shader-properties/surface-options/disable-color-tint.md)] diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/disable-color-tint.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/disable-color-tint.md new file mode 100644 index 00000000000..a49f8f41d2c --- /dev/null +++ b/Packages/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/disable-color-tint.md @@ -0,0 +1,6 @@ + +Disable Color Tint +N/A +N/A +Prevents Shader Graph tinting the texture with the color of the UI element. If you enable this setting, use a [Vertex Color Node](https://docs.unity3d.com/Packages/com.unity.shadergraph@latest/index.html?preview=1&subfolder=/manual/Vertex-Color-Node.html) to access the color of the UI element. + diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplaySettingsCamera.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplaySettingsCamera.cs index 46509f724a9..d84ccbe9e4c 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplaySettingsCamera.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplaySettingsCamera.cs @@ -10,29 +10,8 @@ class DebugDisplaySettingsCamera : IDebugDisplaySettingsData [Serializable] public class FrameSettingsDebugData { - private Camera m_SelectedCamera; - public Camera selectedCamera - { - get - { -#if UNITY_EDITOR - if (m_SelectedCamera == null && UnityEditor.SceneView.lastActiveSceneView != null) - { - var sceneCamera = UnityEditor.SceneView.lastActiveSceneView.camera; - if (sceneCamera != null) - m_SelectedCamera = sceneCamera; - } -#endif - return m_SelectedCamera; - } - set - { - if (value != null && value != m_SelectedCamera) - { - m_SelectedCamera = value; - } - } - } + public Camera selectedCamera { get; set; } + public Dictionary registeredCameras = new (); } @@ -98,8 +77,8 @@ public static DebugUI.CameraSelector CreateCameraSelector(SettingsPanel panel, getter = () => panel.data.frameSettingsData.selectedCamera, setter = value => { - if (value is Camera cam && value != panel.data.frameSettingsData.selectedCamera) - panel.data.frameSettingsData.selectedCamera = cam; + if (value != panel.data.frameSettingsData.selectedCamera) + panel.data.frameSettingsData.selectedCamera = value as Camera; }, onValueChanged = refresh }; @@ -134,6 +113,12 @@ public SettingsPanel(DebugDisplaySettingsCamera data) : base(data) { m_CameraSelector = WidgetFactory.CreateCameraSelector(this, (_, __) => Refresh()); + + // Select first camera if none is selected + var availableCameras = m_CameraSelector.getObjects() as List; + if (data.frameSettingsData.selectedCamera == null && availableCameras is { Count: > 0 }) + data.frameSettingsData.selectedCamera = availableCameras[0]; + AddWidget(m_CameraSelector); if (GetOrCreateFrameSettingsWidgets(out var frameSettingsWidgets)) diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs index 149f974ab35..9cbf08dfde1 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs @@ -3694,7 +3694,7 @@ void LensFlareMergeOcclusionDataDrivenPass(RenderGraph renderGraph, HDCamera hdC (LensFlareData data, RenderGraphContext ctx) => { ctx.cmd.SetComputeTextureParam(data.parameters.lensFlareMergeOcclusion, data.parameters.mergeOcclusionKernel, HDShaderIDs._LensFlareOcclusion, LensFlareCommonSRP.occlusionRT); - if (passData.hdCamera.xr.enabled && passData.hdCamera.xr.singlePassEnabled) + if (data.hdCamera.xr.enabled && data.hdCamera.xr.singlePassEnabled) ctx.cmd.SetComputeIntParam(data.parameters.lensFlareMergeOcclusion, HDShaderIDs._MultipassID, -1); else ctx.cmd.SetComputeIntParam(data.parameters.lensFlareMergeOcclusion, HDShaderIDs._MultipassID, data.hdCamera.xr.multipassId); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs index 2d4a2e98567..ac2f81da2be 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs @@ -699,6 +699,12 @@ void RenderSkyBackground(RenderGraph renderGraph, HDCamera hdCamera, TextureHand // Override the exposure texture, as we need a neutral value for this render SetGlobalTexture(renderGraph, HDShaderIDs._ExposureTexture, m_EmptyExposureTexture); + // Parts of sky rendering may access shadowmap-related uniforms. + // In the full path tracing path, these uniforms won't actually be used, + // but they still need to be populated with neutral values, + // or we get errors about unpopulated uniforms. + HDShadowManager.BindDefaultShadowGlobalResources(renderGraph); + m_SkyManager.RenderSky(renderGraph, hdCamera, skyBuffer, CreateDepthBuffer(renderGraph, true, MSAASamples.None), "Render Sky Background for Path Tracing"); // Restore the regular exposure texture diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs index 43059815526..a497e130c22 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs @@ -82,6 +82,8 @@ public class BuiltinSkyParameters public static RenderTargetIdentifier nullRT = -1; /// Index of the current cubemap face to render (Unknown for texture2D). public CubemapFace cubemapFace = CubemapFace.Unknown; + /// Fallback for structured buffer of CelestialBodyData. + internal BufferHandle emptyCelestialBodyBuffer; /// /// Copy content of this BuiltinSkyParameters to another instance. @@ -381,6 +383,9 @@ void SetGlobalSkyData(RenderGraph renderGraph, SkyUpdateContext skyContext, Buil passData.builtinParameters.volumetricClouds = skyContext.volumetricClouds; passData.skyRenderer = skyContext.skyRenderer; + passData.builtinParameters.emptyCelestialBodyBuffer = builder.CreateTransientBuffer( + new BufferDesc(1, System.Runtime.InteropServices.Marshal.SizeOf(typeof(CelestialBodyData)))); + builder.SetRenderFunc( (SetGlobalSkyDataPassData data, RenderGraphContext ctx) => { diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyRenderer.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyRenderer.cs index 1a161401a3d..401d958259b 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyRenderer.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyRenderer.cs @@ -88,6 +88,17 @@ protected static float GetSkyIntensity(SkySettings skySettings, DebugDisplaySett /// Sky system builtin parameters. public virtual void SetGlobalSkyData(CommandBuffer cmd, BuiltinSkyParameters builtinParams) { + // bind empty resources for non-PBR sky. + if (ShaderConfig.s_PrecomputedAtmosphericAttenuation == 0) + { + cmd.SetGlobalTexture(HDShaderIDs._AirSingleScatteringTexture, (RenderTargetIdentifier)CoreUtils.blackVolumeTexture); + cmd.SetGlobalTexture(HDShaderIDs._AerosolSingleScatteringTexture, (RenderTargetIdentifier)CoreUtils.blackVolumeTexture); + cmd.SetGlobalTexture(HDShaderIDs._MultipleScatteringTexture, (RenderTargetIdentifier)CoreUtils.blackVolumeTexture); + } + else + cmd.SetGlobalTexture(HDShaderIDs._AtmosphericScatteringLUT, (RenderTargetIdentifier)CoreUtils.blackVolumeTexture); + + cmd.SetGlobalBuffer(HDShaderIDs._CelestialBodyDatas, builtinParams.emptyCelestialBodyBuffer); } internal bool DoUpdate(BuiltinSkyParameters parameters) diff --git a/Packages/com.unity.render-pipelines.high-definition/Samples~/WaterSamples/Scenes/Scene Resources/CaveSampleDescription.json b/Packages/com.unity.render-pipelines.high-definition/Samples~/WaterSamples/Scenes/Scene Resources/CaveSampleDescription.json index d4e7c8c028f..039d127107b 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Samples~/WaterSamples/Scenes/Scene Resources/CaveSampleDescription.json +++ b/Packages/com.unity.render-pipelines.high-definition/Samples~/WaterSamples/Scenes/Scene Resources/CaveSampleDescription.json @@ -19,7 +19,7 @@ You can open the Custom Pass

Custom Local Volumetric Fog

• To simulate light rays bouncing on the water surface, a Local Volumetric Fog with a custom material is used. -• This shader, simply sample the caustics texture passed by the script on the Water Surface using absolute world position node. +• This shader, simply sample the caustics texture passed by the BindTexture script on the Water Surface using absolute world position node. You can open the Local Volumetric Fog Shader Graph for more details. diff --git a/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/MotionVectorPass.hlsl b/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/MotionVectorPass.hlsl index e1c3a831dd1..980437a6ba8 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/MotionVectorPass.hlsl +++ b/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/MotionVectorPass.hlsl @@ -129,25 +129,32 @@ void vert( previousPositionOS -= passInput.alembicMotionVectorOS; #endif +#if defined(APPLICATION_SPACE_WARP_MOTION) + // We do not need jittered position in ASW + mvOutput.positionCSNoJitter = mul(_NonJitteredViewProjMatrix, float4(currentFrameMvData.positionWS, 1.0f)); + packedOutput.positionCS = mvOutput.positionCSNoJitter; + mvOutput.previousPositionCSNoJitter = mul(_PrevViewProjMatrix, mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f))); +#else mvOutput.positionCSNoJitter = mul(_NonJitteredViewProjMatrix, float4(currentFrameMvData.positionWS, 1.0f)); -#if defined(HAVE_VFX_MODIFICATION) - #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) - #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) || defined(_ADD_PRECOMPUTED_VELOCITY) - #error Unexpected fast path rendering VFX motion vector while there are vertex modification afterwards. - #endif - mvOutput.previousPositionCSNoJitter = VFXGetPreviousClipPosition(input, currentFrameMvData.vfxElementAttributes, mvOutput.positionCSNoJitter); - #else - #if VFX_WORLD_SPACE - //previousPositionOS is already in world space - const float3 previousPositionWS = previousPositionOS; + #if defined(HAVE_VFX_MODIFICATION) + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) || defined(_ADD_PRECOMPUTED_VELOCITY) + #error Unexpected fast path rendering VFX motion vector while there are vertex modification afterwards. + #endif + mvOutput.previousPositionCSNoJitter = VFXGetPreviousClipPosition(input, currentFrameMvData.vfxElementAttributes, mvOutput.positionCSNoJitter); #else - const float3 previousPositionWS = mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f)).xyz; + #if VFX_WORLD_SPACE + //previousPositionOS is already in world space + const float3 previousPositionWS = previousPositionOS; + #else + const float3 previousPositionWS = mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f)).xyz; + #endif + mvOutput.previousPositionCSNoJitter = mul(_PrevViewProjMatrix, float4(previousPositionWS, 1.0f)); #endif - mvOutput.previousPositionCSNoJitter = mul(_PrevViewProjMatrix, float4(previousPositionWS, 1.0f)); + #else + mvOutput.previousPositionCSNoJitter = mul(_PrevViewProjMatrix, mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f))); #endif -#else - mvOutput.previousPositionCSNoJitter = mul(_PrevViewProjMatrix, mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f))); #endif } @@ -175,6 +182,11 @@ float4 frag( LODFadeCrossFade(input.positionCS); #endif + +#if defined(APPLICATION_SPACE_WARP_MOTION) + return float4(CalcAswNdcMotionVectorFromCsPositions(mvInput.positionCSNoJitter, mvInput.previousPositionCSNoJitter), 1); +#else return float4(CalcNdcMotionVectorFromCsPositions(mvInput.positionCSNoJitter, mvInput.previousPositionCSNoJitter), 0, 0); +#endif } #endif diff --git a/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl b/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl index 3290545a8ba..1b7f4c32ae4 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl +++ b/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl @@ -34,7 +34,7 @@ VertexDescription BuildVertexDescription(Attributes input) #endif #endif -#if (SHADERPASS == SHADERPASS_MOTION_VECTORS) +#if (SHADERPASS == SHADERPASS_MOTION_VECTORS || SHADERPASS == SHADERPASS_XR_MOTION_VECTORS) // We want to gather some internal data from the BuildVaryings call to // avoid rereading and recalculating these values again in the ShaderGraph motion vector pass struct MotionVectorPassOutput @@ -55,7 +55,7 @@ struct MotionVectorPassOutput #if defined(HAVE_VFX_MODIFICATION) bool PrepareVFXModification(inout Attributes input, inout Varyings output, inout AttributesElement element - #if (SHADERPASS == SHADERPASS_MOTION_VECTORS) + #if (SHADERPASS == SHADERPASS_MOTION_VECTORS || SHADERPASS == SHADERPASS_XR_MOTION_VECTORS) , inout MotionVectorPassOutput motionVectorOutput #endif ) @@ -72,7 +72,7 @@ bool PrepareVFXModification(inout Attributes input, inout Varyings output, inout SetupVFXMatrices(element, output); -#if (SHADERPASS == SHADERPASS_MOTION_VECTORS) +#if (SHADERPASS == SHADERPASS_MOTION_VECTORS || SHADERPASS == SHADERPASS_XR_MOTION_VECTORS) motionVectorOutput.vfxParticlePositionOS = input.positionOS; #endif @@ -81,7 +81,7 @@ bool PrepareVFXModification(inout Attributes input, inout Varyings output, inout #endif Varyings BuildVaryings(Attributes input -#if (SHADERPASS == SHADERPASS_MOTION_VECTORS) +#if (SHADERPASS == SHADERPASS_MOTION_VECTORS || SHADERPASS == SHADERPASS_XR_MOTION_VECTORS) , inout MotionVectorPassOutput motionVectorOutput #endif ) @@ -98,7 +98,7 @@ Varyings BuildVaryings(Attributes input AttributesElement element; ZERO_INITIALIZE(AttributesElement, element); - #if (SHADERPASS == SHADERPASS_MOTION_VECTORS) + #if (SHADERPASS == SHADERPASS_MOTION_VECTORS || SHADERPASS == SHADERPASS_XR_MOTION_VECTORS) isCulledOrDead = PrepareVFXModification(input, output, element, motionVectorOutput); #else isCulledOrDead = PrepareVFXModification(input, output, element); @@ -137,7 +137,7 @@ Varyings BuildVaryings(Attributes input // Returns the camera relative position (if enabled) float3 positionWS = TransformObjectToWorld(input.positionOS); - #if (SHADERPASS == SHADERPASS_MOTION_VECTORS) + #if (SHADERPASS == SHADERPASS_MOTION_VECTORS || SHADERPASS == SHADERPASS_XR_MOTION_VECTORS) motionVectorOutput.positionOS = input.positionOS; motionVectorOutput.positionWS = positionWS; #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) diff --git a/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalTarget.cs b/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalTarget.cs index 4f13fe7b098..63c3cb09cf2 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalTarget.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalTarget.cs @@ -1167,23 +1167,20 @@ public static PassDescriptor XRMotionVectors(UniversalTarget target) displayName = "XRMotionVectors", referenceName = "SHADERPASS_XR_MOTION_VECTORS", lightMode = "XRMotionVectors", - useInPreview = true, + useInPreview = false, // Template passTemplatePath = UniversalTarget.kUberTemplatePath, sharedTemplateDirectories = UniversalTarget.kSharedTemplateDirectories, // Port Mask - validVertexBlocks = new BlockFieldDescriptor[]{ }, - validPixelBlocks = new BlockFieldDescriptor[] { }, + validVertexBlocks = CoreBlockMasks.MotionVectorVertex, + validPixelBlocks = CoreBlockMasks.FragmentAlphaOnly, // Fields - structs = new StructCollection() { - { Structs.SurfaceDescriptionInputs }, - { Structs.VertexDescriptionInputs }, - }, + structs = CoreStructCollections.Default, requiredFields = new FieldCollection(), - fieldDependencies = new DependencyCollection() { }, + fieldDependencies = CoreFieldDependencies.Default, // Conditional State renderStates = CoreRenderStates.XRMotionVector(target), @@ -1191,10 +1188,16 @@ public static PassDescriptor XRMotionVectors(UniversalTarget target) defines = new DefineCollection(), keywords = new KeywordCollection(), includes = CoreIncludes.XRMotionVectors, + + // Custom Interpolator Support + customInterpolators = CoreCustomInterpDescriptors.Common }; result.defines.Add(CoreKeywordDescriptors.XRMotionVectors, 1); + AddAlphaClipControlToPass(ref result, target); + AddLODCrossFadeControlToPass(ref result, target); + return result; } @@ -1678,8 +1681,10 @@ static class CorePragmas public static readonly PragmaCollection XRMotionVectors = new PragmaCollection { - { Pragma.MultiCompileLodCrossfade }, - { Pragma.ShaderFeatureLocalVertex("_ADD_PRECOMPUTED_VELOCITY") }, + { Pragma.Target(ShaderModel.Target35) }, + { Pragma.MultiCompileInstancing }, + { Pragma.Vertex("vert") }, + { Pragma.Fragment("frag") }, }; public static readonly PragmaCollection Forward = new PragmaCollection @@ -1740,7 +1745,6 @@ static class CoreIncludes const string kFog = "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Fog.hlsl"; const string kRenderingLayers = "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"; const string kProbeVolumes = "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl"; - const string kObjectMotionVectors = "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ObjectMotionVectors.hlsl"; public static readonly IncludeCollection CorePregraph = new IncludeCollection { @@ -1775,11 +1779,6 @@ static class CoreIncludes { kProbeVolumes, IncludeLocation.Pregraph, true }, }; - public static readonly IncludeCollection ObjectMotionVectors = new IncludeCollection - { - { kObjectMotionVectors, IncludeLocation.Pregraph, true }, - }; - public static readonly IncludeCollection ShaderGraphPregraph = new IncludeCollection { { kGraphFunctions, IncludeLocation.Pregraph }, @@ -1832,9 +1831,13 @@ static class CoreIncludes public static readonly IncludeCollection XRMotionVectors = new IncludeCollection { // Pre-graph + { DOTSPregraph }, { CorePregraph }, { ShaderGraphPregraph }, - { ObjectMotionVectors }, + + //Post-graph + { CorePostgraph }, + { kMotionVectorPass, IncludeLocation.Postgraph }, }; public static readonly IncludeCollection ShadowCaster = new IncludeCollection diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Passes/Utility/RendererLighting.cs b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Passes/Utility/RendererLighting.cs index d334cb19943..b457a1b1891 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Passes/Utility/RendererLighting.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Passes/Utility/RendererLighting.cs @@ -12,7 +12,6 @@ internal static class RendererLighting private static readonly ShaderTagId k_NormalsRenderingPassName = new ShaderTagId("NormalsRendering"); public static readonly Color k_NormalClearColor = new Color(0.5f, 0.5f, 0.5f, 1.0f); private static readonly string k_UsePointLightCookiesKeyword = "USE_POINT_LIGHT_COOKIES"; - private static readonly string k_UseSpriteLight = "USE_SPRITE_LIGHT"; private static readonly string k_LightQualityFastKeyword = "LIGHT_QUALITY_FAST"; private static readonly string k_UseNormalMap = "USE_NORMAL_MAP"; private static readonly string k_UseShadowMap = "USE_SHADOW_MAP"; @@ -673,15 +672,13 @@ private static uint GetLightMaterialIndex(Light2D light, bool isVolume, bool use bitIndex++; var pointCookieBit = (isPoint && light.lightCookieSprite != null && light.lightCookieSprite.texture != null) ? 1u << bitIndex : 0u; bitIndex++; - var spriteLightBit = (light.lightType == Light2D.LightType.Sprite) ? 1u << bitIndex : 0u; - bitIndex++; var fastQualityBit = (light.normalMapQuality == Light2D.NormalMapQuality.Fast) ? 1u << bitIndex : 0u; bitIndex++; var useNormalMap = light.normalMapQuality != Light2D.NormalMapQuality.Disabled ? 1u << bitIndex : 0u; bitIndex++; var useShadowMap = useShadows ? 1u << bitIndex : 0u; - return fastQualityBit | pointCookieBit | spriteLightBit | additiveBit | shapeBit | volumeBit | useNormalMap | useShadowMap; + return fastQualityBit | pointCookieBit | additiveBit | shapeBit | volumeBit | useNormalMap | useShadowMap; } private static Material CreateLightMaterial(Renderer2DData rendererData, Light2D light, bool isVolume, bool useShadows) @@ -718,9 +715,6 @@ private static Material CreateLightMaterial(Renderer2DData rendererData, Light2D if (isPoint && light.lightCookieSprite != null && light.lightCookieSprite.texture != null) material.EnableKeyword(k_UsePointLightCookiesKeyword); - if (light.lightType == Light2D.LightType.Sprite) - material.EnableKeyword(k_UseSpriteLight); - if (light.normalMapQuality == Light2D.NormalMapQuality.Fast) material.EnableKeyword(k_LightQualityFastKeyword); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/DrawLight2DPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/DrawLight2DPass.cs index 8956087b2b9..c01df808ad4 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/DrawLight2DPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/DrawLight2DPass.cs @@ -8,11 +8,11 @@ namespace UnityEngine.Rendering.Universal internal class DrawLight2DPass : ScriptableRenderPass { static readonly string k_LightPass = "Light2D Pass"; - static readonly string k_LightLowLevelPass = "Light2D LowLevelPass"; + static readonly string k_LightSRTPass = "Light2D SRT Pass"; static readonly string k_LightVolumetricPass = "Light2D Volumetric Pass"; private static readonly ProfilingSampler m_ProfilingSampler = new ProfilingSampler(k_LightPass); - private static readonly ProfilingSampler m_ProfilingSamplerLowLevel = new ProfilingSampler(k_LightLowLevelPass); + private static readonly ProfilingSampler m_ProfilingSampleSRT = new ProfilingSampler(k_LightSRTPass); private static readonly ProfilingSampler m_ProfilingSamplerVolume = new ProfilingSampler(k_LightVolumetricPass); internal static readonly int k_InverseHDREmulationScaleID = Shader.PropertyToID("_InverseHDREmulationScale"); internal static readonly string k_NormalMapID = "_NormalMap"; @@ -22,7 +22,7 @@ internal class DrawLight2DPass : ScriptableRenderPass internal static MaterialPropertyBlock s_PropertyBlock = new MaterialPropertyBlock(); - public void Setup(RenderGraph renderGraph, ref Renderer2DData rendererData) + internal void Setup(RenderGraph renderGraph, ref Renderer2DData rendererData) { foreach (var light in rendererData.lightCullResult.visibleLights) { @@ -53,158 +53,78 @@ public override void Execute(ScriptableRenderContext context, ref RenderingData throw new NotImplementedException(); } - private static void Execute(RasterCommandBuffer cmd, PassData passData, ref LayerBatch layerBatch) + private static void Execute(RasterCommandBuffer cmd, PassData passData, ref LayerBatch layerBatch, int lightTextureIndex) { cmd.SetGlobalFloat(k_InverseHDREmulationScaleID, 1.0f / passData.rendererData.hdrEmulationScale); - for (var i = 0; i < layerBatch.activeBlendStylesIndices.Length; ++i) - { - var blendStyleIndex = layerBatch.activeBlendStylesIndices[i]; - var blendOpName = passData.rendererData.lightBlendStyles[blendStyleIndex].name; - cmd.BeginSample(blendOpName); + var blendStyleIndex = layerBatch.activeBlendStylesIndices[lightTextureIndex]; + var blendOpName = passData.rendererData.lightBlendStyles[blendStyleIndex].name; + cmd.BeginSample(blendOpName); - if (!passData.isVolumetric) - RendererLighting.EnableBlendStyle(cmd, i, true); + var indicesIndex = Renderer2D.supportsMRT ? lightTextureIndex : 0; + if (!passData.isVolumetric) + RendererLighting.EnableBlendStyle(cmd, indicesIndex, true); - var lights = passData.layerBatch.lights; + var lights = passData.layerBatch.lights; - for (int j = 0; j < lights.Count; ++j) - { - var light = lights[j]; + for (int j = 0; j < lights.Count; ++j) + { + var light = lights[j]; - // Check if light is valid - if (light == null || - light.lightType == Light2D.LightType.Global || - light.blendStyleIndex != blendStyleIndex) - continue; + // Check if light is valid + if (light == null || + light.lightType == Light2D.LightType.Global || + light.blendStyleIndex != blendStyleIndex) + continue; - // Check if light is volumetric - if (passData.isVolumetric && - (light.volumeIntensity <= 0.0f || - !light.volumetricEnabled || - layerBatch.endLayerValue != light.GetTopMostLitLayer())) - continue; + // Check if light is volumetric + if (passData.isVolumetric && + (light.volumeIntensity <= 0.0f || + !light.volumetricEnabled || + layerBatch.endLayerValue != light.GetTopMostLitLayer())) + continue; - var useShadows = passData.layerBatch.lightStats.useShadows && layerBatch.shadowIndices.Contains(j); - var lightMaterial = passData.rendererData.GetLightMaterial(light, passData.isVolumetric, useShadows); - var lightMesh = light.lightMesh; + var useShadows = passData.layerBatch.lightStats.useShadows && layerBatch.shadowIndices.Contains(j); + var lightMaterial = passData.rendererData.GetLightMaterial(light, passData.isVolumetric, useShadows); + var lightMesh = light.lightMesh; - // For Batching. - var index = light.batchSlotIndex; - var slotIndex = RendererLighting.lightBatch.SlotIndex(index); - bool canBatch = RendererLighting.lightBatch.CanBatch(light, lightMaterial, index, out int lightHash); + // For Batching. + var index = light.batchSlotIndex; + var slotIndex = RendererLighting.lightBatch.SlotIndex(index); + bool canBatch = RendererLighting.lightBatch.CanBatch(light, lightMaterial, index, out int lightHash); - bool breakBatch = !canBatch; - if (breakBatch && LightBatch.isBatchingSupported) - RendererLighting.lightBatch.Flush(cmd); + bool breakBatch = !canBatch; + if (breakBatch && LightBatch.isBatchingSupported) + RendererLighting.lightBatch.Flush(cmd); - if (passData.layerBatch.lightStats.useNormalMap) - s_PropertyBlock.SetTexture(k_NormalMapID, passData.normalMap); + if (passData.layerBatch.lightStats.useNormalMap) + s_PropertyBlock.SetTexture(k_NormalMapID, passData.normalMap); - if (useShadows && TryGetShadowIndex(ref layerBatch, j, out var shadowIndex)) - s_PropertyBlock.SetTexture(k_ShadowMapID, passData.shadowTextures[shadowIndex]); + if (useShadows && TryGetShadowIndex(ref layerBatch, j, out var shadowIndex)) + s_PropertyBlock.SetTexture(k_ShadowMapID, passData.shadowTextures[shadowIndex]); - if (!passData.isVolumetric || (passData.isVolumetric && light.volumetricEnabled)) - RendererLighting.SetCookieShaderProperties(light, s_PropertyBlock); + if (!passData.isVolumetric || (passData.isVolumetric && light.volumetricEnabled)) + RendererLighting.SetCookieShaderProperties(light, s_PropertyBlock); - // Set shader global properties - RendererLighting.SetPerLightShaderGlobals(cmd, light, slotIndex, passData.isVolumetric, useShadows, LightBatch.isBatchingSupported); + // Set shader global properties + RendererLighting.SetPerLightShaderGlobals(cmd, light, slotIndex, passData.isVolumetric, useShadows, LightBatch.isBatchingSupported); - if (light.normalMapQuality != Light2D.NormalMapQuality.Disabled || light.lightType == Light2D.LightType.Point) - RendererLighting.SetPerPointLightShaderGlobals(cmd, light, slotIndex, LightBatch.isBatchingSupported); + if (light.normalMapQuality != Light2D.NormalMapQuality.Disabled || light.lightType == Light2D.LightType.Point) + RendererLighting.SetPerPointLightShaderGlobals(cmd, light, slotIndex, LightBatch.isBatchingSupported); - if (LightBatch.isBatchingSupported) - { - RendererLighting.lightBatch.AddBatch(light, lightMaterial, light.GetMatrix(), lightMesh, 0, lightHash, index); - RendererLighting.lightBatch.Flush(cmd); - } - else - { - cmd.DrawMesh(lightMesh, light.GetMatrix(), lightMaterial, 0, 0, s_PropertyBlock); - } + if (LightBatch.isBatchingSupported) + { + RendererLighting.lightBatch.AddBatch(light, lightMaterial, light.GetMatrix(), lightMesh, 0, lightHash, index); + RendererLighting.lightBatch.Flush(cmd); } - - RendererLighting.EnableBlendStyle(cmd, i, false); - cmd.EndSample(blendOpName); - } - } - - internal static void ExecuteUnsafe(UnsafeCommandBuffer cmd, PassData passData, ref LayerBatch layerBatch, List lights) - { - cmd.SetGlobalFloat(k_InverseHDREmulationScaleID, 1.0f / passData.rendererData.hdrEmulationScale); - - for (var i = 0; i < layerBatch.activeBlendStylesIndices.Length; ++i) - { - var blendStyleIndex = layerBatch.activeBlendStylesIndices[i]; - var blendOpName = passData.rendererData.lightBlendStyles[blendStyleIndex].name; - cmd.BeginSample(blendOpName); - - if (!Renderer2D.supportsMRT && !passData.isVolumetric) - cmd.SetRenderTarget(passData.lightTextures[i]); - - var indicesIndex = Renderer2D.supportsMRT ? i : 0; - if (!passData.isVolumetric) - RendererLighting.EnableBlendStyle(cmd, indicesIndex, true); - - for (int j = 0; j < lights.Count; ++j) + else { - var light = lights[j]; - - // Check if light is valid - if (light == null || - light.lightType == Light2D.LightType.Global || - light.blendStyleIndex != blendStyleIndex) - continue; - - // Check if light is volumetric - if (passData.isVolumetric && - (light.volumeIntensity <= 0.0f || - !light.volumetricEnabled || - layerBatch.endLayerValue != light.GetTopMostLitLayer())) - continue; - - var useShadows = passData.layerBatch.lightStats.useShadows && layerBatch.shadowIndices.Contains(j); - var lightMaterial = passData.rendererData.GetLightMaterial(light, passData.isVolumetric, useShadows); - var lightMesh = light.lightMesh; - - // For Batching. - var index = light.batchSlotIndex; - var slotIndex = RendererLighting.lightBatch.SlotIndex(index); - bool canBatch = RendererLighting.lightBatch.CanBatch(light, lightMaterial, index, out int lightHash); - - //bool breakBatch = !canBatch; - //if (breakBatch && LightBatch.isBatchingSupported) - // RendererLighting.lightBatch.Flush(cmd); - - if (passData.layerBatch.lightStats.useNormalMap) - s_PropertyBlock.SetTexture(k_NormalMapID, passData.normalMap); - - if (useShadows && TryGetShadowIndex(ref layerBatch, j, out var shadowIndex)) - s_PropertyBlock.SetTexture(k_ShadowMapID, passData.shadowTextures[shadowIndex]); - - if (!passData.isVolumetric || (passData.isVolumetric && light.volumetricEnabled)) - RendererLighting.SetCookieShaderProperties(light, s_PropertyBlock); - - // Set shader global properties - RendererLighting.SetPerLightShaderGlobals(cmd, light, slotIndex, passData.isVolumetric, useShadows, LightBatch.isBatchingSupported); - - if (light.normalMapQuality != Light2D.NormalMapQuality.Disabled || light.lightType == Light2D.LightType.Point) - RendererLighting.SetPerPointLightShaderGlobals(cmd, light, slotIndex, LightBatch.isBatchingSupported); - - //if (LightBatch.isBatchingSupported) - //{ - // RendererLighting.lightBatch.AddBatch(light, lightMaterial, light.GetMatrix(), lightMesh, 0, lightHash, index); - // RendererLighting.lightBatch.Flush(cmd); - //} - //else - { - cmd.DrawMesh(lightMesh, light.GetMatrix(), lightMaterial, 0, 0, s_PropertyBlock); - } + cmd.DrawMesh(lightMesh, light.GetMatrix(), lightMaterial, 0, 0, s_PropertyBlock); } - - RendererLighting.EnableBlendStyle(cmd, indicesIndex, false); - cmd.EndSample(blendOpName); } + + RendererLighting.EnableBlendStyle(cmd, indicesIndex, false); + cmd.EndSample(blendOpName); } internal class PassData @@ -216,15 +136,46 @@ internal class PassData internal TextureHandle normalMap; internal TextureHandle[] shadowTextures; - // TODO: Optimize and remove low level pass - // For low level shadow and light pass - internal TextureHandle[] lightTextures; + internal int lightTextureIndex; } - public void Render(RenderGraph graph, ContextContainer frameData, Renderer2DData rendererData, ref LayerBatch layerBatch, int batchIndex, bool isVolumetric = false) + void InitializeRenderPass(IRasterRenderGraphBuilder builder, ContextContainer frameData, PassData passData, Renderer2DData rendererData, ref LayerBatch layerBatch, int batchIndex, bool isVolumetric = false) { Universal2DResourceData universal2DResourceData = frameData.Get(); CommonResourceData commonResourceData = frameData.Get(); + + intermediateTexture[0] = commonResourceData.activeColorTexture; + + if (layerBatch.lightStats.useNormalMap) + builder.UseTexture(universal2DResourceData.normalsTexture[batchIndex]); + + if (layerBatch.lightStats.useShadows) + { + passData.shadowTextures = universal2DResourceData.shadowTextures[batchIndex]; + for (var i = 0; i < passData.shadowTextures.Length; i++) + builder.UseTexture(passData.shadowTextures[i]); + } + + foreach (var light in layerBatch.lights) + { + if (light == null || !light.m_CookieSpriteTextureHandle.IsValid()) + continue; + + if (!isVolumetric || (isVolumetric && light.volumetricEnabled)) + builder.UseTexture(light.m_CookieSpriteTextureHandle); + } + + passData.layerBatch = layerBatch; + passData.rendererData = rendererData; + passData.isVolumetric = isVolumetric; + passData.normalMap = layerBatch.lightStats.useNormalMap ? universal2DResourceData.normalsTexture[batchIndex] : TextureHandle.nullHandle; + + builder.AllowGlobalStateModification(true); + } + + internal void Render(RenderGraph graph, ContextContainer frameData, Renderer2DData rendererData, ref LayerBatch layerBatch, int batchIndex, bool isVolumetric = false) + { + Universal2DResourceData universal2DResourceData = frameData.Get(); UniversalCameraData cameraData = frameData.Get(); DebugHandler debugHandler = ScriptableRenderPass.GetActiveDebugHandler(cameraData); @@ -243,47 +194,26 @@ public void Render(RenderGraph graph, ContextContainer frameData, Renderer2DData !isDebugLightingActive) return; - // Render single RTs by using low level pass for apis that don't support MRTs + // Render single RTs by for apis that don't support MRTs if (!isVolumetric && !Renderer2D.supportsMRT) { - using (var builder = graph.AddUnsafePass(k_LightLowLevelPass, out var passData, m_ProfilingSamplerLowLevel)) + for (var i = 0; i < layerBatch.activeBlendStylesIndices.Length; ++i) { - intermediateTexture[0] = commonResourceData.activeColorTexture; - passData.lightTextures = universal2DResourceData.lightTextures[batchIndex]; - - for (var i = 0; i < passData.lightTextures.Length; i++) - builder.UseTexture(passData.lightTextures[i], AccessFlags.Write); - - if (layerBatch.lightStats.useNormalMap) - builder.UseTexture(universal2DResourceData.normalsTexture[batchIndex]); - - if (layerBatch.lightStats.useShadows) + using (var builder = graph.AddRasterRenderPass(k_LightSRTPass, out var passData, m_ProfilingSampleSRT)) { - passData.shadowTextures = universal2DResourceData.shadowTextures[batchIndex]; - for (var i = 0; i < passData.shadowTextures.Length; i++) - builder.UseTexture(passData.shadowTextures[i]); - } + InitializeRenderPass(builder, frameData, passData, rendererData, ref layerBatch, batchIndex, isVolumetric); - foreach (var light in layerBatch.lights) - { - if (light == null || !light.m_CookieSpriteTextureHandle.IsValid()) - continue; - - if (!isVolumetric || (isVolumetric && light.volumetricEnabled)) - builder.UseTexture(light.m_CookieSpriteTextureHandle); - } + var lightTextures = universal2DResourceData.lightTextures[batchIndex]; - passData.layerBatch = layerBatch; - passData.rendererData = rendererData; - passData.isVolumetric = isVolumetric; - passData.normalMap = layerBatch.lightStats.useNormalMap ? universal2DResourceData.normalsTexture[batchIndex] : TextureHandle.nullHandle; + builder.SetRenderAttachment(lightTextures[i], 0); - builder.AllowGlobalStateModification(true); + passData.lightTextureIndex = i; - builder.SetRenderFunc((PassData data, UnsafeGraphContext context) => - { - ExecuteUnsafe(context.cmd, data, ref data.layerBatch, data.layerBatch.lights); - }); + builder.SetRenderFunc((PassData data, RasterGraphContext context) => + { + Execute(context.cmd, data, ref data.layerBatch, data.lightTextureIndex); + }); + } } } else @@ -291,41 +221,17 @@ public void Render(RenderGraph graph, ContextContainer frameData, Renderer2DData // Default Raster Pass with MRTs using (var builder = graph.AddRasterRenderPass(!isVolumetric ? k_LightPass : k_LightVolumetricPass, out var passData, !isVolumetric ? m_ProfilingSampler : m_ProfilingSamplerVolume)) { - intermediateTexture[0] = commonResourceData.activeColorTexture; + InitializeRenderPass(builder, frameData, passData, rendererData, ref layerBatch, batchIndex, isVolumetric); + var lightTextures = !isVolumetric ? universal2DResourceData.lightTextures[batchIndex] : intermediateTexture; for (var i = 0; i < lightTextures.Length; i++) builder.SetRenderAttachment(lightTextures[i], i); - - if (layerBatch.lightStats.useNormalMap) - builder.UseTexture(universal2DResourceData.normalsTexture[batchIndex]); - - if (layerBatch.lightStats.useShadows) - { - passData.shadowTextures = universal2DResourceData.shadowTextures[batchIndex]; - for (var i = 0; i < passData.shadowTextures.Length; i++) - builder.UseTexture(passData.shadowTextures[i]); - } - - foreach (var light in layerBatch.lights) - { - if (light == null || !light.m_CookieSpriteTextureHandle.IsValid()) - continue; - - if (!isVolumetric || (isVolumetric && light.volumetricEnabled)) - builder.UseTexture(light.m_CookieSpriteTextureHandle); - } - - passData.layerBatch = layerBatch; - passData.rendererData = rendererData; - passData.isVolumetric = isVolumetric; - passData.normalMap = layerBatch.lightStats.useNormalMap ? universal2DResourceData.normalsTexture[batchIndex] : TextureHandle.nullHandle; - - builder.AllowGlobalStateModification(true); - + builder.SetRenderFunc((PassData data, RasterGraphContext context) => { - Execute(context.cmd, data, ref data.layerBatch); + for (var i = 0; i < data.layerBatch.activeBlendStylesIndices.Length; ++i) + Execute(context.cmd, data, ref data.layerBatch, i); }); } } 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 d70a8ee62ba..b9b5190f735 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/FinalBlitPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/FinalBlitPass.cs @@ -212,7 +212,7 @@ public override void Execute(ScriptableRenderContext context, ref RenderingData loadAction = RenderBufferLoadAction.Load; #endif - CoreUtils.SetRenderTarget(renderingData.commandBuffer, cameraTargetHandle, loadAction, RenderBufferStoreAction.Store, ClearFlag.None, Color.clear); + CoreUtils.SetRenderTarget(renderingData.commandBuffer, cameraTargetHandle.nameID, loadAction, RenderBufferStoreAction.Store, ClearFlag.None, Color.clear); ExecutePass(CommandBufferHelpers.GetRasterCommandBuffer(renderingData.commandBuffer), m_PassData, m_Source, cameraTargetHandle, cameraData); cameraData.renderer.ConfigureCameraTarget(cameraTargetHandle, cameraTargetHandle); } diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcessPass.cs index 11faeacdc28..e6de667ebd8 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcessPass.cs @@ -1340,8 +1340,8 @@ void SetupBloom(CommandBuffer cmd, RTHandle source, Material uberMaterial, bool default: throw new System.ArgumentOutOfRangeException(); } - int tw = m_Descriptor.width >> downres; - int th = m_Descriptor.height >> downres; + int tw = Mathf.Max(1, m_Descriptor.width >> downres); + int th = Mathf.Max(1, m_Descriptor.height >> downres); // Determine the iteration count int maxSize = Mathf.Max(tw, th); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcessPassRenderGraph.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcessPassRenderGraph.cs index 6d58c6a369d..60724fb03a7 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcessPassRenderGraph.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcessPassRenderGraph.cs @@ -359,11 +359,9 @@ internal bool Equals(ref BloomMaterialParams other) } } - public void RenderBloomTexture(RenderGraph renderGraph, in TextureHandle source, out TextureHandle destination, bool enableAlphaOutput) + public Vector2Int CalcBloomResolution(Bloom bloom, in TextureDesc bloomSourceDesc) { - var srcDesc = source.GetDescriptor(renderGraph); - - // Start at half-res + // Start at half-res int downres = 1; switch (m_Bloom.downscale.value) { @@ -379,13 +377,29 @@ public void RenderBloomTexture(RenderGraph renderGraph, in TextureHandle source, //We should set the limit the downres result to ensure we dont turn 1x1 textures, which should technically be valid //into 0x0 textures which will be invalid - int tw = Mathf.Max(1, srcDesc.width >> downres); - int th = Mathf.Max(1, srcDesc.height >> downres); + int tw = Mathf.Max(1, bloomSourceDesc.width >> downres); + int th = Mathf.Max(1, bloomSourceDesc.height >> downres); + + return new Vector2Int(tw, th); + } + public int CalcBloomMipCount(Bloom bloom, Vector2Int bloomResolution) + { // Determine the iteration count - int maxSize = Mathf.Max(tw, th); + int maxSize = Mathf.Max(bloomResolution.x, bloomResolution.y); int iterations = Mathf.FloorToInt(Mathf.Log(maxSize, 2f) - 1); int mipCount = Mathf.Clamp(iterations, 1, m_Bloom.maxIterations.value); + return mipCount; + } + + public void RenderBloomTexture(RenderGraph renderGraph, in TextureHandle source, out TextureHandle destination, bool enableAlphaOutput) + { + var srcDesc = source.GetDescriptor(renderGraph); + + Vector2Int bloomRes = CalcBloomResolution(m_Bloom, in srcDesc); + int mipCount = CalcBloomMipCount(m_Bloom, bloomRes); + int tw = bloomRes.x; + int th = bloomRes.y; // Setup using(new ProfilingScope(ProfilingSampler.Get(URPProfileId.RG_BloomSetup))) @@ -2116,9 +2130,21 @@ public void RenderPostProcessingRenderGraph(RenderGraph renderGraph, ContextCont if (useLensFlareScreenSpace) { - int maxBloomMip = Mathf.Clamp(m_LensFlareScreenSpace.bloomMip.value, 0, m_Bloom.maxIterations.value/2); - bool sameInputOutputTex = maxBloomMip == 0; - bloomTexture = RenderLensFlareScreenSpace(renderGraph, cameraData.camera, srcDesc, bloomTexture, _BloomMipUp[maxBloomMip], sameInputOutputTex); + // We need to take into account how many valid mips the bloom pass produced. + int bloomMipCount = CalcBloomMipCount(m_Bloom, CalcBloomResolution(m_Bloom, in srcDesc)); + int maxBloomMip = Mathf.Clamp(bloomMipCount - 1, 0, m_Bloom.maxIterations.value / 2); + int useBloomMip = Mathf.Clamp(m_LensFlareScreenSpace.bloomMip.value, 0, maxBloomMip); + + TextureHandle bloomMipFlareSource = _BloomMipUp[useBloomMip]; + bool sameBloomInputOutputTex = useBloomMip == 0; + + // Bloom does only the prefilter into MipDown if there's only 1 iteration. + if(bloomMipCount == 1) + { + bloomMipFlareSource = _BloomMipDown[0]; + } + + bloomTexture = RenderLensFlareScreenSpace(renderGraph, cameraData.camera, srcDesc, bloomTexture, bloomMipFlareSource, sameBloomInputOutputTex); } UberPostSetupBloomPass(renderGraph, m_Materials.uber, srcDesc); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RenderingUtils.cs b/Packages/com.unity.render-pipelines.universal/Runtime/RenderingUtils.cs index 71104868619..f05edea0014 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/RenderingUtils.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/RenderingUtils.cs @@ -859,6 +859,41 @@ public static bool ReAllocateHandleIfNeeded( return false; } + /// + /// Re-allocate fixed-size RTHandle if it is not allocated or doesn't match the descriptor + /// + /// RTHandle to check (can be null) + /// TextureDesc for the RTHandle to match + /// Name of the RTHandle. + /// If an allocation was done. + public static bool ReAllocateHandleIfNeeded( + ref RTHandle handle, + TextureDesc descriptor, + string name) + { + descriptor.name = name; + descriptor.sizeMode = TextureSizeMode.Explicit; + + if (RTHandleNeedsReAlloc(handle, in descriptor, false)) + { + if (handle != null && handle.rt != null) + { + TextureDesc currentRTDesc = RTHandleResourcePool.CreateTextureDesc(handle.rt.descriptor, TextureSizeMode.Explicit, handle.rt.anisoLevel, handle.rt.mipMapBias, handle.rt.filterMode, handle.rt.wrapMode, handle.name); + AddStaleResourceToPoolOrRelease(currentRTDesc, handle); + } + + if (UniversalRenderPipeline.s_RTHandlePool.TryGetResource(descriptor, out handle)) + { + return true; + } + + var allocInfo = CreateRTHandleAllocInfo(descriptor, name); + handle = RTHandles.Alloc(descriptor.width, descriptor.height, allocInfo); + return true; + } + return false; + } + /// /// Re-allocate dynamically resized RTHandle if it is not allocated or doesn't match the descriptor /// @@ -1113,5 +1148,36 @@ internal static RTHandleAllocInfo CreateRTHandleAllocInfo(in RenderTextureDescri return allocInfo; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal static RTHandleAllocInfo CreateRTHandleAllocInfo(in TextureDesc descriptor, string name) + { + // NOTE: this calls default(RTHandleAllocInfo) not RTHandleAllocInfo(string = "") + RTHandleAllocInfo allocInfo = new RTHandleAllocInfo(); + allocInfo.slices = descriptor.slices; + allocInfo.format = descriptor.format; + allocInfo.filterMode = descriptor.filterMode; + allocInfo.wrapModeU = descriptor.wrapMode; + allocInfo.wrapModeV = descriptor.wrapMode; + allocInfo.wrapModeW = descriptor.wrapMode; + allocInfo.dimension = descriptor.dimension; + allocInfo.enableRandomWrite = descriptor.enableRandomWrite; + allocInfo.enableShadingRate = descriptor.enableShadingRate; + allocInfo.useMipMap = descriptor.useMipMap; + allocInfo.autoGenerateMips = descriptor.autoGenerateMips; + allocInfo.anisoLevel = descriptor.anisoLevel; + allocInfo.mipMapBias = descriptor.mipMapBias; + allocInfo.isShadowMap = descriptor.isShadowMap; + allocInfo.msaaSamples = (MSAASamples)descriptor.msaaSamples; + allocInfo.bindTextureMS = descriptor.bindTextureMS; + allocInfo.useDynamicScale = descriptor.useDynamicScale; + allocInfo.useDynamicScaleExplicit = descriptor.useDynamicScaleExplicit; + allocInfo.memoryless = descriptor.memoryless; + allocInfo.vrUsage = descriptor.vrUsage; + allocInfo.enableShadingRate = descriptor.enableShadingRate; + allocInfo.name = name; + + return allocInfo; + } } } diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs index dcc3eeab0a0..c0447ba4ed4 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs @@ -661,13 +661,11 @@ bool IsDepthPrimingEnabledCompatibilityMode(UniversalCameraData cameraData) bool depthPrimingRequested = (m_DepthPrimingRecommended && m_DepthPrimingMode == DepthPrimingMode.Auto) || m_DepthPrimingMode == DepthPrimingMode.Forced; bool isForwardRenderingMode = m_RenderingMode == RenderingMode.Forward || m_RenderingMode == RenderingMode.ForwardPlus; bool isFirstCameraToWriteDepth = cameraData.renderType == CameraRenderType.Base || cameraData.clearDepth; - // Enabled Depth priming when baking Reflection Probes causes artefacts (UUM-12397) - bool isNotReflectionCamera = cameraData.cameraType != CameraType.Reflection; // Depth is not rendered in a depth-only camera setup with depth priming (UUM-38158) bool isNotOffscreenDepthTexture = !IsOffscreenDepthTexture(cameraData); bool isNotMSAA = cameraData.cameraTargetDescriptor.msaaSamples == 1; - return depthPrimingRequested && isForwardRenderingMode && isFirstCameraToWriteDepth && isNotReflectionCamera && isNotOffscreenDepthTexture && isNotWebGL && isNotMSAA; + return depthPrimingRequested && isForwardRenderingMode && isFirstCameraToWriteDepth && isNotOffscreenDepthTexture && isNotWebGL && isNotMSAA; } static bool IsWebGL() @@ -1974,14 +1972,16 @@ bool RequiresIntermediateColorTexture(UniversalCameraData cameraData, in RenderP isCompatibleBackbufferTextureDimension = cameraData.xr.renderTargetDesc.dimension == cameraTargetDescriptor.dimension; } #endif + bool requiresOpaqueTexture = cameraData.requiresOpaqueTexture || renderPassInputs.requiresColorTexture; + bool postProcessEnabled = cameraData.postProcessEnabled && m_PostProcessPasses.isCreated; - bool requiresBlitForOffscreenCamera = postProcessEnabled || cameraData.requiresOpaqueTexture || requiresExplicitMsaaResolve || !cameraData.isDefaultViewport; + bool requiresBlitForOffscreenCamera = postProcessEnabled || requiresOpaqueTexture || requiresExplicitMsaaResolve || !cameraData.isDefaultViewport; + if (isOffscreenRender) return requiresBlitForOffscreenCamera; return requiresBlitForOffscreenCamera || isScaledRender || isScalableBufferManagerUsed || cameraData.isHdrEnabled || - !isCompatibleBackbufferTextureDimension || isCapturing || cameraData.requireSrgbConversion || - renderPassInputs.requiresColorTexture; + !isCompatibleBackbufferTextureDimension || isCapturing || cameraData.requireSrgbConversion; } // There is two ways to control the dynamic resolution in URP: diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRendererRenderGraph.cs b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRendererRenderGraph.cs index cf91fa38223..b01eba27c3c 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRendererRenderGraph.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRendererRenderGraph.cs @@ -1317,7 +1317,7 @@ private void OnAfterRendering(RenderGraph renderGraph, bool applyPostProcessing) (cameraData.IsTemporalAAEnabled() && cameraData.taaSettings.contrastAdaptiveSharpening > 0.0f)); bool hasCaptureActions = cameraData.captureActions != null && cameraData.resolveFinalTarget; - bool hasPassesAfterPostProcessing = activeRenderPassQueue.Find(x => x.renderPassEvent == RenderPassEvent.AfterRenderingPostProcessing) != null; + bool hasPassesAfterPostProcessing = activeRenderPassQueue.Find(x => x.renderPassEvent >= RenderPassEvent.AfterRenderingPostProcessing && x.renderPassEvent < RenderPassEvent.AfterRendering) != null; bool resolvePostProcessingToCameraTarget = !hasCaptureActions && !hasPassesAfterPostProcessing && !applyFinalPostProcessing; bool needsColorEncoding = DebugHandler == null || !DebugHandler.HDRDebugViewIsActive(cameraData.resolveFinalTarget); @@ -1588,6 +1588,8 @@ static bool IsDepthPrimingEnabledRenderGraph(UniversalCameraData cameraData, in // We only do one depth prepass per camera. If the texture requires a prepass, and priming is on, then we do priming and a copy afterwards to the cameraDepthTexture. // 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)) return false; @@ -1610,12 +1612,10 @@ static bool IsDepthPrimingEnabledRenderGraph(UniversalCameraData cameraData, in } bool isFirstCameraToWriteDepth = cameraData.renderType == CameraRenderType.Base || cameraData.clearDepth; - // Enabled Depth priming when baking Reflection Probes causes artefacts (UUM-12397) - bool isNotReflectionCamera = cameraData.cameraType != CameraType.Reflection; // Depth is not rendered in a depth-only camera setup with depth priming (UUM-38158) bool isNotOffscreenDepthTexture = !IsOffscreenDepthTexture(cameraData); - return depthPrimingRequested && !usesDeferredLighting && isFirstCameraToWriteDepth && isNotReflectionCamera && isNotOffscreenDepthTexture && isNotWebGL && isNotMSAA; + return depthPrimingRequested && !usesDeferredLighting && isFirstCameraToWriteDepth && isNotOffscreenDepthTexture && isNotWebGL && isNotMSAA; } internal void SetRenderingLayersGlobalTextures(RenderGraph renderGraph) diff --git a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/CameraStacking/SplitScreen/SplitScreen.unity b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/CameraStacking/SplitScreen/SplitScreen.unity index a5249b5a9fe..1b44e8ba211 100644 --- a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/CameraStacking/SplitScreen/SplitScreen.unity +++ b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/CameraStacking/SplitScreen/SplitScreen.unity @@ -38,12 +38,12 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 705507994} - m_IndirectSpecularColor: {r: 0, g: 0, b: 0, 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: 0d3679324a6e04c12a52d1802e035b98, - type: 2} - m_LightingSettings: {fileID: 4890085278179872738, guid: 18327bac2ae6340be93d260876955295, - type: 2} + m_LightingDataAsset: {fileID: 112000000, guid: 0d3679324a6e04c12a52d1802e035b98, type: 2} + m_LightingSettings: {fileID: 4890085278179872738, guid: 18327bac2ae6340be93d260876955295, type: 2} --- !u!196 &4 NavMeshSettings: serializedVersion: 2 @@ -278,7 +276,7 @@ Canvas: m_OverrideSorting: 0 m_OverridePixelPerfect: 0 m_SortingBucketNormalizedSize: 0 - m_VertexColorAlwaysGammaSpace: 0 + m_VertexColorAlwaysGammaSpace: 1 m_AdditionalShaderChannelsFlag: 1 m_UpdateRectTransformForStandalone: 0 m_SortingLayerID: 0 @@ -381,7 +379,7 @@ Canvas: m_OverrideSorting: 0 m_OverridePixelPerfect: 0 m_SortingBucketNormalizedSize: 0 - m_VertexColorAlwaysGammaSpace: 0 + m_VertexColorAlwaysGammaSpace: 1 m_AdditionalShaderChannelsFlag: 25 m_UpdateRectTransformForStandalone: 0 m_SortingLayerID: 0 @@ -494,123 +492,99 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 131481531} 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: SplitScreen 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: 0 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 example shows how to create a split screen camera setup each with their own camera stack. \nIt also shows how to apply Post Processing on World @@ -623,8 +597,7 @@ PrefabInstance: m_SourcePrefab: {fileID: 100100000, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} --- !u!224 &262956636 stripped RectTransform: - m_CorrespondingSourceObject: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + m_CorrespondingSourceObject: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} m_PrefabInstance: {fileID: 262956635} m_PrefabAsset: {fileID: 0} --- !u!1 &400686062 @@ -703,7 +676,7 @@ Canvas: m_OverrideSorting: 0 m_OverridePixelPerfect: 0 m_SortingBucketNormalizedSize: 0 - m_VertexColorAlwaysGammaSpace: 0 + m_VertexColorAlwaysGammaSpace: 1 m_AdditionalShaderChannelsFlag: 0 m_UpdateRectTransformForStandalone: 0 m_SortingLayerID: 0 @@ -783,14 +756,14 @@ MonoBehaviour: m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0} m_RequiresDepthTexture: 0 m_RequiresColorTexture: 0 - m_Version: 2 m_TaaSettings: - quality: 3 - frameInfluence: 0.1 - jitterScale: 1 - mipBias: 0 - varianceClampScale: 0.9 - contrastAdaptiveSharpening: 0 + m_Quality: 3 + m_FrameInfluence: 0.1 + m_JitterScale: 1 + m_MipBias: 0 + m_VarianceClampScale: 0.9 + m_ContrastAdaptiveSharpening: 0 + m_Version: 2 --- !u!20 &470662021 Camera: m_ObjectHideFlags: 0 @@ -927,14 +900,14 @@ MonoBehaviour: m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0} m_RequiresDepthTexture: 0 m_RequiresColorTexture: 0 - m_Version: 2 m_TaaSettings: - quality: 3 - frameInfluence: 0.1 - jitterScale: 1 - mipBias: 0 - varianceClampScale: 0.9 - contrastAdaptiveSharpening: 0 + m_Quality: 3 + m_FrameInfluence: 0.1 + m_JitterScale: 1 + m_MipBias: 0 + m_VarianceClampScale: 0.9 + m_ContrastAdaptiveSharpening: 0 + m_Version: 2 --- !u!20 &482165991 Camera: m_ObjectHideFlags: 0 @@ -1207,14 +1180,14 @@ Light: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 705507993} m_Enabled: 1 - serializedVersion: 11 + serializedVersion: 12 m_Type: 1 m_Color: {r: 1, g: 1, b: 1, a: 1} m_Intensity: 1 m_Range: 10 m_SpotAngle: 30 m_InnerSpotAngle: 21.802082 - m_CookieSize: 10 + m_CookieSize2D: {x: 10, y: 10} m_Shadows: m_Type: 2 m_Resolution: -1 @@ -1258,8 +1231,12 @@ Light: m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} m_UseBoundingSphereOverride: 0 m_UseViewFrustumForShadowCasterCull: 1 + m_ForceVisible: 0 m_ShadowRadius: 0 m_ShadowAngle: 0 + m_LightUnit: 1 + m_LuxAtDistance: 1 + m_EnableSpotReflector: 1 --- !u!4 &705507995 Transform: m_ObjectHideFlags: 0 @@ -1287,17 +1264,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 &1060604892 GameObject: m_ObjectHideFlags: 0 @@ -1410,7 +1393,7 @@ Canvas: m_OverrideSorting: 0 m_OverridePixelPerfect: 0 m_SortingBucketNormalizedSize: 0 - m_VertexColorAlwaysGammaSpace: 0 + m_VertexColorAlwaysGammaSpace: 1 m_AdditionalShaderChannelsFlag: 25 m_UpdateRectTransformForStandalone: 0 m_SortingLayerID: 0 @@ -1495,6 +1478,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: @@ -1516,6 +1502,7 @@ MeshRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 @@ -1555,7 +1542,6 @@ GameObject: - component: {fileID: 1158032496} - component: {fileID: 1158032495} - component: {fileID: 1158032494} - - component: {fileID: 1158032493} m_Layer: 0 m_Name: Cylinder m_TagString: Untagged @@ -1563,21 +1549,6 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!114 &1158032493 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1158032492} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 8725944bdac9042b9b1442ba38a31070, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Space: 0 - m_Axis: {x: 0, y: 0, z: 0} - m_AngularVelocity: 0 --- !u!136 &1158032494 CapsuleCollider: m_ObjectHideFlags: 0 @@ -1620,6 +1591,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: @@ -1641,6 +1615,7 @@ MeshRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 @@ -1744,7 +1719,7 @@ Canvas: m_OverrideSorting: 0 m_OverridePixelPerfect: 0 m_SortingBucketNormalizedSize: 0 - m_VertexColorAlwaysGammaSpace: 0 + m_VertexColorAlwaysGammaSpace: 1 m_AdditionalShaderChannelsFlag: 25 m_UpdateRectTransformForStandalone: 0 m_SortingLayerID: 0 @@ -1905,14 +1880,14 @@ MonoBehaviour: m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0} m_RequiresDepthTexture: 0 m_RequiresColorTexture: 0 - m_Version: 2 m_TaaSettings: - quality: 3 - frameInfluence: 0.1 - jitterScale: 1 - mipBias: 0 - varianceClampScale: 0.9 - contrastAdaptiveSharpening: 0 + m_Quality: 3 + m_FrameInfluence: 0.1 + m_JitterScale: 1 + m_MipBias: 0 + m_VarianceClampScale: 0.9 + m_ContrastAdaptiveSharpening: 0 + m_Version: 2 --- !u!20 &1410108895 Camera: m_ObjectHideFlags: 0 @@ -1922,7 +1897,7 @@ Camera: m_GameObject: {fileID: 1410108892} m_Enabled: 1 serializedVersion: 2 - m_ClearFlags: 1 + m_ClearFlags: 4 m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} m_projectionMatrixMode: 1 m_GateFitMode: 2 @@ -2033,14 +2008,14 @@ MonoBehaviour: m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0} m_RequiresDepthTexture: 0 m_RequiresColorTexture: 0 - m_Version: 2 m_TaaSettings: - quality: 3 - frameInfluence: 0.1 - jitterScale: 1 - mipBias: 0 - varianceClampScale: 0.9 - contrastAdaptiveSharpening: 0 + m_Quality: 3 + m_FrameInfluence: 0.1 + m_JitterScale: 1 + m_MipBias: 0 + m_VarianceClampScale: 0.9 + m_ContrastAdaptiveSharpening: 0 + m_Version: 2 --- !u!20 &1655053638 Camera: m_ObjectHideFlags: 0 @@ -2115,108 +2090,87 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 131481531} 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} @@ -2227,8 +2181,7 @@ PrefabInstance: m_SourcePrefab: {fileID: 100100000, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} --- !u!224 &1661637574 stripped RectTransform: - m_CorrespondingSourceObject: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + m_CorrespondingSourceObject: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} m_PrefabInstance: {fileID: 1661637573} m_PrefabAsset: {fileID: 0} --- !u!1 &1678942889 @@ -2286,14 +2239,14 @@ MonoBehaviour: m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0} m_RequiresDepthTexture: 0 m_RequiresColorTexture: 0 - m_Version: 2 m_TaaSettings: - quality: 3 - frameInfluence: 0.1 - jitterScale: 1 - mipBias: 0 - varianceClampScale: 0.9 - contrastAdaptiveSharpening: 0 + m_Quality: 3 + m_FrameInfluence: 0.1 + m_JitterScale: 1 + m_MipBias: 0 + m_VarianceClampScale: 0.9 + m_ContrastAdaptiveSharpening: 0 + m_Version: 2 --- !u!20 &1678942892 Camera: m_ObjectHideFlags: 0 @@ -2386,14 +2339,14 @@ Light: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1862309426} m_Enabled: 1 - serializedVersion: 11 + serializedVersion: 12 m_Type: 1 m_Color: {r: 1, g: 1, b: 1, a: 1} m_Intensity: 0.7 m_Range: 10 m_SpotAngle: 30 m_InnerSpotAngle: 21.802082 - m_CookieSize: 10 + m_CookieSize2D: {x: 10, y: 10} m_Shadows: m_Type: 0 m_Resolution: -1 @@ -2437,8 +2390,12 @@ Light: m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} m_UseBoundingSphereOverride: 0 m_UseViewFrustumForShadowCasterCull: 1 + m_ForceVisible: 0 m_ShadowRadius: 0 m_ShadowAngle: 0 + m_LightUnit: 1 + m_LuxAtDistance: 1 + m_EnableSpotReflector: 1 --- !u!4 &1862309428 Transform: m_ObjectHideFlags: 0 @@ -2466,17 +2423,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 &1913427150 GameObject: m_ObjectHideFlags: 0 @@ -2537,6 +2500,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: @@ -2558,6 +2524,7 @@ MeshRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 diff --git a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/RendererFeatures/OcclusionEffect/OcclusionEffect.unity b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/RendererFeatures/OcclusionEffect/OcclusionEffect.unity index b066469c7c0..5c5292420d7 100644 --- a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/RendererFeatures/OcclusionEffect/OcclusionEffect.unity +++ b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/RendererFeatures/OcclusionEffect/OcclusionEffect.unity @@ -38,12 +38,12 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 705507994} - m_IndirectSpecularColor: {r: 0.18028414, g: 0.22571535, b: 0.3069227, 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: f2231d3127f464d509bddaf4c16b7a75, - type: 2} - m_LightingSettings: {fileID: 4890085278179872738, guid: 52ac4f2bbb9b644ac87c5f26bb06cb0d, - type: 2} + m_LightingDataAsset: {fileID: 112000000, guid: f2231d3127f464d509bddaf4c16b7a75, type: 2} + m_LightingSettings: {fileID: 4890085278179872738, guid: 52ac4f2bbb9b644ac87c5f26bb06cb0d, type: 2} --- !u!196 &4 NavMeshSettings: serializedVersion: 2 @@ -197,7 +195,7 @@ Canvas: m_OverrideSorting: 0 m_OverridePixelPerfect: 0 m_SortingBucketNormalizedSize: 0 - m_VertexColorAlwaysGammaSpace: 0 + m_VertexColorAlwaysGammaSpace: 1 m_AdditionalShaderChannelsFlag: 1 m_UpdateRectTransformForStandalone: 0 m_SortingLayerID: 0 @@ -232,123 +230,99 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 131481531} 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: Occlusion Effect 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: 1 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 the "Render Objects" renderer feature can be used to draw occluded geometry. The effect is achieved without writing any code. @@ -361,8 +335,7 @@ PrefabInstance: m_SourcePrefab: {fileID: 100100000, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} --- !u!224 &560415169 stripped RectTransform: - m_CorrespondingSourceObject: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + m_CorrespondingSourceObject: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} m_PrefabInstance: {fileID: 560415168} m_PrefabAsset: {fileID: 0} --- !u!1 &567206875 @@ -426,14 +399,14 @@ Light: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 705507993} m_Enabled: 1 - serializedVersion: 11 + serializedVersion: 12 m_Type: 1 m_Color: {r: 1, g: 1, b: 1, a: 1} m_Intensity: 1 m_Range: 10 m_SpotAngle: 30 m_InnerSpotAngle: 21.802082 - m_CookieSize: 10 + m_CookieSize2D: {x: 10, y: 10} m_Shadows: m_Type: 2 m_Resolution: -1 @@ -477,8 +450,12 @@ Light: m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} m_UseBoundingSphereOverride: 0 m_UseViewFrustumForShadowCasterCull: 1 + m_ForceVisible: 0 m_ShadowRadius: 0 m_ShadowAngle: 0 + m_LightUnit: 1 + m_LuxAtDistance: 1 + m_EnableSpotReflector: 1 --- !u!4 &705507995 Transform: m_ObjectHideFlags: 0 @@ -506,17 +483,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 &963194225 GameObject: m_ObjectHideFlags: 0 @@ -646,14 +629,14 @@ MonoBehaviour: m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0} m_RequiresDepthTexture: 0 m_RequiresColorTexture: 0 - m_Version: 2 m_TaaSettings: - quality: 3 - frameInfluence: 0.1 - jitterScale: 1 - mipBias: 0 - varianceClampScale: 0.9 - contrastAdaptiveSharpening: 0 + m_Quality: 3 + m_FrameInfluence: 0.1 + m_JitterScale: 1 + m_MipBias: 0 + m_VarianceClampScale: 0.9 + m_ContrastAdaptiveSharpening: 0 + m_Version: 2 --- !u!1 &1243279511 GameObject: m_ObjectHideFlags: 0 @@ -666,8 +649,6 @@ GameObject: - component: {fileID: 1243279514} - component: {fileID: 1243279513} - component: {fileID: 1243279512} - - component: {fileID: 1243279516} - - component: {fileID: 1243279517} - component: {fileID: 1243279518} m_Layer: 8 m_Name: MovingCube @@ -716,6 +697,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: @@ -737,6 +721,7 @@ MeshRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 @@ -764,35 +749,6 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 45, y: 45, z: 45} ---- !u!114 &1243279516 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1243279511} - m_Enabled: 0 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 82cb6f9db52a84a1d889793764803890, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Amplitude: {x: 5, y: 0, z: 0} - m_Period: 7 ---- !u!114 &1243279517 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1243279511} - m_Enabled: 0 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 8725944bdac9042b9b1442ba38a31070, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Space: 0 - m_Axis: {x: 0, y: 0, z: 0} - m_AngularVelocity: 0 --- !u!95 &1243279518 Animator: serializedVersion: 7 @@ -825,7 +781,7 @@ GameObject: m_Component: - component: {fileID: 1574701477} - component: {fileID: 1574701476} - - component: {fileID: 1574701475} + - component: {fileID: 1574701478} m_Layer: 0 m_Name: EventSystem m_TagString: Untagged @@ -833,26 +789,6 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!114 &1574701475 -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: 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 &1574701476 MonoBehaviour: m_ObjectHideFlags: 0 @@ -883,6 +819,37 @@ Transform: 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 &1637038248 GameObject: m_ObjectHideFlags: 0 @@ -942,6 +909,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: @@ -963,6 +933,7 @@ MeshRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 @@ -1049,6 +1020,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: @@ -1070,6 +1044,7 @@ MeshRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 @@ -1156,6 +1131,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: @@ -1177,6 +1155,7 @@ MeshRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 @@ -1263,6 +1242,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: @@ -1284,6 +1266,7 @@ MeshRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 @@ -1319,108 +1302,87 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 131481531} 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} @@ -1431,8 +1393,7 @@ PrefabInstance: m_SourcePrefab: {fileID: 100100000, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} --- !u!224 &1813610164 stripped RectTransform: - m_CorrespondingSourceObject: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + m_CorrespondingSourceObject: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} m_PrefabInstance: {fileID: 1813610163} m_PrefabAsset: {fileID: 0} --- !u!1 &1862309426 @@ -1461,14 +1422,14 @@ Light: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1862309426} m_Enabled: 1 - serializedVersion: 11 + serializedVersion: 12 m_Type: 1 m_Color: {r: 1, g: 1, b: 1, a: 1} m_Intensity: 0.7 m_Range: 10 m_SpotAngle: 30 m_InnerSpotAngle: 21.802082 - m_CookieSize: 10 + m_CookieSize2D: {x: 10, y: 10} m_Shadows: m_Type: 0 m_Resolution: -1 @@ -1512,8 +1473,12 @@ Light: m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} m_UseBoundingSphereOverride: 0 m_UseViewFrustumForShadowCasterCull: 1 + m_ForceVisible: 0 m_ShadowRadius: 0 m_ShadowAngle: 0 + m_LightUnit: 1 + m_LuxAtDistance: 1 + m_EnableSpotReflector: 1 --- !u!4 &1862309428 Transform: m_ObjectHideFlags: 0 @@ -1541,17 +1506,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 &1913427150 GameObject: m_ObjectHideFlags: 0 @@ -1612,6 +1583,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: @@ -1633,6 +1607,7 @@ MeshRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 @@ -1755,6 +1730,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: @@ -1776,6 +1754,7 @@ MeshRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 diff --git a/Packages/com.unity.render-pipelines.universal/ShaderLibrary/VisualEffectVertex.hlsl b/Packages/com.unity.render-pipelines.universal/ShaderLibrary/VisualEffectVertex.hlsl index c76235e6d07..436fe1daac4 100644 --- a/Packages/com.unity.render-pipelines.universal/ShaderLibrary/VisualEffectVertex.hlsl +++ b/Packages/com.unity.render-pipelines.universal/ShaderLibrary/VisualEffectVertex.hlsl @@ -7,7 +7,7 @@ void VertVFX( Attributes input #endif -#if (SHADERPASS == SHADERPASS_MOTION_VECTORS) +#if (SHADERPASS == SHADERPASS_MOTION_VECTORS || SHADERPASS == SHADERPASS_XR_MOTION_VECTORS) , out PackedMotionVectorPassVaryings packedMvOutput #endif , out PackedVaryings packedOutput @@ -20,7 +20,7 @@ void VertVFX( input.instanceID = instanceID; #endif -#if (SHADERPASS != SHADERPASS_MOTION_VECTORS) +#if (SHADERPASS != SHADERPASS_MOTION_VECTORS || SHADERPASS == SHADERPASS_XR_MOTION_VECTORS) packedOutput = vert(input); #else MotionVectorPassAttributes dummy = (MotionVectorPassAttributes)0; diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/2D/Light2D.shader b/Packages/com.unity.render-pipelines.universal/Shaders/2D/Light2D.shader index da01448ca75..e2dcc198273 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/2D/Light2D.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/2D/Light2D.shader @@ -25,7 +25,6 @@ Shader "Hidden/Light2D" #pragma multi_compile_local USE_ADDITIVE_BLENDING __ #pragma multi_compile_local USE_VOLUMETRIC __ #pragma multi_compile_local USE_POINT_LIGHT_COOKIES __ - #pragma multi_compile_local USE_SPRITE_LIGHT __ #pragma multi_compile_local LIGHT_QUALITY_FAST __ #include_with_pragmas "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/ShapeLightShared.hlsl" @@ -51,10 +50,8 @@ Shader "Hidden/Light2D" LIGHT_OFFSET(TEXCOORD5) }; -#if USE_SPRITE_LIGHT TEXTURE2D(_CookieTex); // This can either be a sprite texture uv or a falloff texture SAMPLER(sampler_CookieTex); -#endif TEXTURE2D(_FalloffLookup); SAMPLER(sampler_FalloffLookup); @@ -153,27 +150,25 @@ Shader "Hidden/Light2D" FragmentOutput frag_shape(Varyings i, PerLight2D light) { half4 lightColor = i.color; - -#if USE_SPRITE_LIGHT - half4 cookie = SAMPLE_TEXTURE2D(_CookieTex, sampler_CookieTex, i.uv); - - #if USE_ADDITIVE_BLENDING - lightColor *= cookie * cookie.a; - #else - lightColor *= cookie; - #endif - + if (_L2D_LIGHT_TYPE == 2) + { + half4 cookie = SAMPLE_TEXTURE2D(_CookieTex, sampler_CookieTex, i.uv); +#if USE_ADDITIVE_BLENDING + lightColor *= cookie * cookie.a; #else - - #if USE_ADDITIVE_BLENDING - lightColor *= SAMPLE_TEXTURE2D(_FalloffLookup, sampler_FalloffLookup, i.uv).r; - #elif USE_VOLUMETRIC - lightColor.a = i.color.a * SAMPLE_TEXTURE2D(_FalloffLookup, sampler_FalloffLookup, i.uv).r; - #else - lightColor.a = SAMPLE_TEXTURE2D(_FalloffLookup, sampler_FalloffLookup, i.uv).r; - #endif - -#endif // USE_SPRITE_LIGHT + lightColor *= cookie; +#endif + } + else + { +#if USE_ADDITIVE_BLENDING + lightColor *= SAMPLE_TEXTURE2D(_FalloffLookup, sampler_FalloffLookup, i.uv).r; +#elif USE_VOLUMETRIC + lightColor.a = i.color.a * SAMPLE_TEXTURE2D(_FalloffLookup, sampler_FalloffLookup, i.uv).r; +#else + lightColor.a = SAMPLE_TEXTURE2D(_FalloffLookup, sampler_FalloffLookup, i.uv).r; +#endif + } #if !USE_VOLUMETRIC APPLY_NORMALS_LIGHTING(i, lightColor, _L2D_POSITION.xyz, _L2D_POSITION.w); diff --git a/Packages/com.unity.render-pipelines.universal/Tests/Editor/EditorTests.cs b/Packages/com.unity.render-pipelines.universal/Tests/Editor/EditorTests.cs index f64393291de..fd55a122503 100644 --- a/Packages/com.unity.render-pipelines.universal/Tests/Editor/EditorTests.cs +++ b/Packages/com.unity.render-pipelines.universal/Tests/Editor/EditorTests.cs @@ -2,13 +2,10 @@ using UnityEditor; using UnityEngine; using UnityEngine.Rendering; -using UnityEngine.Profiling; using UnityEngine.Rendering.Universal; using UnityEditor.Rendering.Universal.Internal; using UnityEngine.Experimental.Rendering; -using UnityEngine.Experimental.Rendering.Universal; -using UnityEngine.TestTools; -using System.Xml.Linq; +using UnityEngine.Rendering.RenderGraphModule; class EditorTests { @@ -163,6 +160,78 @@ public void UseReAllocateIfNeededWithoutTextureLeak() Assert.That(posttestTextures, Is.EquivalentTo(pretestTextures), "A texture leak is detected when using RenderingUtils.ReAllocateIfNeeded."); } + [Test] + public void UseReAllocateIfNeededWithoutTextureLeakTextureDesc() + { + Object[] pretestTextures = Resources.FindObjectsOfTypeAll(typeof(Texture)); + RTHandle myHandle = default(RTHandle); + + // URP is not initlized in test framework, init RTHandlePool here which is required for this test. + if (UniversalRenderPipeline.s_RTHandlePool == null) + { + UniversalRenderPipeline.s_RTHandlePool = new RTHandleResourcePool(); + } + + // Realloc RTHandle 100 times with different resolution. + for (int i = 0; i < 100; i++) + { + var desc = new TextureDesc(1, 1 + i); + desc.format = GraphicsFormat.R8G8B8A8_UNorm; + desc.filterMode = FilterMode.Point; + desc.wrapMode = TextureWrapMode.Clamp; + RenderingUtils.ReAllocateHandleIfNeeded(ref myHandle, desc, "TestTexture"); + } + UniversalRenderPipeline.s_RTHandlePool.Cleanup(); + RTHandles.Release(myHandle); + + Object[] posttestTextures = Resources.FindObjectsOfTypeAll(typeof(Texture)); + + Assert.That(posttestTextures, Is.EquivalentTo(pretestTextures), "A texture leak is detected when using RenderingUtils.ReAllocateIfNeeded."); + } + + [Test] + public void UseReAllocateIfNeededCorrect() + { + Object[] pretestTextures = Resources.FindObjectsOfTypeAll(typeof(Texture)); + RTHandle myHandle = default(RTHandle); + + // URP is not initlized in test framework, init RTHandlePool here which is required for this test. + if (UniversalRenderPipeline.s_RTHandlePool == null) + { + UniversalRenderPipeline.s_RTHandlePool = new RTHandleResourcePool(); + } + + var desc = new TextureDesc(128, 128); + desc.format = GraphicsFormat.R8G8B8A8_UNorm; + desc.filterMode = FilterMode.Point; + desc.wrapMode = TextureWrapMode.Clamp; + + RenderingUtils.ReAllocateHandleIfNeeded(ref myHandle, desc, "TestTexture"); + + Assert.That(IsEqualDesc(in desc, myHandle), "RenderingUtils.ReAllocateIfNeeded alloced RTHandle with different properties than requested."); + + desc.width = desc.height = 64; + desc.format = GraphicsFormat.R32_SFloat; + desc.filterMode = FilterMode.Bilinear; + desc.wrapMode = TextureWrapMode.Repeat; + + RenderingUtils.ReAllocateHandleIfNeeded(ref myHandle, desc, "TestTexture"); + + Assert.That(IsEqualDesc(in desc, myHandle), "RenderingUtils.ReAllocateIfNeeded alloced RTHandle with different properties than requested."); + + UniversalRenderPipeline.s_RTHandlePool.Cleanup(); + RTHandles.Release(myHandle); + } + + bool IsEqualDesc(in TextureDesc desc, RTHandle rt) + { + return rt.rt.width == desc.width + && rt.rt.height == desc.height + && rt.rt.graphicsFormat == desc.format + && rt.rt.wrapMode == desc.wrapMode + && rt.rt.filterMode == desc.filterMode; + } + [TestCase(ShaderPathID.Lit)] [TestCase(ShaderPathID.SimpleLit)] [TestCase(ShaderPathID.Unlit)] diff --git a/Packages/com.unity.shadergraph/Documentation~/Getting-Started.md b/Packages/com.unity.shadergraph/Documentation~/Getting-Started.md index 96b65f6dce8..c6cc4304d18 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Getting-Started.md +++ b/Packages/com.unity.shadergraph/Documentation~/Getting-Started.md @@ -1,21 +1,8 @@ -# Getting started with Shader Graph +# Get started with Shader Graph -Use Shader Graph with either of the Scriptable Render Pipelines (SRPs) available in Unity version 2018.1 and later: +Explore the Shader Graph user interface and general workflows to start creating your own shader graphs. -- The [High Definition Render Pipeline (HDRP)](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest) -- The [Universal Render Pipeline (URP)](https://docs.unity3d.com/Manual/urp/urp-introduction.html) - -As of Unity version 2021.2, you can also use Shader Graph with the [Built-In Render Pipeline](https://docs.unity3d.com/Documentation/Manual/built-in-render-pipeline.html). - -> [!NOTE] -> Shader Graph support for the Built-In Render Pipeline is for compatibility purposes only. Shader Graph doesn't receive updates for Built-In Render Pipeline support, aside from bug fixes for existing features. It's recommended to use Shader Graph with the Scriptable Render Pipelines. - -## Installation - -When you install HDRP or URP into your project, Unity also installs the Shader Graph package automatically. You can manually install Shader Graph for use with the Built-In Render Pipeline on Unity version 2021.2 and later with the Package Manager. For more information on how to install a package, see [Adding and removing packages](https://docs.unity3d.com/Manual/upm-ui-actions.html) in the Unity User Manual. - -For more information about how to set up a Scriptable Render Pipeline, see [Getting started with HDRP](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@17.0/manual/getting-started-in-hdrp.html) or [Getting started with URP](https://docs.unity3d.com/Manual/urp/InstallingAndConfiguringURP). - -## What's new - -For information about the latest updates and improvements to Shader Graph, refer to [What's new in Unity](https://docs.unity3d.com/Manual/WhatsNew.html). +| 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. | diff --git a/Packages/com.unity.shadergraph/Documentation~/Keywords-reference.md b/Packages/com.unity.shadergraph/Documentation~/Keywords-reference.md index 98dc40b4c9c..c7577407f91 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Keywords-reference.md +++ b/Packages/com.unity.shadergraph/Documentation~/Keywords-reference.md @@ -9,7 +9,7 @@ Parameters that all keyword types have in common. | **Name** | **Description** | | :--- | :--- | | **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.

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 **Reference** contains any characters that HLSL does not support, Unity replaces those characters with underscores.
  • You can revert to the default **Reference**: right-click on the **Reference** field label, and select **Reset Reference**.
| +| **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**.
| | **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 94e50de03fb..9b83dfdf03a 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Property-Types.md +++ b/Packages/com.unity.shadergraph/Documentation~/Property-Types.md @@ -13,7 +13,9 @@ 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.

If you overwrite this parameter, be aware of the following:
  • If **Reference** doesn't begin with an underscore, Unity automatically adds one.
  • If **Reference** contains any characters which are unsupported in HLSL, Unity removes them.
  • You can revert to the default **Reference**: right-click on the **Reference** field label, and select **Reset Reference**.
| +| **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. | @@ -185,3 +187,27 @@ Defines a **Boolean** value. Displays a **ToggleUI** field in the material inspe | Field | Type | Description | |:-------------|:------|:------------| | Default | Boolean | The default value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html). | + +## Matrix 2x2 + +Defines a Matrix 2. Matrices do not display in the **Inspector** window of the material. + +| Field | Type | +|:--------|:---------| +| Default | Matrix 2 | + +## Matrix 3x3 + +Defines a Matrix 3 value. Can't be displayed in the material inspector. + +| Field | Type | +|:--------|:---------| +| Default | Matrix 3 | + +## Matrix 4x4 + +Defines a Matrix 4 value. Can't be displayed in the material inspector. + +| Field | Type | +|:--------|:---------| +| Default | Matrix 4 | diff --git a/Packages/com.unity.shadergraph/Documentation~/TableOfContents.md b/Packages/com.unity.shadergraph/Documentation~/TableOfContents.md index 8a72fca1afc..a12da6d2894 100644 --- a/Packages/com.unity.shadergraph/Documentation~/TableOfContents.md +++ b/Packages/com.unity.shadergraph/Documentation~/TableOfContents.md @@ -1,7 +1,12 @@ * [About Shader Graph](index.md) -* [Getting started with Shader Graph](Getting-Started.md) +* [What's new in Shader Graph](whats-new.md) +* [Install and upgrade](install-and-upgrade.md) + * [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) +* [Shader Graph UI reference](ui-reference.md) * [Shader Graph Window](Shader-Graph-Window.md) * [Blackboard](Blackboard.md) * [Main Preview](Main-Preview.md) @@ -9,30 +14,27 @@ * [Create Node Menu](Create-Node-Menu.md) * [Graph Settings Tab](Graph-Settings-Tab.md) * [Master Stack](Master-Stack.md) - * [Sticky Notes](Sticky-Notes.md) - * [Sub Graph](Sub-graph.md) - * [Color Modes](Color-Modes.md) - * [Precision Modes](Precision-Modes.md) - * [Preview Mode Control](Preview-Mode-Control.md) - * [Custom Function Node](Custom-Function-Node.md) - * [Custom Render Textures](Custom-Render-Texture.md) - * [Accessing](Custom-Render-Texture-Accessing.md) - * [Example](Custom-Render-Texture-Example.md) * [Shader Graph Preferences](Shader-Graph-Preferences.md) * [Shader Graph Project Settings](Shader-Graph-Project-Settings.md) * [Shader Graph Keyboard Shortcuts](Keyboard-shortcuts.md) - * [Material Variants](materialvariant-SG.md) -* Upgrade Guides - * [Upgrade to Shader Graph 10.0.x](Upgrade-Guide-10-0-x.md) -* Inside Shader Graph +* [Inside Shader Graph](inside-shader-graph.md) * [Shader Graph Asset](Shader-Graph-Asset.md) * [Graph Target](Graph-Target.md) - * [Sub Graph Asset](Sub-graph-Asset.md) - * [SpeedTree 8 Sub Graph Assets](SpeedTree8-SubGraphAssets.md) * [Node](Node.md) * [Port](Port.md) * [Custom Port Menu](Custom-Port-Menu.md) * [Edge](Edge.md) + * [Sub Graph](Sub-graph.md) + * [Sub Graph Asset](Sub-graph-Asset.md) + * [SpeedTree 8 Sub Graph Assets](SpeedTree8-SubGraphAssets.md) + * [Sticky Notes](Sticky-Notes.md) + * [Color Modes](Color-Modes.md) + * [Precision Modes](Precision-Modes.md) + * [Preview Mode Control](Preview-Mode-Control.md) + * [Custom Render Textures](Custom-Render-Texture.md) + * [Accessing](Custom-Render-Texture-Accessing.md) + * [Example](Custom-Render-Texture-Example.md) + * [Material Variants](materialvariant-SG.md) * [Property Types](Property-Types.md) * [Keywords](Keywords.md) * [Introduction to keywords](Keywords-concepts.md) diff --git a/Packages/com.unity.shadergraph/Documentation~/Transform-Node.md b/Packages/com.unity.shadergraph/Documentation~/Transform-Node.md index 98e7e15a67d..bed7279fbed 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Transform-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Transform-Node.md @@ -75,7 +75,7 @@ float3 _Transform_Out = GetAbsolutePositionWS(In); **World > Screen** ``` -float4 hclipPosition = TransformWorldToHClipDir(In); +float4 hclipPosition = TransformWorldToHClip(In); float3 screenPos = hclipPosition.xyz / hclipPosition.w; float3 _Transform_Out = float3(screenPos.xy * 0.5 + 0.5, screenPos.z); ``` diff --git a/Packages/com.unity.shadergraph/Documentation~/Upgrade-Guide-10-0-x.md b/Packages/com.unity.shadergraph/Documentation~/Upgrade-Guide-10-0-x.md index 6a8dd75313a..279ad68de72 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Upgrade-Guide-10-0-x.md +++ b/Packages/com.unity.shadergraph/Documentation~/Upgrade-Guide-10-0-x.md @@ -1,5 +1,7 @@ # Upgrade to version 10.0.x of Shader Graph +Upgrade your project to make it compatible with Shader Graph 10.0 or later. + ## Renamed Vector 1 property and Float precision Shader Graph has renamed the **Vector 1** property as **Float** in both the Vector 1 node and the exposed parameter list. The **Float** precision was also renamed as **Single**. Behavior is exactly the same, and only the names have changed. diff --git a/Packages/com.unity.shadergraph/Documentation~/inside-shader-graph.md b/Packages/com.unity.shadergraph/Documentation~/inside-shader-graph.md new file mode 100644 index 00000000000..97f9d90b388 --- /dev/null +++ b/Packages/com.unity.shadergraph/Documentation~/inside-shader-graph.md @@ -0,0 +1,24 @@ +# Inside Shader Graph + +Learn about all concepts and features that make Shader Graph. + +| Topic | Description | +| :--- | :--- | +| [Shader Graph Asset](Shader-Graph-Asset.md) | Learn about the asset type that contains any shader graph you create. | +| [Graph Target](Graph-Target.md) | Determine the end point compatibility of a shader you generate with Shader Graph. | +| [Node](Node.md) | Create nodes in your shader graph and learn about node interconnection details with ports and edges. | +| [Sub Graph](Sub-graph.md) | Create sub graphs that you can reference from inside other graphs. | +| [Sub Graph Asset](Sub-graph-Asset.md) | Learn about the asset type that contains any sub graph you create. | +| [Sticky Notes](Sticky-Notes.md) | Use sticky notes to write comments within your shader graphs. | +| [Color Modes](Color-Modes.md) | Select color modes to improve your graph readability according to certain criteria like node category, relative performance cost, data precision mode, or custom colors. | +| [Precision Modes](Precision-Modes.md) | Set precision modes for graphs, subgraphs, and nodes to help you optimize your content for different platforms. | +| [Preview Mode Control](Preview-Mode-Control.md) | Manually select your preferred preview mode for nodes that have a preview. | +| [Custom Render Textures](Custom-Render-Texture.md) | Create shaders that are compatible with Custom Render Texture Update and Initialization materials. | +| [Material Variants](materialvariant-SG.md) | Create variations based on a single material. | +| [Property Types](Property-Types.md) | Use properties in your shader graph to expose them as material properties and make them editable in the material that uses the shader. | +| [Keywords](Keywords.md) | Use keywords to create different variants for your shader graph. | +| [Data Types](Data-Types.md) | Learn about all data types available in Shader Graph. | +| [Port Bindings](Port-Bindings.md) | Learn about port bindings which ensure that some ports always meet data type expectations. | +| [Shader Stage](Shader-Stage.md) | Learn about shader stages that apply to specific ports according to their context compatibility. | +| [Surface options](surface-options.md) | Modify a specific set of properties for certain render pipeline targets. | +| [Custom Interpolators](Custom-Interpolators.md) | Pass custom data from the vertex context to the fragment context. | diff --git a/Packages/com.unity.shadergraph/Documentation~/install-and-upgrade.md b/Packages/com.unity.shadergraph/Documentation~/install-and-upgrade.md new file mode 100644 index 00000000000..b8d9491a6ae --- /dev/null +++ b/Packages/com.unity.shadergraph/Documentation~/install-and-upgrade.md @@ -0,0 +1,8 @@ +# Install and upgrade + +Get all the information to install and upgrade Shader Graph. + +| Topic | Description | +| :--- | :--- | +| **[Install Shader Graph](install-shader-graph.md)** | Learn about the Shader Graph installation requirements and follow the installation instructions. | +| **[Upgrade to version 10.0.x of Shader Graph](Upgrade-Guide-10-0-x.md)** | Upgrade your project to make it compatible with Shader Graph 10.0 or later. | diff --git a/Packages/com.unity.shadergraph/Documentation~/install-shader-graph.md b/Packages/com.unity.shadergraph/Documentation~/install-shader-graph.md new file mode 100644 index 00000000000..06427688a16 --- /dev/null +++ b/Packages/com.unity.shadergraph/Documentation~/install-shader-graph.md @@ -0,0 +1,23 @@ +# Install Shader Graph + +Learn about the Shader Graph installation requirements and follow the installation instructions. + +## Requirements + +Use Shader Graph with either of the Scriptable Render Pipelines (SRPs) available in Unity version 2018.1 and later: + +- The [High Definition Render Pipeline (HDRP)](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest) +- The [Universal Render Pipeline (URP)](https://docs.unity3d.com/Manual/urp/urp-introduction.html) + +As of Unity version 2021.2, you can also use Shader Graph with the [Built-In Render Pipeline](https://docs.unity3d.com/Documentation/Manual/built-in-render-pipeline.html). + +> [!NOTE] +> Shader Graph support for the Built-In Render Pipeline is for compatibility purposes only. Shader Graph doesn't receive updates for Built-In Render Pipeline support, aside from bug fixes for existing features. It's recommended to use Shader Graph with the Scriptable Render Pipelines. + +## Installation + +When you install HDRP or URP into your project, Unity also installs the Shader Graph package automatically. You can manually install Shader Graph for use with the Built-In Render Pipeline on Unity version 2021.2 and later with the Package Manager. + +* For more information about how to install a package, see [Adding and removing packages](https://docs.unity3d.com/Manual/upm-ui-actions.html) in the Unity User Manual. + +* For more information about how to set up a Scriptable Render Pipeline, see [Getting started with HDRP](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@17.0/manual/getting-started-in-hdrp.html) or [Getting started with URP](https://docs.unity3d.com/Manual/urp/InstallingAndConfiguringURP). diff --git a/Packages/com.unity.shadergraph/Documentation~/ui-reference.md b/Packages/com.unity.shadergraph/Documentation~/ui-reference.md new file mode 100644 index 00000000000..f9263c7c2be --- /dev/null +++ b/Packages/com.unity.shadergraph/Documentation~/ui-reference.md @@ -0,0 +1,17 @@ +# Shader Graph UI reference + +Explore the main user interface elements you need to know to create and configure your shader graphs. + +| Topic | Description | +| :--- | :--- | +| [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 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 diff --git a/Packages/com.unity.shadergraph/Documentation~/whats-new.md b/Packages/com.unity.shadergraph/Documentation~/whats-new.md new file mode 100644 index 00000000000..916386ba408 --- /dev/null +++ b/Packages/com.unity.shadergraph/Documentation~/whats-new.md @@ -0,0 +1,3 @@ +# What's new in Shader Graph + +For information about the latest updates and improvements to Shader Graph, refer to [What's new in Unity](https://docs.unity3d.com/Manual/WhatsNew.html). diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/library-of-ready-to-use-textures.jpg b/Packages/com.unity.visualeffectgraph/Documentation~/Images/library-of-ready-to-use-textures.jpg new file mode 100644 index 00000000000..0e4dd6f5b1c Binary files /dev/null and b/Packages/com.unity.visualeffectgraph/Documentation~/Images/library-of-ready-to-use-textures.jpg differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/lightmap-a.jpg b/Packages/com.unity.visualeffectgraph/Documentation~/Images/lightmap-a.jpg new file mode 100644 index 00000000000..789a52d835f Binary files /dev/null and b/Packages/com.unity.visualeffectgraph/Documentation~/Images/lightmap-a.jpg differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/lightmap-b.jpg b/Packages/com.unity.visualeffectgraph/Documentation~/Images/lightmap-b.jpg new file mode 100644 index 00000000000..e19ac8b807f Binary files /dev/null and b/Packages/com.unity.visualeffectgraph/Documentation~/Images/lightmap-b.jpg differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/TableOfContents.md b/Packages/com.unity.visualeffectgraph/Documentation~/TableOfContents.md index db8547e804d..bb93a54f5ce 100644 --- a/Packages/com.unity.visualeffectgraph/Documentation~/TableOfContents.md +++ b/Packages/com.unity.visualeffectgraph/Documentation~/TableOfContents.md @@ -1,3 +1,4 @@ + * [Visual Effect Graph](index.md) * [Requirements](System-Requirements.md) * [What's new](whats-new.md) @@ -55,6 +56,13 @@ * [ExposedProperty Helper](ExposedPropertyHelper.md) * [Vector Fields](VectorFields.md) * [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) + * [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) + * [Six-way smoke lit reference](six-way-lighting-reference.md) * [Node Library](node-library.md) * [Context](Context.md) * [Event](Context-Event.md) diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/create-configure-six-way-lit-particle-system.md b/Packages/com.unity.visualeffectgraph/Documentation~/create-configure-six-way-lit-particle-system.md new file mode 100644 index 00000000000..d8208015585 --- /dev/null +++ b/Packages/com.unity.visualeffectgraph/Documentation~/create-configure-six-way-lit-particle-system.md @@ -0,0 +1,26 @@ +# Create a six-way lit particle system in Visual Effect Graph + +Set up a particle system in Visual Effect Graph that uses six-way lighting to achieve enhanced realism for smoke or explosion effects. + +To create and configure a six-way lit particle system, follow these steps: + +1. Open a **Visual Effect Graph** or create a new one. + +1. Set the system to burst a single particle, and allocate memory for one particle. + +1. Right-click the **Output Particle** context, then convert the output to a lit quad. + +1. Set **Material Type** to **Six-Way Smoke Lit** in the Inspector window. + +1. Drag and drop the two six-way lightmap textures from your `Assets` folder to the **Output Particle** context positive and negative axes lightmap slots, respectively. + +1. Set the **Output Particle** context **UV Mode** to **Flipbook**. + +1. Set the **Output Particle** context **Flip Book size** to match the number of frames. + +1. Configure the emissive settings in the Inspector window: + - Set **Emissive Mode** to **Single Channel**. This mode uses the alpha channel of the second texture. + - Adjust **Exposure Weight** and **Emissive Multiplier** as needed. + +1. Adjust six-way lighting settings as needed to achieve the desired effect. + diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/create-effects-with-six-way-lighting.md b/Packages/com.unity.visualeffectgraph/Documentation~/create-effects-with-six-way-lighting.md new file mode 100644 index 00000000000..82ee11f49bd --- /dev/null +++ b/Packages/com.unity.visualeffectgraph/Documentation~/create-effects-with-six-way-lighting.md @@ -0,0 +1,42 @@ +# Customize existing six-way lightmap textures + +Customize lightmap textures to create smoke, dust, or explosions with six-way lighting. + +Unity provides a library of ready-to-use textures under the [CC0 license](https://creativecommons.org/public-domain/cc0/). These lightmap textures were created in an external DCC and exported using the tools provided in the [VFX Toolbox](https://github.com/Unity-Technologies/VFXToolbox). You can leverage these assets to create compact, game-ready effects with six-way lighting techniques. + +![A series of clouds and explosions in different shapes.](Images/library-of-ready-to-use-textures.jpg) + +To create an effect using built-in lightmaps and six-way lighting, follow these steps: + +1. Download the lightmaps from the [library of ready-to-use maps](https://drive.google.com/drive/folders/1_oh0UkAOW6hISqouCXjYwKQ0lkoj0CIF). + +1. Unzip the file you downloaded and place it in Unity's **Asset** folder. + +1. In the **Project** window, right-click and select **Create** > **Visual Effects** > **Visual Effect Graph**. + + The **Create new VFX Asset** window displays. + +1. Create a simple loop VFX asset. + +1. Double-click the new VFX asset. + + The VFX Graph editor displays. + +1. Open the [Blackboard](Blackboard.md). + +1. Right-click the **Output Particle Unlit** node. + +1. Select **Convert output**, then convert the node to an **Output Particle Lit Quad** node. + +1. With the **Output Particle Lit Quad** node selected, select **Six-Way Smoke Lit** from the Inspector **Material Type** dropdown. + +1. Drop the lightmaps you imported in the **Output Particle** context **Positive Axes Lightmap** and **Negative Axes Lightmap** fields. + +You can now test the effect in various lighting setups. + +## Additional resources + +- [VFX Graph](https://unity.com/features/visual-effect-graph) +- [The definitive guide to creating advanced visual effects in Unity](https://create.unity.com/definitive-guide-to-creating-advanced-visual-effects) +- [Realistic smoke lighting with six-way lighting in VFX Graph](https://unity.com/blog/engine-platform/realistic-smoke-with-6-way-lighting-in-vfx-graph) +- [VFX Graph: Six-way lighting workflow | Unity at GDC 2023](https://www.youtube.com/watch?v=uNzLQjpg6UE) diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/import-six-way-lightmap-textures-unity.md b/Packages/com.unity.visualeffectgraph/Documentation~/import-six-way-lightmap-textures-unity.md new file mode 100644 index 00000000000..84b826a8fa0 --- /dev/null +++ b/Packages/com.unity.visualeffectgraph/Documentation~/import-six-way-lightmap-textures-unity.md @@ -0,0 +1,20 @@ +# Import six-way lightmap textures into Unity + +Import and configure six-way lightmap textures for use in Visual Effect Graph. + +To import and set up six-way lightmap textures, follow these steps: + +1. In the **Project** window, go to your **Assets** folder. + +1. Import the two six-way lightmap texture files into the folder. + +1. For each imported texture, set the following: + - Set **Max Size** to match the texture resolution (for example, 4096 for 4K textures). + - Set **Compression** to balance quality and memory usage (for example, **High Quality (BC7)**). + - Set **sRGB (Color Texture)** to match your export settings: + - If you exported the texture in gamma space, enable **sRGB (Color Texture)**. + - If you exported the texture in linear space, disable **sRGB (Color Texture)**. + +1. Select **Apply** to save the import settings. + +After you complete these steps, the six-way lightmap textures are ready for use in Visual Effect Graph. diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/six-way-lighting-landing.md b/Packages/com.unity.visualeffectgraph/Documentation~/six-way-lighting-landing.md new file mode 100644 index 00000000000..99e733cb2d4 --- /dev/null +++ b/Packages/com.unity.visualeffectgraph/Documentation~/six-way-lighting-landing.md @@ -0,0 +1,17 @@ +# Realistic smoke lighting + +Implement custom lighting models to have more control over the visual style of smoke and explosions and achieve better performance. + +| 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. | +| [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. | + + +## Additional resources + +- [Realistic smoke lighting with six-way lighting in VFX Graph](https://unity.com/blog/engine-platform/realistic-smoke-with-6-way-lighting-in-vfx-graph) + diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/six-way-lighting-reference.md b/Packages/com.unity.visualeffectgraph/Documentation~/six-way-lighting-reference.md new file mode 100644 index 00000000000..67a27b7c292 --- /dev/null +++ b/Packages/com.unity.visualeffectgraph/Documentation~/six-way-lighting-reference.md @@ -0,0 +1,88 @@ +# Six-way smoke lit reference + +Learn about the available properties to configure smoke rendering. + +These properties let you adjust lighting, animation, color, and performance. + +The **Smoke Shader UI** contains the following properties: + +## Lightmap Remapping + +The **Lightmap Remapping** section contains the following properties: + +| **Property** | Description | +| :-------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **Lightmap Remap Mode (dropdown)** | Select how to remap lightmap values for the smoke. The following options are available:
  • **None**: Map lightmap values directly, with no remapping.
  • **Parametric Contrast**: Adjust lightmap contrast using parameter controls to boost or soften lighting transitions.
  • **Custom Curve**: Define a custom remap curve for precise control over lighting effects on the smoke.
| +| **Lightmap Remap Range** | Set the input/output range for lightmap remapping, clamping or stretching light values as needed. | +| **Use Alpha Remap** | Enable remapping of alpha values based on lighting to control transparency dynamically. | + +## Emissive + +The **Emissive** section contains the following properties: + +| **Property** | Description | +| :------------------------ | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **Emissive Mode (dropdown)** | Choose how the smoke emits light. The following options are available:
  • **None**: Disable emissive contribution, so smoke is only lit by external lights.
  • **Single Channel**: Use one channel to define emissive intensity, typically as a grayscale value.
  • **Map**: Apply a texture map to control emissive values for spatially varying glow.
| + +## Color and Alpha + +The **Color and Alpha** section contains the following properties: + +| **Property** | Description | +| :------------------------ | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **Use Color Absorption** | Enable simulation of color absorption to let smoke filter and tint passing light. | +| **Receive Shadows** | Allow smoke to receive shadows from other objects for added realism. | +| **Enable Cookie** | Apply light cookies (patterned masks) to affect light interaction with the smoke. | +| **Color Mode (dropdown)** | Control how color data is interpreted for rendering. The following options are available:
  • **None**: Use base color directly with no color processing.
  • **Everything**: Apply color processing to all channels.
  • **Base Color**: Process only the base color channel.
  • **Emissive**: Process only the emissive channel.
  • **Base Color And Emissive**: Process both base color and emissive channels.
| +| **Use Base Color Map** | Enable a texture map for base color to allow detailed color variation within the smoke. | +| **Base Color Map Mode (dropdown)** | Select which channels to use from the base color map. The following options are available:
  • **None**: Apply no base color map.
  • **Everything**: Use all color channels from the base color map.
  • **Color**: Use only color channels (RGB) from the map.
  • **Alpha**: Use only the alpha channel from the map for transparency.
  • **Color And Alpha**: Use both color and alpha channels from the map.
| + +## Texture and UV + +The **Texture and UV** section contains the following properties: + +| **Property** | Description | +| :------------------------ | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **Uv Mode (dropdown)** | Specify how UV coordinates are generated or used. The following options are available:
  • **Default**: Apply standard UV mapping for the texture.
  • **Flipbook**: Use flipbook animation for texture UVs, ideal for animated smoke sequences.
  • **Scale And Bias**: Scale and offset UVs for texture manipulation.
| +| **Flipbook Layout (dropdown)** | Define the layout of flipbook frames for animated textures. The following options are available:
  • **Texture 2D**: Use a standard 2D texture for smoke rendering.
  • **Texture 2D Array**: Use an array of 2D textures for complex animations or variations.
| +| **Base Color** | Set the base color for the smoke, as a constant or via a texture. | +| **Flipbook** | Specify the flipbook asset or parameters for animated texture sequences. | +| **Flipbook Blend Frames** | Control blending between flipbook frames for smooth animation. | + +## Particle Rendering + +The **Particle Rendering** section contains the following properties: + +| **Property** | Description | +| :------------------------ | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **Use Soft Particle** | Enable soft particle rendering to fade smoke edges near intersecting geometry for seamless integration. | +| **Sort (dropdown)** | Control particle sorting for correct transparency rendering. The following options are available:
  • **Auto**: Automatically determine the best sorting mode.
  • **Off**: Disable sorting, which might cause visual artifacts in transparency.
  • **On**: Enable sorting for correct draw order.
| +| **Sort Mode (dropdown)** | Specify sorting algorithm for particles. The following options are available:
  • **Distance To Camera**: Sort by distance to the camera, common for transparency.
  • **Youngest In Front**: Sort by particle age, with newest particles in front.
  • **Camera Depth**: Sort by camera depth buffer.
  • **Custom**: Use a custom sorting function.
| +| **Revert Sorting** | Reverse the sorting order when needed. | +| **Compute Culling** | Enable GPU culling of particles outside the view frustum for performance. | +| **Frustum Culling** | Cull smoke particles outside the camera frustum to optimize rendering. | +| **Cast Shadows** | Enable smoke particles to cast shadows onto other geometry. | + +## Render States + +The **Render States** section contains the following properties: + +| **Property** | Description | +| :---------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **Render States** | Control advanced render state overrides for the smoke material. | +| **Blend Mode (dropdown)** | Set how smoke blends with the background. The following options are available:
  • **Additive**: Add smoke color to the background, ideal for light or glow effects.
  • **Alpha**: Use standard alpha blending for semi-transparent smoke.
  • **Alpha Premultiplied**: Use premultiplied alpha for improved compositing.
  • **Opaque**: Render smoke as fully opaque, with no blending.
| +| **Cull Mode (dropdown)** | Determine which faces are rendered. The following options are available:
  • **Default**: Apply standard culling (usually back-face).
  • **Front**: Render only front faces.
  • **Back**: Render only back faces.
  • **Off**: Disable face culling to render all faces.
| +| **Z Write Mode (dropdown)** | Control writing to the depth buffer (Z). The following options are available:
  • **Default**: Apply standard Z write behavior.
  • **Off**: Disable Z write, useful for transparency.
  • **On**: Enable Z write when needed for certain effects.
| +| **Z Test Mode (dropdown)** | Set the depth test function for rendering order. The following options are available:
  • **Default**: Use the default depth test (usually Less).
  • **Less**: Pass if incoming depth is less than stored.
  • **Greater**: Pass if incoming depth is greater than stored.
  • **L Equal**: Pass if less than or equal to stored.
  • **G Equal**: Pass if greater than or equal to stored.
  • **Equal**: Pass if depths are equal to stored.
  • **Not Equal**: Pass if depths are not equal to stored.
  • **Always**: Always pass, with no depth test.
| + +## Alpha and Motion + +The **Alpha and Motion** section contains the following properties: + +| **Property** | Description | +| :------------------------- | :----------------------------------------------------------------------------------------------------------- | +| **Alpha** | Set a global alpha value for smoke to control overall transparency. | +| **Use Alpha Clipping** | Enable alpha clipping to discard pixels below a certain alpha threshold for hard edges. | +| **Generate Motion Vector** | Enable motion vector output for the smoke to support motion blur. | +| **Exclude From TU And A** | Exclude smoke from certain rendering passes, such as temporal upscaling or anti-aliasing. | +| **Sorting Priority** | Set render queue priority to control draw order relative to other transparent objects. | diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/six-way-lighting.md b/Packages/com.unity.visualeffectgraph/Documentation~/six-way-lighting.md new file mode 100644 index 00000000000..482feb6a7ac --- /dev/null +++ b/Packages/com.unity.visualeffectgraph/Documentation~/six-way-lighting.md @@ -0,0 +1,62 @@ +# Realistic smoke lighting with six-way lighting + +Blend pre-baked lightmaps and achieve dynamic lighting for smoke and other visual effects with six-way lighting. + +Six-way lighting stores lighting from six directions in textures. At runtime, Unity blends these textures based on scene lighting. Effects like smoke, explosions, and clouds thus respond to light sources. + +Six-way lighting enables the following: + +- Volumetric lighting for 2D or flipbook-based particle effects. +- Scaling for real-time visual effects (VFX). +- Adjustable color and emission. +- Compatibility with Unity's lighting system, including HDRP and URP. + +You can use six-way lighting in such scenarios as the folllowing: + +- Daytime smoke with sun and sky lighting. +- Nighttime effects with static or dynamic lights. +- Sandstorms and tornadoes. +- Glowing explosions. + +## How six-way lighting works + +Six-way lighting pre-bakes directional lighting into six sprite texture lightmaps. Each lightmap captures how the sprite is illuminated from a single direction: top, bottom, left, right, front, or back. + +At runtime, Unity shaders blend these six lightmaps based on the current scene lighting. Particles then react to light from any direction. + +## Supported lighting and Unity features + +You can use six-way lighting with the built-in VFX Graph Six-Way Smoke Lit output in both URP and HDRP. + +Six-way lighting supports indirect lighting from the following: +- Light Probes +- Adaptive Probe Volumes +- Ambient Probes +- Light Probe Proxy Volumes +- Dynamic point, spot, area, and directional lights + +**Note:** Six-way lighting does not support specular contributions from reflection probes. + +## Lightmap channel mapping + +Unity stores the six directional lightmaps in two RGBA textures. The channel mapping is as follows: + +- Lightmap A: + - Red: right + - Green: top + - Blue: back + - Alpha: transparency +- Lightmap B: + - Red: left + - Green: bottom + - Blue: front + - Alpha: emissive data + +![Five versions of the same smoke sprite. The first is red and lit from the right. The second is green and lit from the top. The third is blue and lit from the back. The fourth appears white and stores transparency in the Alpha channel. The fifth is a multicolored combination of all the previous sprites and stores the RGBA data in Lightmap A.](Images/lightmap-a.jpg) + + +![Five versions of the same smoke sprite. The first is red and lit from the left. The second is green and lit from the bottom. The third is blue and lit from the front. The fourth appears black and does not store any information in the Alpha channel. The fifth is a multicolored combination of all the previous sprites and stores the RGBA data in Lightmap B.](Images/lightmap-b.jpg) + +## Simulate fire and explosions + +To create glowing effects such as fire or explosions, store emissive data in the Alpha channel of Lightmap B to enable dynamic control over the effect's glow and color at runtime. diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/use-tools-generate-six-way-lightmap-textures.md b/Packages/com.unity.visualeffectgraph/Documentation~/use-tools-generate-six-way-lightmap-textures.md new file mode 100644 index 00000000000..a28af0b1661 --- /dev/null +++ b/Packages/com.unity.visualeffectgraph/Documentation~/use-tools-generate-six-way-lightmap-textures.md @@ -0,0 +1,15 @@ +# Generate six-way lightmap textures for visual effects + +Create six-way lightmap textures in your preferred VFX tool for use in Unity. + +To create and export six-way lightmap textures for Unity, follow these steps: + +1. Simulate or paint the smoke or cloud effect in your preferred VFX tool. +2. Set six lighting directions: top, bottom, left, right, front, and back. +3. Render the lighting result from each direction. +4. Pack the lighting data into two textures: + - In the first texture, set the red, green, and blue channels to store lighting data, and set the alpha channel to store transparency. + - In the second texture, set the red, green, and blue channels to store lighting data, and set the alpha channel to store emissive or scattering effects. +5. Export the textures in a format that Unity supports. + +After you complete these steps, you can use the six-way lightmap textures in Unity. diff --git a/Packages/com.unity.visualeffectgraph/Editor/Controls/VFXEnumValuePopup.cs b/Packages/com.unity.visualeffectgraph/Editor/Controls/VFXEnumValuePopup.cs index 6363f3a6756..5a5c6e390cb 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Controls/VFXEnumValuePopup.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Controls/VFXEnumValuePopup.cs @@ -16,7 +16,7 @@ public VFXEnumValuePopup(string label, List values) { m_DropDownButton = new DropdownField(label); m_DropDownButton.choices = values; - m_DropDownButton.value = values[0]; + m_DropDownButton.value = values.Count > 0 ? values[0] : string.Empty; m_DropDownButton.RegisterCallback>(OnValueChanged); Add(m_DropDownButton); } diff --git a/Packages/com.unity.visualeffectgraph/Editor/Controls/VFXReorderableList.cs b/Packages/com.unity.visualeffectgraph/Editor/Controls/VFXReorderableList.cs index a12cd555e5c..854b0b6f4e6 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Controls/VFXReorderableList.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Controls/VFXReorderableList.cs @@ -129,10 +129,7 @@ public void Select(int index) } } - public virtual bool CanRemove() - { - return true; - } + protected virtual bool CanRemove() => itemCount > 1; public void Select(VisualElement item) { diff --git a/Packages/com.unity.visualeffectgraph/Editor/FilterPopup/VFXFilterWindow.cs b/Packages/com.unity.visualeffectgraph/Editor/FilterPopup/VFXFilterWindow.cs index a4f6213c725..3a20442301c 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/FilterPopup/VFXFilterWindow.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/FilterPopup/VFXFilterWindow.cs @@ -301,6 +301,7 @@ private void CreateGUI() private void OnFirstDisplay(GeometryChangedEvent geometryChangedEvent) { + m_Parent.window.m_DontSaveToLayout = true; rootVisualElement.UnregisterCallback(OnFirstDisplay); UpdateDetailsPanelVisibility(); } diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/VFXEdgeConnector.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/VFXEdgeConnector.cs index f346686a53f..eac939b6243 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/VFXEdgeConnector.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/VFXEdgeConnector.cs @@ -33,35 +33,6 @@ protected override void OnMouseMove(MouseMoveEvent e) s_PickedList.Clear(); view.panel.PickAll(e.mousePosition, s_PickedList); - - VFXDataAnchor anchor = s_PickedList.OfType().FirstOrDefault(); - - if (anchor != null) - view.StartEdgeDragInfo(this.edgeDragHelper.draggedPort as VFXDataAnchor, anchor); - else - view.StopEdgeDragInfo(); - } - - protected override void OnMouseUp(MouseUpEvent e) - { - base.OnMouseUp(e); - - if (!e.isPropagationStopped) - return; - - VFXView view = m_Anchor.GetFirstAncestorOfType(); - if (view == null) - return; - view.StopEdgeDragInfo(); - } - - protected override void Abort() - { - base.Abort(); - if (m_Anchor.GetFirstAncestorOfType() is { } view) - { - view.StopEdgeDragInfo(); - } } static List s_PickedList = new List(); diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/VFXEdgeDragInfo.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/VFXEdgeDragInfo.cs deleted file mode 100644 index eef2ca4f544..00000000000 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/VFXEdgeDragInfo.cs +++ /dev/null @@ -1,144 +0,0 @@ -//#define OLD_COPY_PASTE -using System; -using System.Linq; -using System.Collections; -using System.Collections.Generic; -using UnityEditor.Experimental.GraphView; -using UnityEngine; -using UnityEngine.Rendering; -using UnityEditor.Experimental.VFX; -using UnityEngine.Experimental.VFX; -using UnityEngine.UIElements; -using UnityEngine.Profiling; -using System.Reflection; - -using PositionType = UnityEngine.UIElements.Position; - -namespace UnityEditor.VFX.UI -{ - class VFXEdgeDragInfo : VisualElement - { - VFXView m_View; - public VFXEdgeDragInfo(VFXView view) - { - m_View = view; - var tpl = VFXView.LoadUXML("VFXEdgeDragInfo"); - tpl.CloneTree(this); - - this.styleSheets.Add(VFXView.LoadStyleSheet("VFXEdgeDragInfo")); - - m_Text = this.Q