diff --git a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/NativePassCompiler.cs b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/NativePassCompiler.cs index c8a8ac0d18f..96e59067ff0 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/NativePassCompiler.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/NativePassCompiler.cs @@ -1420,7 +1420,7 @@ public void ExecuteGraph(InternalRenderGraphContext rgContext, RenderGraphResour if (pass.waitOnGraphicsFencePassId != -1) { var fence = contextData.fences[pass.waitOnGraphicsFencePassId]; - rgContext.cmd.WaitOnAsyncGraphicsFence(fence); + rgContext.cmd.WaitOnAsyncGraphicsFence(fence, SynchronisationStageFlags.PixelProcessing); } var nrpBegan = false; 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 11166a9be4c..bd41fe40c8f 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraph.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraph.cs @@ -524,7 +524,7 @@ public void Cleanup() nativeCompiler?.Cleanup(); - m_CompilationCache?.Clear(); + m_CompilationCache?.Cleanup(); } internal RenderGraphDebugParams debugParams => m_DebugParameters; @@ -1119,7 +1119,7 @@ public RenderGraphBuilder AddRenderPass(string passName, out PassData [CallerLineNumber] int line = 0) where PassData : class, new() #endif { - var renderPass = m_RenderGraphPool.Get>(); + var renderPass = m_RenderGraphPool.Get>(); renderPass.Initialize(m_RenderPasses.Count, m_RenderGraphPool.Get(), passName, RenderGraphPassType.Legacy, sampler); renderPass.AllowGlobalState(true);// Old pass types allow global state by default as HDRP relies on it @@ -2263,14 +2263,14 @@ void PreRenderPassExecute(in CompiledPassInfo passInfo, RenderGraphPass pass, In if (executedWorkDuringResourceCreation) { - rgContext.cmd.WaitOnAsyncGraphicsFence(previousFence); + rgContext.cmd.WaitOnAsyncGraphicsFence(previousFence, SynchronisationStageFlags.PixelProcessing); } } // Synchronize with graphics or compute pipe if needed. if (passInfo.syncToPassIndex != -1) { - rgContext.cmd.WaitOnAsyncGraphicsFence(m_CurrentCompiledGraph.compiledPassInfos[passInfo.syncToPassIndex].fence); + rgContext.cmd.WaitOnAsyncGraphicsFence(m_CurrentCompiledGraph.compiledPassInfos[passInfo.syncToPassIndex].fence, SynchronisationStageFlags.PixelProcessing); } } 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 ea74f3d93d3..239fd5c8041 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/Runtime/RenderGraph/RenderGraphDefaultResources.cs b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphDefaultResources.cs index 6c629b4f44a..8fbe5617fba 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphDefaultResources.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphDefaultResources.cs @@ -48,7 +48,7 @@ private void InitDefaultResourcesIfNeeded() m_WhiteTexture2D = RTHandles.Alloc(Texture2D.whiteTexture); if (m_ShadowTexture2D == null) - m_ShadowTexture2D = RTHandles.Alloc(1, 1, Experimental.Rendering.GraphicsFormat.D32_SFloat, isShadowMap: true, name: "DefaultShadowTexture"); + m_ShadowTexture2D = RTHandles.Alloc(1, 1, CoreUtils.GetDefaultDepthOnlyFormat(), isShadowMap: true, name: "DefaultShadowTexture"); } internal void Cleanup() 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 cdf7c17c2ca..42d43f56485 100644 --- a/Packages/com.unity.render-pipelines.core/Tests/Editor/NativePassCompilerRenderGraphTests.cs +++ b/Packages/com.unity.render-pipelines.core/Tests/Editor/NativePassCompilerRenderGraphTests.cs @@ -876,11 +876,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] @@ -917,11 +917,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] @@ -959,11 +959,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] @@ -1206,7 +1283,7 @@ public void ChangingGlobalStateDisablesCulling() Assert.IsTrue(firstNativePass.numGraphPasses == 2); } - + [Test] public void GraphPassesDoesNotAlloc() { @@ -1300,7 +1377,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/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs b/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs index 51f1e3fedc7..23185b4db6e 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs @@ -350,8 +350,8 @@ public class Styles public static readonly GUIContent volumeProfileLabel = EditorGUIUtility.TrTextContent("Volume Profile", "Settings that will override the values defined in the Default Volume Profile set in the Render Pipeline Global settings. Local Volumes inside scenes may override these settings further."); public static System.Lazy volumeProfileContextMenuStyle = new(() => new GUIStyle(CoreEditorStyles.contextMenuStyle) { margin = new RectOffset(0, 1, 3, 0) }); - public static readonly GUIContent[] shadowBitDepthNames = { new GUIContent("32 bit"), new GUIContent("16 bit") }; - public static readonly int[] shadowBitDepthValues = { (int)DepthBits.Depth32, (int)DepthBits.Depth16 }; + public static readonly GUIContent[] shadowBitDepthNames = { new GUIContent("32 bit"), new GUIContent("16 bit"), new GUIContent("24 bit") }; + public static readonly int[] shadowBitDepthValues = { (int)DepthBits.Depth32, (int)DepthBits.Depth16, (int)DepthBits.Depth24 }; public static readonly GUIContent gpuResidentDrawerMode = EditorGUIUtility.TrTextContent("GPU Resident Drawer", "Enables draw submission through the GPU Resident Drawer, which can improve CPU performance"); public static readonly GUIContent smallMeshScreenPercentage = EditorGUIUtility.TrTextContent("Small-Mesh Screen-Percentage", "Default minimum screen percentage (0-20%) gpu-driven Renderers can cover before getting culled. If a Renderer is part of a LODGroup, this will be ignored."); 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 e177110ca1a..4126c06e169 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 @@ -3696,7 +3696,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/HDRenderPipeline.RenderGraph.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs index 60ef90d321a..ded68994506 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs @@ -1669,9 +1669,6 @@ TextureHandle RenderTransparency(RenderGraph renderGraph, // Combine volumetric clouds with prerefraction transparents m_VolumetricClouds.CombineVolumetricClouds(renderGraph, hdCamera, colorBuffer, prepassOutput.resolvedDepthBuffer, transparentPrepass, ref opticalFogTransmittance); - // Compose the lines if the user wants lines in the color pyramid (refraction), but after clouds. - ComposeLines(renderGraph, hdCamera, colorBuffer, prepassOutput.resolvedDepthBuffer, prepassOutput.motionVectorsBuffer, (int)LineRendering.CompositionMode.BeforeColorPyramidAfterClouds); - var preRefractionList = renderGraph.CreateRendererList(PrepareForwardTransparentRendererList(cullingResults, hdCamera, true)); var refractionList = renderGraph.CreateRendererList(PrepareForwardTransparentRendererList(cullingResults, hdCamera, false)); @@ -1683,6 +1680,9 @@ TextureHandle RenderTransparency(RenderGraph renderGraph, // If required, render the water debug view m_WaterSystem.RenderWaterDebug(renderGraph, hdCamera, colorBuffer, prepassOutput.depthBuffer, transparentPrepass.waterGBuffer); + // Compose the lines if the user wants lines in the color pyramid (refraction), but after clouds. + ComposeLines(renderGraph, hdCamera, colorBuffer, prepassOutput.resolvedDepthBuffer, prepassOutput.motionVectorsBuffer, (int)LineRendering.CompositionMode.BeforeColorPyramidAfterClouds); + bool ssmsEnabled = Fog.IsMultipleScatteringEnabled(hdCamera, out float fogMultipleScatteringIntensity); if (hdCamera.frameSettings.IsEnabled(FrameSettingsField.Refraction) || hdCamera.IsSSREnabled() || hdCamera.IsSSREnabled(true) || hdCamera.IsSSGIEnabled() || ssmsEnabled) { diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Core/LineRendering.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Core/LineRendering.cs index abbfedf47e6..96dd1f45949 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Core/LineRendering.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Core/LineRendering.cs @@ -23,7 +23,7 @@ public enum CompositionMode { /// Composition will occur before the color pyramid is generated. BeforeColorPyramid = 0, - /// Composition will occur before the color pyramid is generated but after clouds are composited. + /// Composition will occur before the color pyramid is generated but after clouds and water are composited. BeforeColorPyramidAfterClouds = 3, /// Composition will occur after temporal anti-aliasing. AfterTemporalAntialiasing = 1, 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 4772c8afb4d..56d26d4cb0d 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 @@ -683,6 +683,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 68f538841b7..18e2fc024f2 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/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 48a3a84a14e..612f62ee69a 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); - internal 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,48 +194,26 @@ public void Render(RenderGraph graph, ContextContainer frameData, Renderer2DData !isDebugLightingActive) return; - // OpenGL has a bug with MRTs - support single RTs by using low level pass + // 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) - { - 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) + using (var builder = graph.AddRasterRenderPass(k_LightSRTPass, out var passData, m_ProfilingSampleSRT)) { - if (light == null || !light.m_CookieSpriteTextureHandle.IsValid()) - continue; + InitializeRenderPass(builder, frameData, passData, rendererData, ref layerBatch, batchIndex, isVolumetric); - 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.AllowPassCulling(false); - 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); + }); + } } } // Default Raster Pass with MRTs @@ -292,42 +221,17 @@ public void Render(RenderGraph graph, ContextContainer frameData, Renderer2DData { 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.AllowPassCulling(false); - 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 edfe6fbb85c..af8d08d62cc 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 811586b292d..8d600c9f0ad 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcessPass.cs @@ -1342,8 +1342,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 6ee0e5c2adf..b2d3c21ca00 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcessPassRenderGraph.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcessPassRenderGraph.cs @@ -353,9 +353,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) { - // Start at half-res + // Start at half-res int downres = 1; switch (m_Bloom.downscale.value) { @@ -374,10 +374,26 @@ public void RenderBloomTexture(RenderGraph renderGraph, in TextureHandle source, int tw = Mathf.Max(1, m_Descriptor.width >> downres); int th = Mathf.Max(1, m_Descriptor.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); + int mipCount = CalcBloomMipCount(m_Bloom, bloomRes); + int tw = bloomRes.x; + int th = bloomRes.y; // Setup using(new ProfilingScope(ProfilingSampler.Get(URPProfileId.RG_BloomSetup))) @@ -1413,14 +1429,20 @@ public void RenderFinalSetup(RenderGraph renderGraph, UniversalCameraData camera // Scaled FXAA using (var builder = renderGraph.AddRasterRenderPass("Postprocessing Final Setup Pass", out var passData, ProfilingSampler.Get(URPProfileId.RG_FinalSetup))) { + + builder.AllowGlobalStateModification(true); + builder.AllowPassCulling(false); + Material material = m_Materials.scalingSetup; material.shaderKeywords = null; + material.shaderKeywords = null; + if (settings.isFxaaEnabled) - material.EnableKeyword(ShaderKeywordStrings.Fxaa); + CoreUtils.SetKeyword(material, ShaderKeywordStrings.Fxaa, settings.isFxaaEnabled); if (settings.isFsrEnabled) - material.EnableKeyword(settings.hdrOperations.HasFlag(HDROutputUtils.Operation.ColorEncoding) ? ShaderKeywordStrings.Gamma20AndHDRInput : ShaderKeywordStrings.Gamma20); + CoreUtils.SetKeyword(material, (settings.hdrOperations.HasFlag(HDROutputUtils.Operation.ColorEncoding) ? ShaderKeywordStrings.Gamma20AndHDRInput : ShaderKeywordStrings.Gamma20), true); if (settings.hdrOperations.HasFlag(HDROutputUtils.Operation.ColorEncoding)) SetupHDROutput(cameraData.hdrDisplayInformation, cameraData.hdrDisplayColorGamut, material, settings.hdrOperations, cameraData.rendersOverlayUI); @@ -1428,7 +1450,6 @@ public void RenderFinalSetup(RenderGraph renderGraph, UniversalCameraData camera if (settings.isAlphaOutputEnabled) CoreUtils.SetKeyword(material, ShaderKeywordStrings._ENABLE_ALPHA_OUTPUT, settings.isAlphaOutputEnabled); - builder.AllowGlobalStateModification(true); passData.destinationTexture = destination; builder.SetRenderAttachment(destination, 0, AccessFlags.Write); passData.sourceTexture = source; @@ -1551,6 +1572,7 @@ public void RenderFinalBlit(RenderGraph renderGraph, UniversalCameraData cameraD using (var builder = renderGraph.AddRasterRenderPass("Postprocessing Final Blit Pass", out var passData, ProfilingSampler.Get(URPProfileId.RG_FinalBlit))) { builder.AllowGlobalStateModification(true); + builder.AllowPassCulling(false); passData.destinationTexture = postProcessingTarget; builder.SetRenderAttachment(postProcessingTarget, 0, AccessFlags.Write); passData.sourceTexture = source; @@ -1586,8 +1608,7 @@ public void RenderFinalBlit(RenderGraph renderGraph, UniversalCameraData cameraD PostProcessUtils.SetSourceSize(cmd, data.sourceTexture); - if (isFxaaEnabled) - material.EnableKeyword(ShaderKeywordStrings.Fxaa); + CoreUtils.SetKeyword(material, ShaderKeywordStrings.Fxaa, isFxaaEnabled); if (isFsrEnabled) { @@ -1599,7 +1620,7 @@ public void RenderFinalBlit(RenderGraph renderGraph, UniversalCameraData cameraD if (data.cameraData.fsrSharpness > 0.0f) { // RCAS is performed during the final post blit, but we set up the parameters here for better logical grouping. - material.EnableKeyword(requireHDROutput ? ShaderKeywordStrings.EasuRcasAndHDRInput : ShaderKeywordStrings.Rcas); + CoreUtils.SetKeyword(material, (requireHDROutput ? ShaderKeywordStrings.EasuRcasAndHDRInput : ShaderKeywordStrings.Rcas), true); FSRUtils.SetRcasConstantsLinear(cmd, sharpness); } } @@ -1607,7 +1628,7 @@ public void RenderFinalBlit(RenderGraph renderGraph, UniversalCameraData cameraD { // Reuse RCAS as a standalone sharpening filter for TAA. // If FSR is enabled then it overrides the sharpening/TAA setting and we skip it. - material.EnableKeyword(ShaderKeywordStrings.Rcas); + CoreUtils.SetKeyword(material, ShaderKeywordStrings.Rcas, true); FSRUtils.SetRcasConstantsLinear(cmd, data.cameraData.taaSettings.contrastAdaptiveSharpening); } @@ -1640,6 +1661,7 @@ public void RenderFinalBlit(RenderGraph renderGraph, UniversalCameraData cameraD public void RenderFinalPassRenderGraph(RenderGraph renderGraph, ContextContainer frameData, in TextureHandle source, in TextureHandle overlayUITexture, in TextureHandle postProcessingTarget, bool enableColorEncodingIfNeeded) { + var stack = VolumeManager.instance.stack; m_Tonemapping = stack.GetComponent(); m_FilmGrain = stack.GetComponent(); @@ -1683,7 +1705,7 @@ public void RenderFinalPassRenderGraph(RenderGraph renderGraph, ContextContainer } if (RequireSRGBConversionBlitToBackBuffer(cameraData.requireSrgbConversion)) - material.EnableKeyword(ShaderKeywordStrings.LinearToSRGBConversion); + CoreUtils.SetKeyword(material, ShaderKeywordStrings.LinearToSRGBConversion, true); settings.hdrOperations = HDROutputUtils.Operation.None; settings.requireHDROutput = RequireHDROutput(cameraData); @@ -1911,14 +1933,14 @@ public void RenderUberPost(RenderGraph renderGraph, ContextContainer frameData, if (data.isHdrGrading) { - material.EnableKeyword(ShaderKeywordStrings.HDRGrading); + CoreUtils.SetKeyword(material, ShaderKeywordStrings.HDRGrading, true); } else { switch (data.toneMappingMode) { - case TonemappingMode.Neutral: material.EnableKeyword(ShaderKeywordStrings.TonemapNeutral); break; - case TonemappingMode.ACES: material.EnableKeyword(ShaderKeywordStrings.TonemapACES); break; + case TonemappingMode.Neutral: CoreUtils.SetKeyword(material, ShaderKeywordStrings.TonemapNeutral, true); break; + case TonemappingMode.ACES: CoreUtils.SetKeyword(material, ShaderKeywordStrings.TonemapACES, true); break; default: break; // None } } @@ -2088,9 +2110,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, in currentSource, _BloomMipUp[0], _BloomMipUp[maxBloomMip], cameraData.xr.enabled, sameInputOutputTex); + // We need to take into account how many valid mips the bloom pass produced. + int bloomMipCount = CalcBloomMipCount(m_Bloom, CalcBloomResolution(m_Bloom)); + 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, in currentSource, BloomTexture, bloomMipFlareSource, cameraData.xr.enabled, sameBloomInputOutputTex); } UberPostSetupBloomPass(renderGraph, in BloomTexture, m_Materials.uber); @@ -2111,11 +2145,11 @@ public void RenderPostProcessingRenderGraph(RenderGraph renderGraph, ContextCont SetupDithering(cameraData, m_Materials.uber); if (RequireSRGBConversionBlitToBackBuffer(cameraData.requireSrgbConversion)) - m_Materials.uber.EnableKeyword(ShaderKeywordStrings.LinearToSRGBConversion); + CoreUtils.SetKeyword(m_Materials.uber, ShaderKeywordStrings.LinearToSRGBConversion, true); if (m_UseFastSRGBLinearConversion) { - m_Materials.uber.EnableKeyword(ShaderKeywordStrings.UseFastSRGBLinearConversion); + CoreUtils.SetKeyword(m_Materials.uber, ShaderKeywordStrings.UseFastSRGBLinearConversion, true); } bool requireHDROutput = RequireHDROutput(cameraData); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Tiling/TilingJob.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Tiling/TilingJob.cs index 123b2df2a42..e23240fc532 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Tiling/TilingJob.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Tiling/TilingJob.cs @@ -1,4 +1,3 @@ -using System; using Unity.Burst; using Unity.Collections; using Unity.Jobs; @@ -113,6 +112,8 @@ bool SpherePointIsValid(float3 p) => light.lightType == LightType.Point || if (SpherePointIsValid(sphereBoundX0)) ExpandY(sphereBoundX0); if (SpherePointIsValid(sphereBoundX1)) ExpandY(sphereBoundX1); + m_TileYRange.Clamp(0, (short)(tileCount.y - 1)); + if (light.lightType == LightType.Spot) { // Cone base @@ -190,12 +191,22 @@ bool ConicPointIsValid(float3 p) => // from the light position. GetConeSideTangentPoints(lightPositionVS, lightDirectionVS, cosHalfAngle, baseRadius, coneHeight, range, coneU, coneV, out var l1, out var l2); + // Inside the above function there is a check: + // if (math.dot(math.normalize(-vertex), axis) >= cosHalfAngle) + // return; + // So l1 and l2 can be zero vectors. + + // Check for division by 0 + if ((l1.x != 0.0f) && (l1.y != 0.0f) && (l1.z != 0.0f)) { var planeNormal = math.float3(0, 1, viewPlaneBottoms[m_ViewIndex]); var l1t = math.dot(-lightPositionVS, planeNormal) / math.dot(l1, planeNormal); var l1x = lightPositionVS + l1 * l1t; if (l1t >= 0 && l1t <= 1 && l1x.z >= near) ExpandY(l1x); } + + // Check for division by 0 + if ((l2.x != 0.0f) && (l2.y != 0.0f) && (l2.z != 0.0f)) { var planeNormal = math.float3(0, 1, viewPlaneTops[m_ViewIndex]); var l1t = math.dot(-lightPositionVS, planeNormal) / math.dot(l1, planeNormal); @@ -203,8 +214,6 @@ bool ConicPointIsValid(float3 p) => if (l1t >= 0 && l1t <= 1 && l1x.z >= near) ExpandY(l1x); } - m_TileYRange.Clamp(0, (short)(tileCount.y - 1)); - // Calculate tile plane ranges for cone. for (var planeIndex = m_TileYRange.start + 1; planeIndex <= m_TileYRange.end; planeIndex++) { @@ -216,18 +225,25 @@ bool ConicPointIsValid(float3 p) => var planeNormal = math.float3(0, 1, -planeY); // Intersect lines with y-plane and clip if needed. - var l1t = math.dot(-lightPositionVS, planeNormal) / math.dot(l1, planeNormal); - var l1x = lightPositionVS + l1 * l1t; - if (l1t >= 0 && l1t <= 1 && l1x.z >= near) planeRange.Expand((short)math.clamp(ViewToTileSpace(l1x).x, 0, tileCount.x - 1)); - - var l2t = math.dot(-lightPositionVS, planeNormal) / math.dot(l2, planeNormal); - var l2x = lightPositionVS + l2 * l2t; - if (l2t >= 0 && l2t <= 1 && l2x.z >= near) planeRange.Expand((short)math.clamp(ViewToTileSpace(l2x).x, 0, tileCount.x - 1)); + // Check for division by 0 + if ((l1.x != 0.0f) && (l1.y != 0.0f) && (l1.z != 0.0f)) + { + var l1t = math.dot(-lightPositionVS, planeNormal) / math.dot(l1, planeNormal); + var l1x = lightPositionVS + l1 * l1t; + if (l1t >= 0 && l1t <= 1 && l1x.z >= near) planeRange.Expand((short)ViewToTileSpace(l1x).x); + } + // Check for division by 0 + if ((l2.x != 0.0f) && (l2.y != 0.0f) && (l2.z != 0.0f)) + { + var l2t = math.dot(-lightPositionVS, planeNormal) / math.dot(l2, planeNormal); + var l2x = lightPositionVS + l2 * l2t; + if (l2t >= 0 && l2t <= 1 && l2x.z >= near) planeRange.Expand((short)ViewToTileSpace(l2x).x); + } if (IntersectCircleYPlane(planeY, baseCenter, lightDirectionVS, baseUY, baseVY, baseRadius, out var circleTile0, out var circleTile1)) { - if (circleTile0.z >= near) planeRange.Expand((short)math.clamp(ViewToTileSpace(circleTile0).x, 0, tileCount.x - 1)); - if (circleTile1.z >= near) planeRange.Expand((short)math.clamp(ViewToTileSpace(circleTile1).x, 0, tileCount.x - 1)); + if (circleTile0.z >= near) planeRange.Expand((short)ViewToTileSpace(circleTile0).x); + if (circleTile1.z >= near) planeRange.Expand((short)ViewToTileSpace(circleTile1).x); } if (coneIsClipping) @@ -237,34 +253,53 @@ bool ConicPointIsValid(float3 p) => var theta = FindNearConicYTheta(near, lightPositionVS, lightDirectionVS, r, coneU, coneV, y); var p0 = math.float3(EvaluateNearConic(near, lightPositionVS, lightDirectionVS, r, coneU, coneV, theta.x).x, y, near); var p1 = math.float3(EvaluateNearConic(near, lightPositionVS, lightDirectionVS, r, coneU, coneV, theta.y).x, y, near); - if (ConicPointIsValid(p0)) planeRange.Expand((short)math.clamp(ViewToTileSpace(p0).x, 0, tileCount.x - 1)); - if (ConicPointIsValid(p1)) planeRange.Expand((short)math.clamp(ViewToTileSpace(p1).x, 0, tileCount.x - 1)); + if (ConicPointIsValid(p0)) planeRange.Expand((short)ViewToTileSpace(p0).x); + if (ConicPointIsValid(p1)) planeRange.Expand((short)ViewToTileSpace(p1).x); } - // Write to tile ranges above and below the plane. Note that at `m_Offset` we store Y-range. - var tileIndex = m_Offset + 1 + planeIndex; - tileRanges[tileIndex] = InclusiveRange.Merge(tileRanges[tileIndex], planeRange); - tileRanges[tileIndex - 1] = InclusiveRange.Merge(tileRanges[tileIndex - 1], planeRange); + // Do the sphere part of the spotlight + planeY = math.lerp(viewPlaneBottoms[m_ViewIndex], viewPlaneTops[m_ViewIndex], planeIndex * tileScaleInv.y); + GetSphereYPlaneHorizon(lightPositionVS, range, near, sphereClipRadius, planeY, out var sphereTile0, out var sphereTile1); + if (SpherePointIsValid(sphereTile0)) planeRange.Expand((short)ViewToTileSpace(sphereTile0).x); + if (SpherePointIsValid(sphereTile1)) planeRange.Expand((short)ViewToTileSpace(sphereTile1).x); + + // Only consider ranges that intersect the tiling extents. + // The logic in the below 'if' statement is a simplification of: + // !((planeRange.start < 0) && (planeRange.end < 0)) && !((planeRange.start > tileCount.x - 1) && (planeRange.end > tileCount.x - 1)) + if (((planeRange.start >= 0) || (planeRange.end >= 0)) && ((planeRange.start <= tileCount.x - 1) || (planeRange.end <= tileCount.x - 1))) + { + // Write to tile ranges above and below the plane. Note that at `m_Offset` we store Y-range. + var tileIndex = m_Offset + 1 + planeIndex; + planeRange.Clamp(0, (short)(tileCount.x - 1)); + tileRanges[tileIndex] = InclusiveRange.Merge(tileRanges[tileIndex], planeRange); + tileRanges[tileIndex - 1] = InclusiveRange.Merge(tileRanges[tileIndex - 1], planeRange); + } } } - - m_TileYRange.Clamp(0, (short)(tileCount.y - 1)); - - // Calculate tile plane ranges for sphere. - for (var planeIndex = m_TileYRange.start + 1; planeIndex <= m_TileYRange.end; planeIndex++) + else // Sphere { - var planeRange = InclusiveRange.empty; - - var planeY = math.lerp(viewPlaneBottoms[m_ViewIndex], viewPlaneTops[m_ViewIndex], planeIndex * tileScaleInv.y); - GetSphereYPlaneHorizon(lightPositionVS, range, near, sphereClipRadius, planeY, out var sphereTile0, out var sphereTile1); - if (SpherePointIsValid(sphereTile0)) planeRange.Expand((short)math.clamp(ViewToTileSpace(sphereTile0).x, 0, tileCount.x - 1)); - if (SpherePointIsValid(sphereTile1)) planeRange.Expand((short)math.clamp(ViewToTileSpace(sphereTile1).x, 0, tileCount.x - 1)); + // Calculate tile plane ranges for sphere. + for (var planeIndex = m_TileYRange.start + 1; planeIndex <= m_TileYRange.end; planeIndex++) + { + var planeRange = InclusiveRange.empty; - var tileIndex = m_Offset + 1 + planeIndex; - tileRanges[tileIndex] = InclusiveRange.Merge(tileRanges[tileIndex], planeRange); - tileRanges[tileIndex - 1] = InclusiveRange.Merge(tileRanges[tileIndex - 1], planeRange); + var planeY = math.lerp(viewPlaneBottoms[m_ViewIndex], viewPlaneTops[m_ViewIndex], planeIndex * tileScaleInv.y); + GetSphereYPlaneHorizon(lightPositionVS, range, near, sphereClipRadius, planeY, out var sphereTile0, out var sphereTile1); + if (SpherePointIsValid(sphereTile0)) planeRange.Expand((short)ViewToTileSpace(sphereTile0).x); + if (SpherePointIsValid(sphereTile1)) planeRange.Expand((short)ViewToTileSpace(sphereTile1).x); + + // Only consider ranges that intersect the tiling extents. + // The logic in the below 'if' statement is a simplification of: + // !((planeRange.start < 0) && (planeRange.end < 0)) && !((planeRange.start > tileCount.x - 1) && (planeRange.end > tileCount.x - 1)) + if (((planeRange.start >= 0) || (planeRange.end >= 0)) && ((planeRange.start <= tileCount.x - 1) || (planeRange.end <= tileCount.x - 1))) + { + var tileIndex = m_Offset + 1 + planeIndex; + planeRange.Clamp(0, (short)(tileCount.x - 1)); + tileRanges[tileIndex] = InclusiveRange.Merge(tileRanges[tileIndex], planeRange); + tileRanges[tileIndex - 1] = InclusiveRange.Merge(tileRanges[tileIndex - 1], planeRange); + } + } } - tileRanges[m_Offset] = m_TileYRange; } @@ -524,12 +559,19 @@ void TileReflectionProbe(int index) var p = math.float3(x, planeY, 1); var pTS = isOrthographic ? ViewToTileSpaceOrthographic(p) : ViewToTileSpace(p); - planeRange.Expand((short)math.clamp(pTS.x, 0, tileCount.x - 1)); + planeRange.Expand((short)pTS.x); } - var tileIndex = m_Offset + 1 + planeIndex; - tileRanges[tileIndex] = InclusiveRange.Merge(tileRanges[tileIndex], planeRange); - tileRanges[tileIndex - 1] = InclusiveRange.Merge(tileRanges[tileIndex - 1], planeRange); + // Only consider ranges that intersect the tiling extents. + // The logic in the below 'if' statement is a simplification of: + // !((planeRange.start < 0) && (planeRange.end < 0)) && !((planeRange.start > tileCount.x - 1) && (planeRange.end > tileCount.x - 1)) + if (((planeRange.start >= 0) || (planeRange.end >= 0)) && ((planeRange.start <= tileCount.x - 1) || (planeRange.end <= tileCount.x - 1))) + { + var tileIndex = m_Offset + 1 + planeIndex; + planeRange.Clamp(0, (short)(tileCount.x - 1)); + tileRanges[tileIndex] = InclusiveRange.Merge(tileRanges[tileIndex], planeRange); + tileRanges[tileIndex - 1] = InclusiveRange.Merge(tileRanges[tileIndex - 1], planeRange); + } } tileRanges[m_Offset] = m_TileYRange; diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRendererRenderGraph.cs b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRendererRenderGraph.cs index b8fe89bd1f1..c11a2311a61 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRendererRenderGraph.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRendererRenderGraph.cs @@ -1451,7 +1451,7 @@ private void OnAfterRendering(RenderGraph renderGraph) (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); 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..377a9edf508 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 @@ -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 @@ -785,12 +758,12 @@ MonoBehaviour: 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 --- !u!20 &470662021 Camera: m_ObjectHideFlags: 0 @@ -929,12 +902,12 @@ MonoBehaviour: 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 --- !u!20 &482165991 Camera: m_ObjectHideFlags: 0 @@ -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 @@ -1495,6 +1472,7 @@ MeshRenderer: m_RayTraceProcedural: 0 m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: @@ -1555,7 +1533,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 +1540,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 +1582,7 @@ MeshRenderer: m_RayTraceProcedural: 0 m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: @@ -1907,12 +1870,12 @@ MonoBehaviour: 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 --- !u!20 &1410108895 Camera: m_ObjectHideFlags: 0 @@ -1922,7 +1885,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 @@ -2035,12 +1998,12 @@ MonoBehaviour: 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 --- !u!20 &1655053638 Camera: m_ObjectHideFlags: 0 @@ -2115,108 +2078,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 +2169,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 @@ -2288,12 +2229,12 @@ MonoBehaviour: 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 --- !u!20 &1678942892 Camera: m_ObjectHideFlags: 0 @@ -2437,8 +2378,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 @@ -2537,6 +2482,7 @@ MeshRenderer: m_RayTraceProcedural: 0 m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: 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 3aac743b220..8366eeb005f 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 @@ -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 @@ -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 @@ -648,12 +625,12 @@ MonoBehaviour: 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 --- !u!1 &1243279511 GameObject: m_ObjectHideFlags: 0 @@ -666,8 +643,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: MovinigCube @@ -716,6 +691,7 @@ MeshRenderer: m_RayTraceProcedural: 0 m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: @@ -764,35 +740,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 @@ -942,6 +889,7 @@ MeshRenderer: m_RayTraceProcedural: 0 m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: @@ -1049,6 +997,7 @@ MeshRenderer: m_RayTraceProcedural: 0 m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: @@ -1156,6 +1105,7 @@ MeshRenderer: m_RayTraceProcedural: 0 m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: @@ -1263,6 +1213,7 @@ MeshRenderer: m_RayTraceProcedural: 0 m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: @@ -1319,108 +1270,91 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 131481531} m_Modifications: - - target: {fileID: 6308746673132675046, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 1028709304226404832, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6308746673132675046, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_Name value: CheckAssignedRenderPipelineAsset 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 +1365,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 @@ -1512,8 +1445,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 @@ -1612,6 +1549,7 @@ MeshRenderer: m_RayTraceProcedural: 0 m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: @@ -1755,6 +1693,7 @@ MeshRenderer: m_RayTraceProcedural: 0 m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: 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/NativeRenderPassTests.cs b/Packages/com.unity.render-pipelines.universal/Tests/Editor/NativeRenderPassTests.cs index 34407bd9beb..45d11c0642e 100644 --- a/Packages/com.unity.render-pipelines.universal/Tests/Editor/NativeRenderPassTests.cs +++ b/Packages/com.unity.render-pipelines.universal/Tests/Editor/NativeRenderPassTests.cs @@ -121,7 +121,7 @@ public void OverLimitRenderPassInNRP() InitializeRenderPassQueue(m_TestHelper.scriptableRenderer, ScriptableRenderer.kRenderPassMaxCount+1); // Check that a logError is thrown, but no other errors are thrown. m_TestHelper.scriptableRenderer.SetupNativeRenderPassFrameData( m_TestHelper.cameraData, true ); - LogAssert.Expect($"Exceeded the maximum number of Render Passes (${ScriptableRenderer.kRenderPassMaxCount}). Please consider using Render Graph to support a higher number of render passes with Native RenderPass, note support will be enabled by default."); + LogAssert.Expect(LogType.Error, $"Exceeded the maximum number of Render Passes (${ScriptableRenderer.kRenderPassMaxCount}). Please consider using Render Graph to support a higher number of render passes with Native RenderPass, note support will be enabled by default."); } } diff --git a/Packages/com.unity.shadergraph/Documentation~/Getting-Started.md b/Packages/com.unity.shadergraph/Documentation~/Getting-Started.md index cd100678fe1..c6cc4304d18 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Getting-Started.md +++ b/Packages/com.unity.shadergraph/Documentation~/Getting-Started.md @@ -1,15 +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. - -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). +| 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-concepts.md b/Packages/com.unity.shadergraph/Documentation~/Keywords-concepts.md new file mode 100644 index 00000000000..38f4f31f64c --- /dev/null +++ b/Packages/com.unity.shadergraph/Documentation~/Keywords-concepts.md @@ -0,0 +1,45 @@ +# Introduction to keywords in Shader Graph + +Keywords enable you to create shader variants that address multiple contexts, for example: + +* Features that you can turn on or off for each material instance. +* Features that behave differently on certain platforms. +* Shaders that scale in complexity based on conditions you set. + +For more information about keywords and how they affect the final shader, refer to [Changing how shaders work using keywords](https://docs.unity3d.com/Manual/SL-MultipleProgramVariants.html). + +## Conditions and keyword types + +There are two types of keywords you can use depending on the type of conditions you need to set up: + +* Boolean keywords, either on or off, to enable switching between two shader branches. +* Enum keywords, with two or more states, to enable switching between two or more shader branches. + +## Keyword impact optimization + +Each keyword you add in your shader graph implies the addition of one or more branches in the graph. When you add multiple keywords, the number of branch combinations for a single shader graph increases extremely fast, which might result in significant performance impact at build time. + +**Note**: This version of Shader Graph doesn't support dynamic branching for runtime optimization. + +For more information about keyword declarations and behaviors, refer to [How Unity compiles branching shaders](https://docs.unity3d.com/Manual/shader-conditionals-choose-a-type.html). + +### Keyword Definition + +Each keyword has its own [**Definition** parameter](Keywords-reference.md#common-parameters) which lets you define the keyword behavior at build time and at runtime. + +### Shader variants and build time impacts + +* At build time, Unity compiles multiple shader variants according to the number of branches and keywords you define in your shader graph. +* At runtime, Unity sends the GPU the shader variant that matches the evaluation results. + +**Note**: If you use many keywords, it negatively affects the build time as it requires Unity to generate millions or trillions of shader variants. + +By default, Unity sets the keyword's [**Definition** parameter](Keywords-reference.md#common-parameters) to **Shader Feature** to only compile shader variants you use in your build and reduce build time. If you need all the shader variants in your build, for example because you need to change shader branches at runtime, use **Multi Compile** instead. However, this might significantly increase build time and file sizes. + +> [!NOTE] +> When Unity strips out a variant in the build process, any attempt to use this variant at runtime results in a pink shader error. + +## Additional resources + +* [Manage keywords in Shader Graph](Keywords-manage.md) +* [Keyword parameter reference](Keywords-reference.md) diff --git a/Packages/com.unity.shadergraph/Documentation~/Keywords-manage.md b/Packages/com.unity.shadergraph/Documentation~/Keywords-manage.md new file mode 100644 index 00000000000..7efc6fff62b --- /dev/null +++ b/Packages/com.unity.shadergraph/Documentation~/Keywords-manage.md @@ -0,0 +1,42 @@ +# Manage keywords in Shader Graph + +Get started with adding and managing keywords in a Shader Graph. + +## Add a keyword in a Shader Graph + +To add a keyword in a Shader Graph: + +1. Add a keyword in the [Blackboard](Blackboard.md) and define the [keyword parameters](Keywords-reference.md) according to your needs. + +1. Add a [Keyword Node](Keyword-Node.md) in the graph from the keyword you defined in the Blackboard. + +Unity [declares the keyword](https://docs.unity3d.com/Manual/SL-MultipleProgramVariants-declare.html) in the final shader code. + +## Make the shader behavior conditional on the keyword + +To make the shader behavior conditional on the keyword in the Shader Graph: + +1. Create the upstream Shader Graph branches that define the various behaviors you want to use conditionally. + +1. Connect each branch to a different input port of the Keyword Node according to the keyword value you want to use for later toggling. + +1. Connect the output port of the Keyword Node to the node port you want to apply the conditional graph part to. + +Unity [adds all the conditions and branches](https://docs.unity3d.com/Manual/SL-MultipleProgramVariants-make-conditionals.html) in the final shader code. + +## Toggle the shader keyword in the Editor + +To be able to control a keyword from the Material Inspector, make sure to enable **Generate Material Property** in the [keyword parameters](Keywords-reference.md) in the graph. + +## Toggle the shader keyword in a script + +To enable a Boolean keyword from a script, use `EnableKeyword` on the keyword's **Reference Name**. `DisableKeyword` disables the keyword. To learn more about Boolean keywords, refer to [Shader variants and keywords](https://docs.unity3d.com/Manual/SL-MultipleProgramVariants.html). + +When controlling an Enum keyword via script with a `Material.EnableKeyword` or `Shader.EnableKeyword` function, enter the state label in the format `{REFERENCE}_{REFERENCESUFFIX}`. For example, if your reference name is MYENUM and the desired entry is OPTION1, then you would call `Material.EnableKeyword("MYENUM_OPTION1")`. When you select an option, you must also disable the other options to see the effect. + +**Note:** By default, when you add a keyword, Unity adds an underscore to the start of **Reference Name**. As a result, a keyword with the name **MYENUM** has the reference name **_MYENUM**. + +## Additional resources + +* [Introduction to keywords in Shader Graph](Keywords-concepts.md) +* [Keyword parameter reference](Keywords-reference.md) diff --git a/Packages/com.unity.shadergraph/Documentation~/Keywords-reference.md b/Packages/com.unity.shadergraph/Documentation~/Keywords-reference.md new file mode 100644 index 00000000000..714f132a163 --- /dev/null +++ b/Packages/com.unity.shadergraph/Documentation~/Keywords-reference.md @@ -0,0 +1,55 @@ +# Keyword parameter reference + +There are two types of keywords: Boolean and Enum. Each keyword type has a few specific parameters in addition to the many parameters that all keyword types have in common. + +## Common parameters + +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. 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.
| +| **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). | +| **Stages** | Set the stage the keyword applies to.

The following options are available:
  • **All** - Applies this keyword to all shader stages.
  • **Vertex** - Applies this keyword to the vertex stage.
  • **Fragment** - Applies this keyword to the fragment stage.
| + + + +## Boolean keywords + +Parameter specific to Boolean keywords in addition to the [common parameters](#common-parameters). + +| **Name** | **Description** | +| :--- | :--- | +| **Default Value** | Enable this parameter to set the keyword's default state to on, and disable it to set the keyword's default state to off.

This parameter determines the value to use for the keyword when Shader Graph generates previews. It also defines the keyword's default value when you use this shader to create a new Material. | + + + +## Enum keywords + +Parameters specific to Enum keywords in addition to the [common parameters](#common-parameters). + +| **Name** | **Description** | +| :--- | :--- | +| **Default Value** | Select an entry from the drop-down menu to determine which value to use for the keyword when Shader Graph generates previews. This also defines the keyword's default value when you use this shader to create a new Material. When you edit the Entries list, Shader Graph automatically updates the options in this control. | +| **Entries** | This list defines all the states for the keyword. Each state has a separate **Entry Name** and **Reference Suffix**.
  • **Entry Name**: The name displayed in drop-down menus for the keyword on the [Internal Inspector](Internal-Inspector.md) and the Material Inspector. Shader Graph also uses this name for port labels on nodes that reference the keyword.
  • **Reference Suffix**: This identifies the final keyword, presented in the format `Reference_ReferenceSuffix`.
| + +When you define an Enum keyword, Shader Graph displays labels for each state consisting of a version of the Enum's **Entry Name** appended to the main **Reference** name. + +> [!NOTE] +> Special characters such as `(`, `)`, `!`, or `@` are not valid in the **Entry Name** of an Enum keyword. Shader Graph converts invalid characters to underscores (`_`). + + + +## Built-in keywords + +The parameters of built-in keywords depend on their type, which is always of either the Boolean or Enum type, and you cannot edit their values. + +All Built-in keyword fields in the **Node Settings** tab of the [Graph Inspector](Internal-Inspector.md) are grayed out except for the **Default** field, which you can enable or disable to show the differences in Shader Graph previews. You also cannot expose Built-in keywords in the Material Inspector. + +## Additional resources + +* [Introduction to keywords in Shader Graph](Keywords-concepts.md) +* [Manage keywords in Shader Graph](Keywords-manage.md) diff --git a/Packages/com.unity.shadergraph/Documentation~/Keywords.md b/Packages/com.unity.shadergraph/Documentation~/Keywords.md index 981514f50bd..1354003f4be 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Keywords.md +++ b/Packages/com.unity.shadergraph/Documentation~/Keywords.md @@ -1,77 +1,9 @@ -# Keywords +# Changing how shaders work using keywords -## Description - -Use Keywords to create different variants for your Shader Graph. - -Keywords enable you to create shaders: - -* With features that you can turn on or off for each Material instance. -* With features that behave differently on certain platforms. -* That scale in complexity based on conditions you set. - -There are three types of Keywords: Boolean, Enum, and Built-in. Unity defines a Keyword in the graph, shader, and optionally, the Material Inspector based on its type. See [Boolean Keyword](#BooleanKeywords), [Enum Keyword](#EnumKeywords), and [Built-in Keyword](#BuiltinKeywords) for more information about Keyword types. For more information about how these Keywords affect the final shader, see documentation on [Making multiple shader program variants](https://docs.unity3d.com/Manual/SL-MultipleProgramVariants.html). - -In Shader Graph, you first define a Keyword on the [Blackboard](Blackboard.md), then use a [Keyword Node](Keyword-Node.md) to create a branch in the graph. - -The Editor is able to compile variants on demand when it needs them to render content. If you declare many different variants, you can end up with millions or trillions of possibilities. However, the Player needs to determine at build time which variants are in use and include them when it pre-compiles your shaders. To manage memory effectively, the Player strips unused variants based on their keyword and Editor settings. See the next section, Common parameters, to learn more about how you can give the Player hints about what it needs to compile and what it can ignore. When the Player strips out a variant in the build process, it displays the pink error shader. - -## Common parameters - -Although some fields are specific to certain types of Keywords, all Keywords have the following parameters. - -| **Name** | **Type** | **Description** | -| ------------------ | -------- | ------------------------------------------------------------ | -| **Display Name** | String | 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. | -| **Exposed** | Boolean | When you set this parameter to **true**, Unity displays this Keyword in the Material Inspector. If you set it to **false**, the Keyword does not appear in the Material Inspector.

If you intend to access a GLOBAL shader variable, be sure to add it as you would normally add an input variable, but deselect **Exposed**.| -| **Reference Name** | String | The internal name for the Keyword in the shader.

If you overwrite the Reference Name parameter, take note of the following:
  • Keyword Reference Names are always in full capitals, so Unity converts all lowercase letters to uppercase.
  • If the Reference Name contains any characters that HLSL does not support, Unity replaces those characters with underscores.
  • Right-click on a Reference Name, and select **Reset Reference** to revert to the default Reference Name.
    • | -| **Definition** | Enum | Sets how the Keyword is defined in the shader. Determines when to compile keyword variants.

      There are three available options:
      • **Shader Feature**: Unity only compiles keyword variants when a Material selects the relevant option. For this option to be available in the Player, a Material selecting it must exist at build-time.
      • **Multi Compile**: Pre-compiles all the variant possibilities. This is slower and uses more memory, but allows the option to be dynamically switched in the Player.
      • **Predefined**: The render pipeline defines this keyword and controls the settings for it.
        • | -| **Scope** | Enum | Sets the scope at which to define the Keyword.

          The following options are available:
          • **Global Keywords**: Defines Keyword for the entire project, and it counts towards the global keyword limit.
          • **Local Keywords**: Defines Keyword for only one shader, which has its own local keyword limit.
            • When you use Predefined Keywords, Unity disables this field. | -| **Stages** | N/A | Set the stage the keyword applies to.

              The following options are available:
              • **All** - Applies this keyword to all shader stages.
              • **Vertex** - Applies this keyword to the vertex stage.
              • **Fragment** - Applies this keyword to the fragment stage.
                • | - - -## Boolean Keywords - -Boolean Keywords are either on or off. This results in two shader variants. Unity exposes Boolean Keywords in the Material Inspector if the Exposed parameter is set to is true. To enable the keyword from a script, use EnableKeyword on the keyword's Reference name. DisableKeyword disables the keyword. To learn more about Boolean Keywords, see [Shader variants and keywords](https://docs.unity3d.com/Manual/SL-MultipleProgramVariants.html). - - -### Type-specific parameters - -Boolean Keywords have one Boolean-specific parameter in addition to the common parameters listed above. - -| **Name** | **Type** | **Description** | -| ----------- | -------- | ------------------------------------------------------------ | -| **Default** | Boolean |Enable this parameter to set the Keyword's default state to on, and disable it to set the Keyword's default state to off.

                  This parameter determines the value to use for the Keyword when Shader Graph generates previews. It also defines the Keyword's default value when you use this shader to create a new Material. | - - -## Enum Keywords - -Enum Keywords can have two or more states, which you define in the **Entries** list. If you expose an Enum Keyword, the **Display Names** in its **Entries** list appear in a dropdown menu in the Material Inspector. - -Special characters such as ( ) or ! @ are not valid in the **Entry Name** of an Enum Keyword. Shader Graph converts invalid characters to underscores ( _ ). - -When you define an Enum Keyword, Shader Graph displays labels for each state consisting of a sanitized version of the Enum's **Entry Name** appended to the main **Reference** name. -When controlling a keyword via script with a, Material.EnableKeyword or Shader.EnableKeyword function, enter the state label in the format {REFERENCE}_{REFERENCESUFFIX}. For example, if your reference name is MYENUM and the desired entry is OPTION1, then you would call Material.EnableKeyword("MYENUM_OPTION1"). When you select an option, this disables the other options. - -### Type-specific parameters - -In addition to the common parameters listed above, Enum Keywords have the following additional parameters. - -| **Name** | **Type** | **Description** | -| ----------- | ---------------- | ------------------------------------------------------------ | -| **Default** | Enum | Select an entry from the drop-down menu to determine which value to use for the Keyword when Shader Graph generates previews. This also defines the Keyword's default value when you use this shader to create a new Material. When you edit the Entries list, Shader Graph automatically updates the options in this control. | -| **Entries** | Reorderable List | This list defines all the states for the Keyword. Each state has a separate **Display Name** and **Reference Suffix**.

                  • **Display Name**: Appears in drop-down menus for the Keyword on the [Internal Inspector](Internal-Inspector.md) and the Material Inspector. Shader Graph also uses this name for port labels on nodes that reference the Keyword.
                  • **Reference Suffix**: This is the final keyword, presented in the format Reference_ReferenceSuffix. | - - -## Built-in Keywords - -Built-in Keywords are always of either the Boolean or Enum type, but they behave slightly differently from Boolean or Enum Keywords that you create. The Unity Editor or active Render Pipeline sets their values, and you cannot edit these. - -All Built-in Keyword fields in the **Node Settings** tab of the [Graph Inspector](Internal-Inspector.md) are grayed out except for the **Default** field, which you can enable or disable to show the differences in Shader Graph previews. You also cannot expose Built-in Keywords in the Material Inspector. - -In an HDRP project, you can find the current quality level in the Material section of the [HDRP Asset](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest/manual/quality-settings.html#using-the-current-quality-settings-parameters). For URP projects, the feature is not supported, but you can use the `SetGloalShaderKeywords` command to set the [MaterialQuality](https://docs.unity3d.com/Packages/com.unity.render-pipelines.core@latest/api/UnityEngine.Rendering.MaterialQuality.html) Enum in the script. For example, the following line would set Material Quality to High: - -```c# -MaterialQualityUtilities.SetGlobalShaderKeywords( MaterialQuality.High ); -``` +Use keywords to create different variants for your Shader Graph. +| **Topic** | **Description** | +| :--- | :--- | +| [Introduction to keywords in Shader Graph](Keywords-concepts.md) | Learn about keywords, their different types, and what you can achieve with them. | +| [Manage keywords in Shader Graph](Keywords-manage.md) | Get started with adding and managing keywords in a Shader Graph. | +| [Keyword parameter reference](Keywords-reference.md) | Get a description of all keyword parameters, by keyword type. | diff --git a/Packages/com.unity.shadergraph/Documentation~/Property-Types.md b/Packages/com.unity.shadergraph/Documentation~/Property-Types.md index 30849a76d05..ce6260db83e 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Property-Types.md +++ b/Packages/com.unity.shadergraph/Documentation~/Property-Types.md @@ -8,55 +8,35 @@ Each property has an associated **Data Type**. See [Data Types](Data-Types.md) f ## Common Parameters -In addition to values specific to their [Data Types](Data-Types.md), most properties have the following common parameters. +All properties have the following common parameters in addition to those specific to their [Data Types](Data-Types.md). -| Name | Type | Description | -|:------------ |:---|:---| -| Display Name | String | The display name of the property | -| Exposed | Boolean | If true this property will be exposed on the material inspector | -| Reference Name | String | The internal name used for the property inside the shader | -| Override Property Declaration | Boolean | An advanced option to enable explicit control of the shader declaration for this property | -| Shader Declaration | Enumeration | Controls the shader declaration of this property | - -NOTE: If you overwrite the **Reference Name** parameter be aware of the following conditions: - -* If your **Reference Name** does not begin with an underscore, one will be automatically appended. -* If your **Reference Name** contains any characters which are unsupported in HLSL they will be removed. -* You can revert to the default **Reference Name** by right clicking on it and selecting **Reset Reference**. +| Parameter | Description | +| :--- | :--- | +| **Name** | The display name of the property. | +| **Reference** | The internal name for the property in the shader. Use this **Reference** name instead of the display **Name** when you reference the property in a script.

                  If you overwrite this parameter, be aware of the following:
                  • If the string doesn't begin with an underscore, Unity automatically adds one.
                  • If the string contains any characters that HLSL does not support, Unity removes them.
                  • You can revert to the default value: right-click on the **Reference** field label, and select **Reset Reference**.
                  | +| **Precision** | Sets the data precision mode of the Property. The options are **Inherit**, **Single**, **Half**, and **Use Graph Precision**.
                  For more details, refer to [Precision Modes](Precision-Modes.md). | +| **Scope** | Specifies where you expect to edit the property for materials. The options are:
                  • **Global**: Makes the property editable at a global level, through a C# script only, for all materials that use it. Selecting this option hides or grays out all parameters that relate to the Inspector UI display.
                  • **Per Material**: Makes the property independently editable per material, either through a C# script, or in the Inspector UI if you enable **Show In Inspector**.
                  • **Hybrid Per Instance**: Has the same effect as **Per Material**, unless you're using [DOTS instancing](https://docs.unity3d.com/Packages/com.unity.entities.graphics@latest/index.html?subfolder=/manual/dots-instancing-shader.html).
                  | +| **Show In Inspector** | Displays the property in the material inspector.
                  If you disable this option, it includes an `[HideInInspector]` attribute to the material property (refer to [Properties block reference in ShaderLab](https://docs.unity3d.com/Manual/SL-Properties.html#material-property-attributes) for more details). | ## Float Defines a **Float** value. -| Data Type | Modes | -|:-------------|:------| -| Float | Default, Slider, Integer | +Parameters specific to Float properties in addition to the [common parameters](#common-parameters): -#### Default - -Displays a scalar input field in the material inspector. +| Parameter | Description | +| :--- | :--- | +| **Mode** | Select the UI mode in which you want to display the Property and manipulate its value in the material inspector. You need to define a specific subset of parameters according to the option you select.

                  The options are:
                  • **Default**: Displays a scalar input field in the material inspector. Only requires a **Default Value**.
                  • **Slider**: Defines the Float property in [`Range`](https://docs.unity3d.com/Manual/SL-Properties.html#material-property-declaration-syntax-by-type) mode to display a slider field in the material inspector. Use [additional parameters](#slider) to define the slider range.
                  • **Integer**: Displays an integer input field in the material inspector. Only requires a **Default Value**.
                  | +| **Default Value** | The default value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html).
                  The value might be either a float or an integer according to the **Mode** you select. | -| Field | Type | Description | -|:-------------|:------|:------------| -| Default | Float | The default value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html). | - -#### Slider - -Displays a slider field in the material inspector. - -| Field | Type | Description | -|:-------------|:------|:------------| -| Default | Float | The default value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html). | -| Min | Float | The minimum value of the slider. | -| Max | Float | The maximum value of the slider. | +### Slider -#### Integer +Additional parameters available when you set the Float property **Mode** to **Slider**. -Displays an integer input field in the material inspector. - -| Field | Type | Description | -|:-------------|:------|:------------| -| Default | Integer | The default value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html). | +| Parameter | Description | +| :--- | :--- | +| **Min** | The minimum value of the slider range. | +| **Max** | The maximum value of the slider range. | ## Vector 2 @@ -193,3 +173,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~/ShaderGraph-Samples.md b/Packages/com.unity.shadergraph/Documentation~/ShaderGraph-Samples.md index 1afdc48443f..655b96c16ff 100644 --- a/Packages/com.unity.shadergraph/Documentation~/ShaderGraph-Samples.md +++ b/Packages/com.unity.shadergraph/Documentation~/ShaderGraph-Samples.md @@ -6,13 +6,15 @@ The Shader Graph package offers sample Assets, which you can download through ** ## Add samples -To add samples to your Project, go to **Window** > **Package Manager**. Locate **Shader Graph** in the list of available packages, and select it. Under the package description, there is list of available samples. Click the **Import into Project** button next to the sample you wish to add. +To add samples to your project: -![](images/PatternSamples_01.png) +1. In the main menu, go to **Window** > **Package Management** > **Package Manager**. -Unity places imported samples in your Project's Asset folder under **Assets** > **Samples** > **Shader Graph** > **[version number]** > **[sample name]**. The example below shows the samples for **Procedural Patterns**. +1. Select **Shader Graph** from the list of packages. -![](images/PatternSamples_02.png) +1. In the **Samples** section, select **Import** next to a sample. + +1. Open the sample assets from the `Assets/Samples/Shader Graph//` folder. ## Available samples diff --git a/Packages/com.unity.shadergraph/Documentation~/TableOfContents.md b/Packages/com.unity.shadergraph/Documentation~/TableOfContents.md index 299f97a06a1..70a19fea7b6 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,32 +14,32 @@ * [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) + * [Manage keywords](Keywords-manage.md) + * [Keyword parameter reference](Keywords-reference.md) * [Data Types](Data-Types.md) * [Port Bindings](Port-Bindings.md) * [Shader Stage](Shader-Stage.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~/images/PatternSamples_01.png b/Packages/com.unity.shadergraph/Documentation~/images/PatternSamples_01.png deleted file mode 100644 index 6ab8b28d224..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/PatternSamples_01.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/PatternSamples_02.png b/Packages/com.unity.shadergraph/Documentation~/images/PatternSamples_02.png deleted file mode 100644 index 56bebecf884..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/PatternSamples_02.png and /dev/null differ 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..a435b42bfe5 --- /dev/null +++ b/Packages/com.unity.shadergraph/Documentation~/inside-shader-graph.md @@ -0,0 +1,24 @@ +# Inside Shader Graph + +Learn about Shader Graph concepts and features. + +| 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..60a8eaf99fa --- /dev/null +++ b/Packages/com.unity.shadergraph/Documentation~/install-and-upgrade.md @@ -0,0 +1,8 @@ +# Install and upgrade + +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.shadergraph/Editor/Drawing/Blackboard/SGBlackboard.cs b/Packages/com.unity.shadergraph/Editor/Drawing/Blackboard/SGBlackboard.cs index 94db972375f..8dfff8b1d17 100644 --- a/Packages/com.unity.shadergraph/Editor/Drawing/Blackboard/SGBlackboard.cs +++ b/Packages/com.unity.shadergraph/Editor/Drawing/Blackboard/SGBlackboard.cs @@ -189,6 +189,7 @@ public SGBlackboard(BlackboardViewModel viewModel, BlackboardController controll isWindowScrollable = true; isWindowResizable = true; focusable = true; + scrollView.contentContainer.receivesHierarchyGeometryChangedEvents = false; m_DragIndicator = new VisualElement(); m_DragIndicator.name = "categoryDragIndicator"; diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Block-FlipbookPlayer.md b/Packages/com.unity.visualeffectgraph/Documentation~/Block-FlipbookPlayer.md index f37ad385940..9dfda882e6a 100644 --- a/Packages/com.unity.visualeffectgraph/Documentation~/Block-FlipbookPlayer.md +++ b/Packages/com.unity.visualeffectgraph/Documentation~/Block-FlipbookPlayer.md @@ -8,6 +8,8 @@ Flipbook textures are texture sheets that consist of multiple smaller sub-images ![Cloud-shaped blocks representing stages in a sprite sheet.](Images/Block-FlipbookPlayerExampleLHS.png) +A translucent cloud gradually forms, swirls gently, and then dissipates into the background. + To generate a Flipbook, use external digital content creation tools. To set an output to use flipbooks, change its **UV Mode** to **Flipbook**, **Flipbook Blend**, or **Flipbook Motion Blend**. For more information on the different UV Modes, see the documentation for the various output Contexts. diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Context-OutputPrimitive.md b/Packages/com.unity.visualeffectgraph/Documentation~/Context-OutputPrimitive.md index 49023844c98..1d45f63c1f6 100644 --- a/Packages/com.unity.visualeffectgraph/Documentation~/Context-OutputPrimitive.md +++ b/Packages/com.unity.visualeffectgraph/Documentation~/Context-OutputPrimitive.md @@ -5,7 +5,7 @@ Menu Path : **Context > Output Particle [Primitive]** The Output Particle primitives (quad/triangle/octagon) Context are the most commonly-used output types and are great for a wide range of effects. They come in a regular (unlit) and a [Lit](Context-OutputLitSettings.md) variety (HDRP-only). -![](Images/Context-OutputPrimitiveExamples.png) +![From left to right: a 2D coordinate system with color-coded axes: green for the positive Y-axis, red for the positive X-axis, and a blue origin at their intersection represented in different shapes: a square, a triangle, and an octagon.](Images/Context-OutputPrimitiveExamples.png) This Context supports the following planar primitives: diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Context-Spawn.md b/Packages/com.unity.visualeffectgraph/Documentation~/Context-Spawn.md index f2456e3ae7b..74aad6e5a91 100644 --- a/Packages/com.unity.visualeffectgraph/Documentation~/Context-Spawn.md +++ b/Packages/com.unity.visualeffectgraph/Documentation~/Context-Spawn.md @@ -39,7 +39,7 @@ This Context spawns particles within spawn loops. You can specify the number of For a visualization of the looping and delay system, see the below illustration. -![](Images/Context-SpawnVisualization.png) +![A series of color-coded timelines illustrate different behaviors accompanied by a legend defining orange as Delay Before, green as Emission, and pink as Delay After.](Images/Context-SpawnVisualization.png) The lifecycle of the looping phases is split up into [states](https://docs.unity3d.com/ScriptReference/VFX.VFXSpawnerLoopState.html) that the Spawn Context handles internally. The lifecycle is as follows: diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/EventBinders.md b/Packages/com.unity.visualeffectgraph/Documentation~/EventBinders.md index 406f279226e..2827751d111 100644 --- a/Packages/com.unity.visualeffectgraph/Documentation~/EventBinders.md +++ b/Packages/com.unity.visualeffectgraph/Documentation~/EventBinders.md @@ -8,8 +8,6 @@ Event Binders refer to a set of **MonoBehaviour** Scripts that help you trigger The Mouse Event Binder triggers an event in the target Visual Effect based on actions that you perform with the mouse (for example, clicking, hovering, or dragging). -![](Images/EventBinders-Mouse.png) - **Requires:** A Collider on the same GameObject as this component. **Properties:** @@ -25,10 +23,6 @@ The Mouse Event Binder triggers an event in the target Visual Effect based on ac The Rigid Body Collision Event Binder triggers an Event in the target Visual Effect every time something collides with the Rigidbody attached to the same GameObject as this component. This binder also attaches the collision world position to the `position` EventAttribute, and the contact Normal to the `velocity ` EventAttribute. - - -![](Images/EventBinders-RBCollision.png) - **Requires:** A Rigidbody and a Collider on the same GameObject as this component. **Properties:** @@ -42,8 +36,6 @@ The Rigid Body Collision Event Binder triggers an Event in the target Visual Eff The Trigger Event Binder triggers an Event in the target Visual Effect every time a Collider from a list interacts with the attached trigger Collider. This binder also attaches the world position of the Collider instigator to the `position` EventAttribute. -![](Images/EventBinders-Trigger.png) - **Requires:** A Collider with **Is Trigger** set to ` true` on the same GameObject as this component. **Properties:** @@ -59,8 +51,6 @@ The Trigger Event Binder triggers an Event in the target Visual Effect every tim The Visibility Event Binder triggers an Event in the target Visual Effect every time the Renderer attached to this GameObject becomes visible or invisible. -![](Images/EventBinders-Visibility.png) - **Requires:** A Renderer on the same GameObject as this component. **Properties:** diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Events.md b/Packages/com.unity.visualeffectgraph/Documentation~/Events.md index d3c9d2386d2..6e5b59bddb3 100644 --- a/Packages/com.unity.visualeffectgraph/Documentation~/Events.md +++ b/Packages/com.unity.visualeffectgraph/Documentation~/Events.md @@ -7,7 +7,7 @@ Events define the inputs for a Visual Effect Graph's [**processing** workflow](G ## Creating Events -![](Images/EventContexts.png) +![Left: Two Events, one connected to the Start slot, and the other to the Stop slot, of a Spawn nod. Right: An Event connected to the Start slot of another Spawn nod.](Images/EventContexts.png) In general, an Event is just a string that represents the Event's name. To receive an Event in the Visual Effect Graph, create an Event [Context](Contexts.md) and type the name of the Event you want to receive in the **Event Name** property. Event Contexts have no input flow ports and can only connect their output flow port to Spawn or Initialize Contexts. @@ -55,4 +55,4 @@ GPU Events are Event Contexts that rely on data sent from other systems, for exa To gather data from the parent particle, a child system must refer to [Source Attributes](Attributes.md) in its Initialize Context. To do this, a child system can use a **Get Source Attribute** Operator, or an **Inherit Attribute** Block. For a visual example, see the image below. -![](Images/GPUEvent.png)*In this example, the child System inherits the source position of the particle that creates it. It also inherit roughly 50% of the parent particle's speed.* +![An Initialize Particle node is connected to an Update Particle node, which is connected to a GPUEvent nove, itself connected to another Initialize Particle node.](Images/GPUEvent.png)*In this example, the child System inherits the source position of the particle that creates it. It also inherit roughly 50% of the parent particle's speed.* diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/Block-FlipbookPlayerExampleRHS.gif b/Packages/com.unity.visualeffectgraph/Documentation~/Images/Block-FlipbookPlayerExampleRHS.gif deleted file mode 100644 index d9c204b4e4c..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Documentation~/Images/Block-FlipbookPlayerExampleRHS.gif and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/Block-FlipbookPlayerExampleRHS.mp4 b/Packages/com.unity.visualeffectgraph/Documentation~/Images/Block-FlipbookPlayerExampleRHS.mp4 new file mode 100644 index 00000000000..86dd47864bc --- /dev/null +++ b/Packages/com.unity.visualeffectgraph/Documentation~/Images/Block-FlipbookPlayerExampleRHS.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c7a3aa7cb00493d1ba487ef973a6101c0e09e982f183acb0cb37c1124c789e05 +size 27264 diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/EventBinders-Mouse.png b/Packages/com.unity.visualeffectgraph/Documentation~/Images/EventBinders-Mouse.png deleted file mode 100644 index 205bde5fe7e..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Documentation~/Images/EventBinders-Mouse.png and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/EventBinders-RBCollision.png b/Packages/com.unity.visualeffectgraph/Documentation~/Images/EventBinders-RBCollision.png deleted file mode 100644 index 7038297db43..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Documentation~/Images/EventBinders-RBCollision.png and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/EventBinders-Trigger.png b/Packages/com.unity.visualeffectgraph/Documentation~/Images/EventBinders-Trigger.png deleted file mode 100644 index 2490f0a611e..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Documentation~/Images/EventBinders-Trigger.png and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/EventBinders-Visibility.png b/Packages/com.unity.visualeffectgraph/Documentation~/Images/EventBinders-Visibility.png deleted file mode 100644 index 4b079a2d9bb..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Documentation~/Images/EventBinders-Visibility.png and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/LearningSamplePackage.png b/Packages/com.unity.visualeffectgraph/Documentation~/Images/LearningSamplePackage.png deleted file mode 100644 index c21d693a7b9..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Documentation~/Images/LearningSamplePackage.png and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/LearningSample_Hierarchy_VFX.png b/Packages/com.unity.visualeffectgraph/Documentation~/Images/LearningSample_Hierarchy_VFX.png deleted file mode 100644 index f24470e47f0..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Documentation~/Images/LearningSample_Hierarchy_VFX.png and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/LearningSample_ShowcaseInspector.png b/Packages/com.unity.visualeffectgraph/Documentation~/Images/LearningSample_ShowcaseInspector.png deleted file mode 100644 index efb36ec46e1..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Documentation~/Images/LearningSample_ShowcaseInspector.png and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/LearningSample_ShowcaseSample.png b/Packages/com.unity.visualeffectgraph/Documentation~/Images/LearningSample_ShowcaseSample.png deleted file mode 100644 index 619ed328816..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Documentation~/Images/LearningSample_ShowcaseSample.png and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/LearningSample_WindowTemplate.png b/Packages/com.unity.visualeffectgraph/Documentation~/Images/LearningSample_WindowTemplate.png deleted file mode 100644 index dc0d508d89d..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Documentation~/Images/LearningSample_WindowTemplate.png and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/PointCacheImporter.png b/Packages/com.unity.visualeffectgraph/Documentation~/Images/PointCacheImporter.png deleted file mode 100644 index 8f543b8c124..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Documentation~/Images/PointCacheImporter.png and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatNew_17_FlipbookPLayer.png b/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatNew_17_FlipbookPLayer.png deleted file mode 100644 index 4e03f69209a..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatNew_17_FlipbookPLayer.png and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatNew_17_NodeSearchBanner.png b/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatNew_17_NodeSearchBanner.png deleted file mode 100644 index c2480c5734a..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatNew_17_NodeSearchBanner.png and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatNew_17_PositionShape.png b/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatNew_17_PositionShape.png deleted file mode 100644 index b5a69dcf26d..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatNew_17_PositionShape.png and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatNew_17_TriggerCollide.png b/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatNew_17_TriggerCollide.png deleted file mode 100644 index b29b02c3eaa..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatNew_17_TriggerCollide.png and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_16_HLSL.gif b/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_16_HLSL.gif deleted file mode 100644 index ebce9ee1e1d..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_16_HLSL.gif and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_16_HLSL.mp4 b/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_16_HLSL.mp4 new file mode 100644 index 00000000000..8527b764dc7 --- /dev/null +++ b/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_16_HLSL.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:887636f070f2ef6e2b1e70dff326c3cad6dd87340b9d403fc94cfa05f31efd7c +size 572687 diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_16_TemplateWin.png b/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_16_TemplateWin.png deleted file mode 100644 index c0f50ef3b3b..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_16_TemplateWin.png and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_16_TemplateWindow.gif b/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_16_TemplateWindow.gif deleted file mode 100644 index 72d8586db1b..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_16_TemplateWindow.gif and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_16_TemplateWindow.mp4 b/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_16_TemplateWindow.mp4 new file mode 100644 index 00000000000..163d3ae49eb --- /dev/null +++ b/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_16_TemplateWindow.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd8cf8cb933a9ace8431884b8513e62993a0646c2c407c8836df018b15e180cf +size 465075 diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_16_URPDecalOutput.gif b/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_16_URPDecalOutput.gif deleted file mode 100644 index 3822c4abd77..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_16_URPDecalOutput.gif and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_16_URPDecalOutput.mp4 b/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_16_URPDecalOutput.mp4 new file mode 100644 index 00000000000..f60605ac52a --- /dev/null +++ b/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_16_URPDecalOutput.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:793dc164785bd3cc9a194fc3cac31c0b850814445027765405836fdde4cc8c51 +size 143418 diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_16_URP_SmokeLighting.gif b/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_16_URP_SmokeLighting.gif deleted file mode 100644 index 9f5680f9e9f..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_16_URP_SmokeLighting.gif and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_16_URP_SmokeLighting.mp4 b/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_16_URP_SmokeLighting.mp4 new file mode 100644 index 00000000000..74a48cc9393 --- /dev/null +++ b/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_16_URP_SmokeLighting.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:429eb19bc883ae161eeafbf86272fd67a2fd585d3e32d5aa743ec8edf29b5ff3 +size 4802668 diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_17_ATTBanner.png b/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_17_ATTBanner.png deleted file mode 100644 index 6ba0a8a56e8..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_17_ATTBanner.png and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_17_DebugTools_A.png b/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_17_DebugTools_A.png deleted file mode 100644 index f6f06eecf28..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_17_DebugTools_A.png and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_17_DebugTools_Banner.png b/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_17_DebugTools_Banner.png deleted file mode 100644 index 66ae5bdf0d8..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_17_DebugTools_Banner.png and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_17_Shortcut.png b/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_17_Shortcut.png deleted file mode 100644 index 2380397f025..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Documentation~/Images/WhatsNew_17_Shortcut.png and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/auto-attach.png b/Packages/com.unity.visualeffectgraph/Documentation~/Images/auto-attach.png deleted file mode 100644 index 20bd34c8560..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Documentation~/Images/auto-attach.png and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/blackboard.png b/Packages/com.unity.visualeffectgraph/Documentation~/Images/blackboard.png deleted file mode 100644 index c96e02dfa34..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Documentation~/Images/blackboard.png and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/compile.png b/Packages/com.unity.visualeffectgraph/Documentation~/Images/compile.png deleted file mode 100644 index 61701d74512..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Documentation~/Images/compile.png and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/help.png b/Packages/com.unity.visualeffectgraph/Documentation~/Images/help.png deleted file mode 100644 index 279ba969880..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Documentation~/Images/help.png and /dev/null differ 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~/Images/save.png b/Packages/com.unity.visualeffectgraph/Documentation~/Images/save.png deleted file mode 100644 index 7fa8b42de60..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Documentation~/Images/save.png and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/version-control.png b/Packages/com.unity.visualeffectgraph/Documentation~/Images/version-control.png deleted file mode 100644 index 917620db03f..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Documentation~/Images/version-control.png and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/vfx-control.png b/Packages/com.unity.visualeffectgraph/Documentation~/Images/vfx-control.png deleted file mode 100644 index eda3e9d2b10..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Documentation~/Images/vfx-control.png and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Images/vfx-toolbar.png b/Packages/com.unity.visualeffectgraph/Documentation~/Images/vfx-toolbar.png deleted file mode 100644 index d61ee40baa1..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Documentation~/Images/vfx-toolbar.png and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Operator-LogicNor.md b/Packages/com.unity.visualeffectgraph/Documentation~/Operator-LogicNor.md index 2e7419f1b98..f95b1442e94 100644 --- a/Packages/com.unity.visualeffectgraph/Documentation~/Operator-LogicNor.md +++ b/Packages/com.unity.visualeffectgraph/Documentation~/Operator-LogicNor.md @@ -19,4 +19,4 @@ The **Nor** Operator takes two inputs and outputs the result of a logical *nor* This Operator provides the same result as the following graph : -![](Images/Operator-NorComparisonGraph.png) +![Two inputs connected to a central "Nor" operator, with the output flowing to the right.](Images/Operator-NorComparisonGraph.png) diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/Operator-Smoothstep.md b/Packages/com.unity.visualeffectgraph/Documentation~/Operator-Smoothstep.md index 3117dff7b19..e39a3b5848c 100644 --- a/Packages/com.unity.visualeffectgraph/Documentation~/Operator-Smoothstep.md +++ b/Packages/com.unity.visualeffectgraph/Documentation~/Operator-Smoothstep.md @@ -12,7 +12,7 @@ This Operator returns a value between 0 and 1, depending on the value of **X**, This Operator accepts input values of various types. For the list of types this Operator can use, see [Available Types](#available-types). The **X** and **Y** input are always of the same type. **S** changes to be the same type as **X** and **Y**. -![](Images/Operator-SmoothstepDiagram.png) +![The Smoothstep function, where the output value transitions smoothly from 0 to 1 between two input thresholds (Min and Max), forming an S-shaped curve.](Images/Operator-SmoothstepDiagram.png) ## Operator properties diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/TableOfContents.md b/Packages/com.unity.visualeffectgraph/Documentation~/TableOfContents.md index b38d5535df5..2b06c2d3471 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) @@ -53,6 +54,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~/VisualEffectGraphWindow.md b/Packages/com.unity.visualeffectgraph/Documentation~/VisualEffectGraphWindow.md index a408d611bac..fd23b9f8755 100644 --- a/Packages/com.unity.visualeffectgraph/Documentation~/VisualEffectGraphWindow.md +++ b/Packages/com.unity.visualeffectgraph/Documentation~/VisualEffectGraphWindow.md @@ -28,18 +28,17 @@ Inside the Visual Effect Graph window, there are multiple zones and panels. The Visual Effect Graph window Toolbar contains functionality to operate on a Visual Effect Graph Asset. -![Toolbar](Images/vfx-toolbar.png) - | Item | Description | | --------------------- | ------------------------------------------------------------ | -| **Save**
                  ![Save section](Images/save.png) | **Action** : Use this button to save the Visual Effect Graph that is currently open and its subgraphs.
                  **Dropdown**:

                  • **Save as…**: Saves the Visual Effect Graph under a specified name and/or location.
                  • **Show in Inspector**: Focuses the Visual Effect Graph's Asset in the Inspector.| -| **Compile**
                  ![Compile section](Images/compile.png) | **Action** : Recompiles the open Visual Effect Graph.
                  **Dropdown**:

                  • **Auto Compile**: Automatically compiles the Visual Effect Graph.
                  • **Auto Reinit**: Automatically reinitializes an attached component when a value changes in the **Spawner** or **Init** contexts.
                  • **Prewarm Time**: Specifies the duration of the prewarm used with **Auto Reinit**. If the VFX already has a runtime prewarm, it ignores this setting.
                  •**Runtime Mode**: Forces optimized compilation, even when the editor is open.
                  • **Shader Debug Symbols**: Forces shader debug symbols generation when Unity compiles the authored VFX asset.
                  • **Shader Validation**: Forces shader compilation when the effect recompiles, even if no visual effect is visible. This displays the Shader errors in the Scene.| -| **Auto Attach**
                  ![Auto Attach section](Images/auto-attach.png) | **Toggle**: Toggles the visibility of the Auto Attachment panel. The **Auto Attachment** panel allows you to attach the open Visual Effect Graph to a GameObject by selecting it in the Hierarchy. Once you have attached the visual effect to a GameObject, it enables the Visual Effect controls in the VFX Control panel and allows you to tweak gizmos in the Scene View.| +| **Save** | **Action** : Use this button to save the Visual Effect Graph that is currently open and its subgraphs.

                  **Dropdown**:
                  • **Save as…**: Saves the Visual Effect Graph under a specified name and/or location.
                  • **Show in Inspector**: Focuses the Visual Effect Graph's Asset in the Inspector.
                  | +| **Compile** | **Action** : Recompiles the open Visual Effect Graph.
                  **Dropdown**:

                  • **Auto Compile**: Automatically compiles the Visual Effect Graph.
                  • **Auto Reinit**: Automatically reinitializes an attached component when a value changes in the **Spawner** or **Init** contexts.
                  • **Prewarm Time**: Specifies the duration of the prewarm used with **Auto Reinit**. If the VFX already has a runtime prewarm, it ignores this setting.
                  •**Runtime Mode**: Forces optimized compilation, even when the editor is open.
                  • **Shader Debug Symbols**: Forces shader debug symbols generation when Unity compiles the authored VFX asset.
                  • **Shader Validation**: Forces shader compilation when the effect recompiles, even if no visual effect is visible. This displays the Shader errors in the Scene.| +| **Auto Attach** | **Toggle**: Toggles the visibility of the Auto Attachment panel. The **Auto Attachment** panel allows you to attach the open Visual Effect Graph to a GameObject by selecting it in the Hierarchy. Once you have attached the visual effect to a GameObject, it enables the Visual Effect controls in the VFX Control panel and allows you to tweak gizmos in the Scene View.| | **Lock** | **Toggle**: Toggles lock/unlock for auto attachments. If you set the toggle to unlocked - you can attach the open Visual Effect Graph to a GameObject by selecting items in the Hierarchy. If you set the toggle to locked - The GameObject that is currently attached becomes locked and auto attachments are disabled. The Visual Effect Graph then can not be attached by selecting items in the Hierarchy. You can manually keep the lock and change the attachment in the object picker of the Auto Attach panel.| -| **Blackboard**
                  ![Blackboard section](Images/blackboard.png) | **Toggle**: Toggles the visibility of the **Blackboard Panel**.| -| **VFX Control**
                  ![VFX Control section](Images/vfx-control.png) | **Toggle**: Toggles the visibility of the VFX Control.| -| **Help**
                  ![Help section](Images/help.png) | **Toggle**: Opens the Visual Effect Graph [manual](https://docs.unity3d.com/Packages/com.unity.visualeffectgraph@latest/).

                  **Dropdown**:

                  **VFX Graph Additions**: Installs pre-made visual effects and utility operators made with Visual Effect Graph. These include Bonfire, Lightning, Smoke and Sparks effect examples. There are also various operators and Subgraph Blocks:

                  • **Get Strip Progress**: A subgraph that calculates the progress of a particle in the strip in the range 0 to 1. You can use this to sample curves and gradients to modify the strip based on its progress.

                  • **Encompass (Point)**: A subgraph that grows the bounds of an AABox to encompass a point.

                  • **Degrees to Radians and Radians to Degrees**: Subgraphs that help you to convert between radians and degrees within your graph.

                  **Output Event Helpers**: This version of the Visual Effect Graph introduces new helper scripts to the OutputEvent Helpers sample to help you to set up OutputEvents:

                  • **Cinemachine Camera Shake**: An Output Event Handler script that triggers a Camera shake through a [Cinemachine Impulse Source](https://docs.unity3d.com/Packages/com.unity.cinemachine@latest/index.html?subfolder=/manual/CinemachineImpulseSourceOverview.html), on a given output event.

                  • **Play audio**: An Output Event Handler script that plays a single AudioSource on a given output event.

                  • **Spawn a Prefab**: An Output Event Handler script that spawns Prefabs (managed from a pool) on a given output event. It uses position, angle, scale, and lifetime to position the Prefab and disable it after a delay. To synchronize other values, you can use other scripts inside the Prefab:

                  • **Change Prefab Light**: An example that demonstrates how to synchronize a light with your effect.

                  • **Change Prefab RigidBody Velocity**: An example that demonstrates how to synchronize changing the velocity of a RigidBody with your effect.

                  • **RigidBody**: An Output Event Handler script that applies a force or velocity change to a RigidBody on a given output event.

                  • **Unity Event**: An Output Event Handler that raises a UnityEvent on a given output event.

                  • **[VFX Graph Home](https://unity.com/visual-effect-graph)**: Opens the Visual Effect Graph home page.

                  • **[Forum](https://forum.unity.com/forums/visual-effect-graph.428/)**: Opens a Visual Effect Graph sub-forum.

                  • **[Github] [Spaceship Demo](https://github.com/Unity-Technologies/SpaceshipDemo)**: Opens a repository of AAA Playable First person demo showcasing effects made with Visual Effect Graph and rendered with the High Definition Render Pipeline.

                  • **[Github] [VFX Graph Samples](https://github.com/Unity-Technologies/VisualEffectGraph-Samples)**: Opens a repository that contains sample scenes and visual effects made with Visual Effect Graph.| -| **Version Control**
                  ![Version Control section](Images/version-control.png) | **Action**: When you enable [Version Control](https://docs.unity3d.com/Manual/Versioncontrolintegration.html), these buttons become available. Click the main button to check out the changes you made in the asset file.

                  **Dropdown**:

                  • **Get Latest**: Updates the asset file with latest changes from the repository.
                  • **Submit**: Submits the current state of the asset to the Version Control System.
                  • **Revert**: Discards the changes you made to the asset.| +| **Blackboard** | **Toggle**: Toggles the visibility of the **Blackboard Panel**.| +| **VFX Control** | **Toggle**: Toggles the visibility of the VFX Control.| +| **Debug** | Opens the [Profiling and Debug Panels](performance-debug-panel.md).| +| **Help** | **Toggle**: Opens the Visual Effect Graph [manual](https://docs.unity3d.com/Packages/com.unity.visualeffectgraph@latest/).

                  **Dropdown**:

                  **VFX Graph Additions**: Installs pre-made visual effects and utility operators made with Visual Effect Graph. These include Bonfire, Lightning, Smoke and Sparks effect examples. There are also various operators and Subgraph Blocks:

                  • **Get Strip Progress**: A subgraph that calculates the progress of a particle in the strip in the range 0 to 1. You can use this to sample curves and gradients to modify the strip based on its progress.

                  • **Encompass (Point)**: A subgraph that grows the bounds of an AABox to encompass a point.

                  • **Degrees to Radians and Radians to Degrees**: Subgraphs that help you to convert between radians and degrees within your graph.

                  **Output Event Helpers**: This version of the Visual Effect Graph introduces new helper scripts to the OutputEvent Helpers sample to help you to set up OutputEvents:

                  • **Cinemachine Camera Shake**: An Output Event Handler script that triggers a Camera shake through a [Cinemachine Impulse Source](https://docs.unity3d.com/Packages/com.unity.cinemachine@latest/index.html?subfolder=/manual/CinemachineImpulseSourceOverview.html), on a given output event.

                  • **Play audio**: An Output Event Handler script that plays a single AudioSource on a given output event.

                  • **Spawn a Prefab**: An Output Event Handler script that spawns Prefabs (managed from a pool) on a given output event. It uses position, angle, scale, and lifetime to position the Prefab and disable it after a delay. To synchronize other values, you can use other scripts inside the Prefab:

                  • **Change Prefab Light**: An example that demonstrates how to synchronize a light with your effect.

                  • **Change Prefab RigidBody Velocity**: An example that demonstrates how to synchronize changing the velocity of a RigidBody with your effect.

                  • **RigidBody**: An Output Event Handler script that applies a force or velocity change to a RigidBody on a given output event.

                  • **Unity Event**: An Output Event Handler that raises a UnityEvent on a given output event.

                  • **[VFX Graph Home](https://unity.com/visual-effect-graph)**: Opens the Visual Effect Graph home page.

                  • **[Forum](https://forum.unity.com/forums/visual-effect-graph.428/)**: Opens a Visual Effect Graph sub-forum.

                  • **[Github] [Spaceship Demo](https://github.com/Unity-Technologies/SpaceshipDemo)**: Opens a repository of AAA Playable First person demo showcasing effects made with Visual Effect Graph and rendered with the High Definition Render Pipeline.

                  • **[Github] [VFX Graph Samples](https://github.com/Unity-Technologies/VisualEffectGraph-Samples)**: Opens a repository that contains sample scenes and visual effects made with Visual Effect Graph.| +| **Version Control** | **Action**: When you enable [Version Control](https://docs.unity3d.com/Manual/Versioncontrolintegration.html), these buttons become available. Click the main button to check out the changes you made in the asset file.

                  **Dropdown**:

                  • **Get Latest**: Updates the asset file with latest changes from the repository.
                  • **Submit**: Submits the current state of the asset to the Version Control System.
                  • **Revert**: Discards the changes you made to the asset.| ### Node Workspace @@ -53,7 +52,7 @@ The **Blackboard** is a panel that allows you to manage properties that the Visu To resize this panel, click on any edge or corner and drag. To reposition this panel, click on the header of the panel and drag. -For more information, see [Blackboard](Blackboard.md). +For more information, refer to [Blackboard](Blackboard.md). ### VFX Control @@ -63,7 +62,7 @@ The VFX Control panel displays the controls for the GameObject it is currently a * Control playback options * Trigger Events * Use Debug Modes -* Record the bounds of the visual effect. For more information about bounds recording, see [Visual effect bounds](visual-effect-bounds.md). +* Record the bounds of the visual effect. For more information about bounds recording, refer to [Visual effect bounds](visual-effect-bounds.md). It is a floating panel that is independent of the zoom and position of the current Workspace view. The window always displays this panel on top of Nodes in the **Node Workspace**. 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~/point-cache-in-vfx-graph.md b/Packages/com.unity.visualeffectgraph/Documentation~/point-cache-in-vfx-graph.md index 6291fc2b721..d342d8ad4ec 100644 --- a/Packages/com.unity.visualeffectgraph/Documentation~/point-cache-in-vfx-graph.md +++ b/Packages/com.unity.visualeffectgraph/Documentation~/point-cache-in-vfx-graph.md @@ -18,13 +18,11 @@ A Point Cache stores data in attribute maps. An attribute map is a list of value Unity imports and stores Point Caches as an asset. Point Cache assets follow the open-source [Point Cache](https://github.com/peeweek/pcache/blob/master/README.md) specification and use the `.pCache` file extension. They have no public properties to edit in the Inspector, but they do display read-only information such as the number of particles and the textures that represent the particle properties. For more information about Point Cache assets and a description of the properties they display in the Inspector, see [Point Cache asset](point-cache-asset.md). -![](Images/PointCacheImporter.png) - ## Using Point Caches The [Point Cache Operator](Operator-PointCache.md) enables you to use Point Caches in visual effects. This Operator extracts the number of particles and their attributes from the Point Cache asset and exposes them as output ports in the Operator. You can then connect the ports to other Nodes, such as the [Set \ from Map](Block-SetAttributeFromMap.md) Block. -![](Images/PointCacheOperator.png) +![The Point Cache Operator extracting particle counts and attributes from a Point Cache asset, then outputting them as ports to be connected to other nodes.](Images/PointCacheOperator.png) ## Generating Point Caches diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/sample-learningTemplates.md b/Packages/com.unity.visualeffectgraph/Documentation~/sample-learningTemplates.md index cf47c281262..484b500b770 100644 --- a/Packages/com.unity.visualeffectgraph/Documentation~/sample-learningTemplates.md +++ b/Packages/com.unity.visualeffectgraph/Documentation~/sample-learningTemplates.md @@ -1,6 +1,6 @@ # Learning Templates Sample Content - + The Learning Templates sample is a collection of VFX assets designed to help you learn about VFX Graph concepts and features. This collection will be updated based on community feedback and new features. This page provides instructions on how to install the sample, a brief overview of the content, and how to make the most of it. @@ -23,13 +23,9 @@ To install this sample, first [install the Visual Effect Graph](https://docs.uni 1. In the main window that displays the package's details, find the **Samples** section. 1. To import the sample into your project, click **Import**. This creates a folder called `Samples` in your project, and imports the sample you selected into it. Unity imports any future samples into this folder. - - - - ## VFX Learning Templates overview - + To start exploring the content of this sample: @@ -42,7 +38,7 @@ To start exploring the content of this sample: ### Scene overview - +![Left: The Orient Fixed Axis sample in Scene view. Right: The same sample in Game view.](Images/LearningSample_WindowPresentation.png) #### **Hierarchy** @@ -50,15 +46,10 @@ To start exploring the content of this sample: The `Sample_Showcase` GameObject has a script called **Samples Showcase**, which contains a custom Inspector and a dedicated window. Select this GameObject to view information and useful links relative to each VFX in the [Inspector](https://docs.unity3d.com/2023.3/Documentation/Manual/UsingTheInspector.html). - - - 1. **VFX Prefabs**: - Each VFX instance is part of a prefab with a display mesh and some text information. - - 1. **Scene Main Camera**: - This camera is used for the game view, and its viewpoint is controlled by the **Showcase** script. In Play mode, you can freely move the camera around. @@ -69,14 +60,14 @@ To start exploring the content of this sample: - You can use the Scene view to move around freely to find a VFX that interests you. Note that some visual effects require the Editor to be in Play mode. - + 4. **Game View**: - You can use the Game view to focus on each VFX separately, via the Sample Showcase actions that control the camera. If you prefer to explore freely, you can use the Main Camera. - + #### **Inspector** @@ -103,11 +94,6 @@ To open the Sample Showcase window: 1. In the Inspector, select **Open in window**.
                  -

                  - -

                  - - Image key: 1. Drop-down list and button to select which VFX to display in the Sample Showcase window. 1. Links to either highlight the VFX in the Hierarchy, or open it in the VFX editor. @@ -148,14 +134,8 @@ To open a VFX asset, you can do one of the following: 1. Use the drop-down menu or arrow button to select the desired VFX. 1. Select **Open VFX**. - - - - ### Inside a VFX The best way to learn and understand how a VFX has been made is to look inside. Take a look at the different parts of the Graph and the embedded notes. -

                  - -

                  +![A Visual Effect Graph, where particles are spawned, initialized, updated with custom rotation angles, and rendered through one of three mesh outputs—each rotating around a different axis (X, Y, or Z).](Images/LearningSample_StickyNotes.png) 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/Documentation~/whats-new-16.md b/Packages/com.unity.visualeffectgraph/Documentation~/whats-new-16.md index 1414a87c8f0..9e1885f26e1 100644 --- a/Packages/com.unity.visualeffectgraph/Documentation~/whats-new-16.md +++ b/Packages/com.unity.visualeffectgraph/Documentation~/whats-new-16.md @@ -7,23 +7,19 @@ This page contains an overview of new features, improvements, and issues resolve The following is a list of features Unity added to version 16 of the Visual Effect Graph embedded in Unity 2023.2. Each entry includes a summary of the feature and a link to any relevant documentation. ### Custom HLSL -![](Images/WhatsNew_16_HLSL.gif) + Version 16 includes a new [block](https://docs.unity3d.com/Packages/com.unity.visualeffectgraph@16.0/manual/Block-CustomHLSL.html) and [operator](https://docs.unity3d.com/Packages/com.unity.visualeffectgraph@16.0/manual/Operator-CustomHLSL.html) that you can use to write [custom HLSL]( https://docs.unity3d.com/Packages/com.unity.visualeffectgraph@latest/index.html?subfolder=/manual/CustomHLSL-Common.html) code directly in a VFX Graph. You can use this to script complex behavior in a single node. You can embedd custom HLSL code in the node or load it from an external file to reuse the code. ### Templates window -![](Images/WhatsNew_16_TemplateWindow.gif) + VFX Graph 16 adds a [template window](https://docs.unity3d.com/Packages/com.unity.visualeffectgraph@16.0/manual/Templates-window.html) to add a VFX templates into an existing VFX Graph. This window has multiple templates to quickly create a VFX Graph. You can also create a [custom template](https://docs.unity3d.com/Packages/com.unity.visualeffectgraph@16.0/manual/Templates-window.html#create-a-custom-vfx-graph-template). -drawing -

                  - -

                  - ### URP Decal output -![](Images/WhatsNew_16_URPDecalOutput.gif) + VFX Graph version 16 adds the Lit Decal output for your Universal Render Pipeline (URP) project. Use this output to use lit particle decals in a URP project. ### Six Way Smoke for URP and Shader Graph -![](Images/WhatsNew_16_URP_SmokeLighting.gif) + + Version 16 makes the smoke lighting model compatible with URP [Lit Outputs](https://docs.unity3d.com/Packages/com.unity.visualeffectgraph@16.0/manual/Context-OutputLitSettings.html) and [Shader Graph](https://docs.unity3d.com/Packages/com.unity.visualeffectgraph@16.0/manual/sg-working-with.html). This means that you can use lightmaps exported from third-party software to create advanced custom shaders to light a smoke texture in URP and HDRP. diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/whats-new-17.md b/Packages/com.unity.visualeffectgraph/Documentation~/whats-new-17.md index 36b77d0ca38..b05aae2918e 100644 --- a/Packages/com.unity.visualeffectgraph/Documentation~/whats-new-17.md +++ b/Packages/com.unity.visualeffectgraph/Documentation~/whats-new-17.md @@ -8,22 +8,16 @@ The following is a list of features Unity added to version 17 of the Visual Effe ### URP Camera Buffer - + You can now sample URP camera buffers to obtain the scene's depth and color. This powerful feature allows you to perform fast [collision on the GPU](https://docs.unity3d.com/Packages/com.unity.visualeffectgraph@17.0/manual/Block-CollideWithDepthBuffer.html) or to [spawn particles against the depth buffer](https://docs.unity3d.com/Packages/com.unity.visualeffectgraph@17.0/manual/Block-SetPosition(Depth).html) and inherit the scene color. ### Profiling Tools -drawing - You can use the new [Debug panel](https://docs.unity3d.com/Packages/com.unity.visualeffectgraph@17.0/manual/Templates-window.html) to check and optimize performance directly inside your graph. The Debug panel can display GPU and CPU timing, data related to GPU memory storage and texture usage, and the current system state.   -drawing - ### Attribute Blackboard -drawing - The [Blackboard panel](https://docs.unity3d.com/Packages/com.unity.visualeffectgraph@17.0/manual/Blackboard.html) now has a new [section](https://docs.unity3d.com/Packages/com.unity.visualeffectgraph@17.0/manual/Blackboard.html#using-the-blackboard) dedicated to particle attributes, making them easier to manipulate with drag and drop. - Drag and drop from the blackboard to “Set” or “Get” an attribute. @@ -33,31 +27,27 @@ The [Blackboard panel](https://docs.unity3d.com/Packages/com.unity.visualeffectg - Access to the description and type of the built-in attribute. - + ### VFX Learning Sample - + The [VFX Learning Sample](sample-learningTemplates.md) is a new content sample aiming to help you learn VFX Graph concepts and features. This evolving collection of assets is packed with VFX examples along with information, embedded explanations, and documentation links related to the features and VFX Graph's aspects highlighted by the VFX assets. -drawing - ### Shader Graph Keyword Support - + Version 17 adds keyword support for [Shader Graph outputs](https://docs.unity3d.com/Packages/com.unity.visualeffectgraph@17.0/manual/Context-OutputForwardDecal.html) in VFX Graph. This will help you create parametric [shader graphs](https://docs.unity3d.com/Packages/com.unity.shadergraph@17.0/manual/index.html) that you can use and customize directly from the VFX Graph output contexts. ### Keyboard Shortcuts -drawing - The [Shortcut Manager](https://docs.unity3d.com/2023.3/Documentation/Manual/ShortcutsManager.html) now has a VFX Graph category that lets you modify the shortcut command available in the Visual Effect Graph window. Additionally, new shortcut commands have been added to be able to speed up the VFX artist's workflow. ## Updated - + The following is a list of improvements Unity made to the Visual Effect Graph in version 17, embedded in Unity 6. Each entry includes a summary of the improvement and, if relevant, a link to any documentation. @@ -69,12 +59,10 @@ The following is a list of improvements Unity made to the Visual Effect Graph in - Enhanced collision stability. - Improved collision accuracy. - + ### Node Search: -drawing - The visual and structure of the [node search](https://docs.unity3d.com/Packages/com.unity.visualeffectgraph@17.0/manual/VisualEffectGraphWindow.html) have been revised to provide a hierarchical tree view, facilitating a more efficient browsing of the block library. Also, a side panel, search filtering, custom colors and a favorite folder have been added to this tool to enhance the search and browsing experience. - Hierarchical tree view. @@ -93,8 +81,6 @@ New options have been added to make the [Flipbook Player](https://docs.unity3d.c - Automatically pick up the Flipbook size from the output context. - Animation Curve. - - ### Trigger Event Blocks: [Trigger blocks](https://docs.unity3d.com/Packages/com.unity.visualeffectgraph@17.0/manual/Block-TriggerEventRate.html) have been merged into one block, giving you the ability to easily change the spawn event behavior without creating a new block. @@ -102,8 +88,6 @@ New options have been added to make the [Flipbook Player](https://docs.unity3d.c - New [trigger event on collide](https://docs.unity3d.com/Packages/com.unity.visualeffectgraph@17.0/manual/Block-TriggerEventRate.html) block. - Trigger event blocks are now compatible with the spawn context. - - ### Position Shape Blocks: [Position on Shape](https://docs.unity3d.com/Packages/com.unity.visualeffectgraph@17.0/manual/Block-SetPosition(Sphere).html) blocks have been merged into one block so that you can easily switch between shapes without the need to recreate another block. @@ -111,6 +95,5 @@ New options have been added to make the [Flipbook Player](https://docs.unity3d.c - New [oriented box](https://docs.unity3d.com/Packages/com.unity.visualeffectgraph@17.0/manual/Block-SetPosition(AABox).html) shape. - New [arc sequencer](https://docs.unity3d.com/Packages/com.unity.visualeffectgraph@17.0/manual/Block-SetPosition(Sphere).html#block-properties) setting on the sphere shape. - 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/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