From 5330a16ffe36a79429cb7deeb8d726c9b303e0cf Mon Sep 17 00:00:00 2001 From: Emmanuel Turquin Date: Fri, 15 May 2020 18:22:26 +0200 Subject: [PATCH 1/8] Multiview (scene + game) path tracing accumulation. --- .../Accumulation/SubFrameManager.cs | 133 ++++++++++++------ .../RenderPipeline/PathTracing/PathTracing.cs | 66 ++++----- 2 files changed, 125 insertions(+), 74 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/SubFrameManager.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/SubFrameManager.cs index 12f1acbb47f..9e281313efa 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/SubFrameManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/SubFrameManager.cs @@ -1,4 +1,6 @@ using System; +using System.Linq; +using System.Collections.Generic; using UnityEngine.Experimental.Rendering; #if UNITY_EDITOR @@ -7,12 +9,30 @@ namespace UnityEngine.Rendering.HighDefinition { + // Struct storing per-camera data, to handle accumulation and dirtiness + internal struct CameraData + { + public void ResetIteration() + { + accumulatedWeight = 0; + currentIteration = 0; + } + + public uint width; + public uint height; + public bool skyEnabled; + public bool fogEnabled; + + public float accumulatedWeight; + public uint currentIteration; + } + // Helper class to manage time-scale in Unity when recording multi-frame sequences where one final frame is an accumulation of multiple sub-frames internal class SubFrameManager { // Shutter settings float m_ShutterInterval = 0.0f; - bool m_Centered = true; + bool m_Centered = true; float m_ShutterFullyOpen = 0.0f; float m_ShutterBeginsClosing = 1.0f; @@ -21,8 +41,26 @@ internal class SubFrameManager // Internal state float m_OriginalTimeScale = 0; float m_OriginalFixedDeltaTime = 0; - bool m_IsRenderingTheFirstFrame = true; - float m_AccumulatedWeight = 0; + bool m_IsRenderingTheFirstFrame = true; + + // Per-camera data cache + Dictionary m_CameraCache = new Dictionary(); + + internal CameraData GetCameraData(int camID) + { + CameraData camData; + if (!m_CameraCache.TryGetValue(camID, out camData)) + { + camData.ResetIteration(); + m_CameraCache.Add(camID, camData); + } + return camData; + } + + internal void SetCameraData(int camID, CameraData camData) + { + m_CameraCache[camID] = camData; + } // The number of sub-frames that will be used to reconstruct a converged frame public uint subFrameCount @@ -32,13 +70,6 @@ public uint subFrameCount } uint m_AccumulationSamples = 0; - // The sequence number of the current sub-frame - public uint iteration - { - get { return m_CurrentIteration; } - } - uint m_CurrentIteration = 0; - // True when a recording session is in progress public bool isRecording { @@ -47,18 +78,28 @@ public bool isRecording bool m_IsRecording = false; // Resets the sub-frame sequence + internal void Reset(int camID) + { + CameraData camData = GetCameraData(camID); + camData.ResetIteration(); + SetCameraData(camID, camData); + } internal void Reset() { - m_CurrentIteration = 0; - m_AccumulatedWeight = 0; + foreach (int camID in m_CameraCache.Keys.ToList()) + Reset(camID); } - - // Advances the sub-frame sequence - internal void Advance() + internal void SelectiveReset(uint maxSamples) { - // Increment the iteration counter, if we haven't converged yet - if (m_CurrentIteration < m_AccumulationSamples) - m_CurrentIteration++; + foreach (int camID in m_CameraCache.Keys.ToList()) + { + CameraData camData = GetCameraData(camID); + if (camData.currentIteration >= maxSamples) + { + camData.ResetIteration(); + SetCameraData(camID, camData); + } + } } void Init(int samples, float shutterInterval) @@ -67,7 +108,6 @@ void Init(int samples, float shutterInterval) m_ShutterInterval = samples > 1 ? shutterInterval : 0; m_IsRecording = true; m_IsRenderingTheFirstFrame = true; - Reset(); m_OriginalTimeScale = Time.timeScale; @@ -106,14 +146,16 @@ internal void EndRecording() } // Should be called before rendering a new frame in a sequence (when accumulation is desired) - internal void PrepareNewSubFrame() + internal void PrepareNewSubFrame(int camID) { - if (m_CurrentIteration == m_AccumulationSamples) + CameraData camData = GetCameraData(camID); + + if (camData.currentIteration == m_AccumulationSamples) { - Reset(); + Reset(camID); } - if (m_CurrentIteration == m_AccumulationSamples - 1) + if (camData.currentIteration == m_AccumulationSamples - 1) { Time.timeScale = m_OriginalTimeScale * (1.0f - m_ShutterInterval); m_IsRenderingTheFirstFrame = false; @@ -167,24 +209,23 @@ float ShutterProfile(float time) // y: sum of weights until now, without the current frame // z: one over the sum of weights until now, including the current frame // w: unused - internal Vector4 GetFrameWeights() + internal Vector4 ComputeFrameWeights(int camID) { - float totalWeight = m_AccumulatedWeight; - float time = m_AccumulationSamples > 0 ? (float) m_CurrentIteration / m_AccumulationSamples : 0.0f; + CameraData camData = GetCameraData(camID); + + float totalWeight = camData.accumulatedWeight; + float time = m_AccumulationSamples > 0 ? (float) camData.currentIteration / m_AccumulationSamples : 0.0f; float weight = isRecording ? ShutterProfile(time) : 1.0f; - if (m_CurrentIteration < m_AccumulationSamples) - m_AccumulatedWeight += weight; + if (camData.currentIteration < m_AccumulationSamples) + camData.accumulatedWeight += weight; - if (m_AccumulatedWeight > 0) - { - return new Vector4(weight, totalWeight, 1.0f / m_AccumulatedWeight, 0.0f); - } - else - { - return new Vector4(weight, totalWeight, 0.0f, 0.0f); - } + SetCameraData(camID, camData); + + return (camData.accumulatedWeight > 0) ? + new Vector4(weight, totalWeight, 1.0f / camData.accumulatedWeight, 0.0f) : + new Vector4(weight, totalWeight, 0.0f, 0.0f); } } @@ -229,9 +270,9 @@ public void EndRecording() /// /// Should be called during a recording session when preparing to render a new sub-frame of a multi-frame sequence where each final frame is an accumulation of multiple sub-frames. /// - public void PrepareNewSubFrame() + public void PrepareNewSubFrame(HDCamera hdCamera) { - m_SubFrameManager.PrepareNewSubFrame(); + m_SubFrameManager.PrepareNewSubFrame(hdCamera.camera.GetInstanceID()); } void RenderAccumulation(HDCamera hdCamera, CommandBuffer cmd, RTHandle inputTexture, RTHandle outputTexture, bool needsExposure = false) @@ -246,20 +287,28 @@ void RenderAccumulation(HDCamera hdCamera, CommandBuffer cmd, RTHandle inputText if (!accumulationShader) return; - uint currentIteration = m_SubFrameManager.iteration; + // Get the per-camera data + int camID = hdCamera.camera.GetInstanceID(); + Vector4 frameWeights = m_SubFrameManager.ComputeFrameWeights(camID); + CameraData camData = m_SubFrameManager.GetCameraData(camID); // Accumulate the path tracing results int kernel = accumulationShader.FindKernel("KMain"); - cmd.SetGlobalInt(HDShaderIDs._AccumulationFrameIndex, (int)currentIteration); + cmd.SetGlobalInt(HDShaderIDs._AccumulationFrameIndex, (int)camData.currentIteration); cmd.SetGlobalInt(HDShaderIDs._AccumulationNumSamples, (int)m_SubFrameManager.subFrameCount); cmd.SetComputeTextureParam(accumulationShader, kernel, HDShaderIDs._AccumulatedFrameTexture, history); cmd.SetComputeTextureParam(accumulationShader, kernel, HDShaderIDs._CameraColorTextureRW, outputTexture); cmd.SetComputeTextureParam(accumulationShader, kernel, HDShaderIDs._RadianceTexture, inputTexture); - cmd.SetComputeVectorParam(accumulationShader, HDShaderIDs._AccumulationWeights, m_SubFrameManager.GetFrameWeights()); + cmd.SetComputeVectorParam(accumulationShader, HDShaderIDs._AccumulationWeights, frameWeights); cmd.SetComputeIntParam(accumulationShader, HDShaderIDs._AccumulationNeedsExposure, needsExposure ? 1 : 0); cmd.DispatchCompute(accumulationShader, kernel, (hdCamera.actualWidth + 7) / 8, (hdCamera.actualHeight + 7) / 8, hdCamera.viewCount); - m_SubFrameManager.Advance(); + // Increment the iteration counter, if we haven't converged yet + if (camData.currentIteration < m_SubFrameManager.subFrameCount) + { + camData.currentIteration++; + m_SubFrameManager.SetCameraData(camID, camData); + } } } diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs index be059b353ca..363991b12e6 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs @@ -59,11 +59,6 @@ public partial class HDRenderPipeline #endif // UNITY_EDITOR ulong m_CacheAccelSize = 0; uint m_CacheLightCount = 0; - uint m_CacheCameraWidth = 0; - uint m_CacheCameraHeight = 0; - - bool m_CameraSkyEnabled; - bool m_FogEnabled; RTHandle m_RadianceTexture; // stores the per-pixel results of path tracing for this frame @@ -111,12 +106,11 @@ private Vector4 ComputeDoFConstants(HDCamera hdCamera, PathTracing settings) private void OnSceneEdit() { - // If we just change the sample count, we don't want to reset iteration + // If we just change the sample count, we don't necessarily want to reset iteration if (m_PathTracingSettings && m_CacheMaxIteration != m_PathTracingSettings.maximumSamples.value) { m_CacheMaxIteration = (uint) m_PathTracingSettings.maximumSamples.value; - if (m_SubFrameManager.iteration >= m_CacheMaxIteration) - ResetPathTracing(); + m_SubFrameManager.SelectiveReset(m_CacheMaxIteration); } else ResetPathTracing(); @@ -132,7 +126,7 @@ private UndoPropertyModification[] OnUndoRecorded(UndoPropertyModification[] mod private void OnSceneGui(SceneView sv) { if (Event.current.type == EventType.MouseDrag) - ResetPathTracing(); + m_SubFrameManager.Reset(sv.camera.GetInstanceID()); } #endif // UNITY_EDITOR @@ -144,45 +138,53 @@ private void CheckDirtiness(HDCamera hdCamera) return; } - // Check camera clear mode dirtiness - bool enabled = (hdCamera.clearColorMode == HDAdditionalCameraData.ClearColorMode.Sky); - if (enabled != m_CameraSkyEnabled) + // Grab the cached data for the current camera + int camID = hdCamera.camera.GetInstanceID(); + CameraData camData = m_SubFrameManager.GetCameraData(camID); + + // Check camera resolution dirtiness + if (hdCamera.actualWidth != camData.width || hdCamera.actualHeight != camData.height) { - m_CameraSkyEnabled = enabled; - ResetPathTracing(); + camData.width = (uint) hdCamera.actualWidth; + camData.height = (uint) hdCamera.actualHeight; + camData.ResetIteration(); + m_SubFrameManager.SetCameraData(camID, camData); return; } - // Check camera resolution dirtiness - if (hdCamera.actualWidth != m_CacheCameraWidth || hdCamera.actualHeight != m_CacheCameraHeight) + // Check camera sky dirtiness + bool enabled = (hdCamera.clearColorMode == HDAdditionalCameraData.ClearColorMode.Sky); + if (enabled != camData.skyEnabled) { - m_CacheCameraWidth = (uint) hdCamera.actualWidth; - m_CacheCameraHeight = (uint) hdCamera.actualHeight; - ResetPathTracing(); + camData.skyEnabled = enabled; + camData.ResetIteration(); + m_SubFrameManager.SetCameraData(camID, camData); return; } - // Check camera matrix dirtiness - if (hdCamera.mainViewConstants.nonJitteredViewProjMatrix != (hdCamera.mainViewConstants.prevViewProjMatrix)) + // Check camera fog dirtiness + enabled = Fog.IsFogEnabled(hdCamera); + if (enabled != camData.fogEnabled) { - ResetPathTracing(); + camData.fogEnabled = enabled; + camData.ResetIteration(); + m_SubFrameManager.SetCameraData(camID, camData); return; } - // Check fog dirtiness - enabled = Fog.IsFogEnabled(hdCamera); - if (enabled != m_FogEnabled) + // Check camera matrix dirtiness + if (hdCamera.mainViewConstants.nonJitteredViewProjMatrix != (hdCamera.mainViewConstants.prevViewProjMatrix)) { - m_FogEnabled = enabled; - ResetPathTracing(); + camData.ResetIteration(); + m_SubFrameManager.SetCameraData(camID, camData); return; } // Check materials dirtiness if (m_MaterialsDirty) { - ResetPathTracing(); m_MaterialsDirty = false; + ResetPathTracing(); return; } @@ -242,8 +244,8 @@ void RenderPathTracing(HDCamera hdCamera, CommandBuffer cmd, RTHandle outputText m_SubFrameManager.subFrameCount = 1; #endif - uint currentIteration = m_SubFrameManager.iteration; - if (currentIteration < m_SubFrameManager.subFrameCount) + CameraData camData = m_SubFrameManager.GetCameraData(hdCamera.camera.GetInstanceID()); + if (camData.currentIteration < m_SubFrameManager.subFrameCount) { // Define the shader pass to use for the path tracing pass cmd.SetRayTracingShaderPass(pathTracingShader, "PathTracingDXR"); @@ -264,7 +266,7 @@ void RenderPathTracing(HDCamera hdCamera, CommandBuffer cmd, RTHandle outputText cmd.SetGlobalFloat(HDShaderIDs._RaytracingCameraNearPlane, hdCamera.camera.nearClipPlane); // Set the data for the ray generation - cmd.SetGlobalInt(HDShaderIDs._RaytracingSampleIndex, (int)m_SubFrameManager.iteration); + cmd.SetGlobalInt(HDShaderIDs._RaytracingSampleIndex, (int)camData.currentIteration); // Compute an approximate pixel spread angle value (in radians) cmd.SetGlobalFloat(HDShaderIDs._RaytracingPixelSpreadAngle, GetPixelSpreadAngle(hdCamera.camera.fieldOfView, hdCamera.actualWidth, hdCamera.actualHeight)); @@ -279,7 +281,7 @@ void RenderPathTracing(HDCamera hdCamera, CommandBuffer cmd, RTHandle outputText cmd.SetGlobalInt(HDShaderIDs._AreaLightCountRT, lightCluster.GetAreaLightCount()); // Set the data for the ray miss - cmd.SetRayTracingIntParam(pathTracingShader, HDShaderIDs._RaytracingCameraSkyEnabled, m_CameraSkyEnabled ? 1 : 0); + cmd.SetRayTracingIntParam(pathTracingShader, HDShaderIDs._RaytracingCameraSkyEnabled, camData.skyEnabled ? 1 : 0); cmd.SetRayTracingVectorParam(pathTracingShader, HDShaderIDs._RaytracingCameraClearColor, hdCamera.backgroundColorHDR); cmd.SetRayTracingTextureParam(pathTracingShader, HDShaderIDs._SkyTexture, m_SkyManager.GetSkyReflection(hdCamera)); From 9768a35aaa2cf765040d7418700ac7d0bdb203ac Mon Sep 17 00:00:00 2001 From: Emmanuel Turquin Date: Fri, 15 May 2020 19:25:45 +0200 Subject: [PATCH 2/8] Cosmetic. --- .../Runtime/RenderPipeline/Accumulation/SubFrameManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/SubFrameManager.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/SubFrameManager.cs index 9e281313efa..594f38b7e6a 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/SubFrameManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/SubFrameManager.cs @@ -14,7 +14,7 @@ internal struct CameraData { public void ResetIteration() { - accumulatedWeight = 0; + accumulatedWeight = 0.0f; currentIteration = 0; } From c69054a28c4d667162cff8cddfeb8a53cf4fd8e7 Mon Sep 17 00:00:00 2001 From: Emmanuel Turquin Date: Wed, 20 May 2020 14:32:57 +0200 Subject: [PATCH 3/8] Modifications to address comments in PR. --- .../Accumulation/SubFrameManager.cs | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/SubFrameManager.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/SubFrameManager.cs index 594f38b7e6a..90986d8421a 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/SubFrameManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/SubFrameManager.cs @@ -89,6 +89,10 @@ internal void Reset() foreach (int camID in m_CameraCache.Keys.ToList()) Reset(camID); } + internal void Clear() + { + m_CameraCache.Clear(); + } internal void SelectiveReset(uint maxSamples) { foreach (int camID in m_CameraCache.Keys.ToList()) @@ -109,11 +113,13 @@ void Init(int samples, float shutterInterval) m_IsRecording = true; m_IsRenderingTheFirstFrame = true; + Clear(); + m_OriginalTimeScale = Time.timeScale; Time.timeScale = m_OriginalTimeScale * m_ShutterInterval / m_AccumulationSamples; - if (m_Centered && m_IsRenderingTheFirstFrame) + if (m_Centered) { Time.timeScale *= 0.5f; } @@ -146,16 +152,17 @@ internal void EndRecording() } // Should be called before rendering a new frame in a sequence (when accumulation is desired) - internal void PrepareNewSubFrame(int camID) + internal void PrepareNewSubFrame() { - CameraData camData = GetCameraData(camID); + uint maxIteration = 0; + foreach (int camID in m_CameraCache.Keys.ToList()) + maxIteration = Math.Max(maxIteration, GetCameraData(camID).currentIteration); - if (camData.currentIteration == m_AccumulationSamples) + if (maxIteration == m_AccumulationSamples) { - Reset(camID); + Reset(); } - - if (camData.currentIteration == m_AccumulationSamples - 1) + else if (maxIteration == m_AccumulationSamples - 1) { Time.timeScale = m_OriginalTimeScale * (1.0f - m_ShutterInterval); m_IsRenderingTheFirstFrame = false; @@ -270,9 +277,9 @@ public void EndRecording() /// /// Should be called during a recording session when preparing to render a new sub-frame of a multi-frame sequence where each final frame is an accumulation of multiple sub-frames. /// - public void PrepareNewSubFrame(HDCamera hdCamera) + public void PrepareNewSubFrame() { - m_SubFrameManager.PrepareNewSubFrame(hdCamera.camera.GetInstanceID()); + m_SubFrameManager.PrepareNewSubFrame(); } void RenderAccumulation(HDCamera hdCamera, CommandBuffer cmd, RTHandle inputTexture, RTHandle outputTexture, bool needsExposure = false) From ea6d57b47765387568b3afb68f5b2fc493e623cc Mon Sep 17 00:00:00 2001 From: Emmanuel Turquin Date: Fri, 22 May 2020 20:54:10 +0200 Subject: [PATCH 4/8] Updated PT fog test. --- .../WindowsEditor/Direct3D12/None/5005_PathTracing_Fog.png | 4 ++-- .../Direct3D12/None/5005_PathTracing_Fog.png.meta | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/5005_PathTracing_Fog.png b/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/5005_PathTracing_Fog.png index d85c086c6c3..3acc0724825 100644 --- a/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/5005_PathTracing_Fog.png +++ b/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/5005_PathTracing_Fog.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ce5a27ad09d603f182280a767d0e452fd29ead828ada78949da5e3db40d746e2 -size 333626 +oid sha256:81d3b4dad30801833f6b3cff97726c9084e95b5bcfa2ece8e1fe347525901609 +size 333921 diff --git a/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/5005_PathTracing_Fog.png.meta b/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/5005_PathTracing_Fog.png.meta index 95006b0ace5..23cc1fc0565 100644 --- a/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/5005_PathTracing_Fog.png.meta +++ b/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/5005_PathTracing_Fog.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: d8e2f394066fb7741b581506325f9176 +guid: 3771201495fea9f4d8badf1bad2f1f5c TextureImporter: internalIDToNameTable: [] externalObjects: {} From 121e3255eaaff2725c34ede45cb69713d278e3aa Mon Sep 17 00:00:00 2001 From: Emmanuel Turquin Date: Fri, 22 May 2020 21:11:36 +0200 Subject: [PATCH 5/8] Updated Changelog. --- .../CHANGELOG.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index b8a4d1efaec..21334d61e5b 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -128,6 +128,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Added an initial version of SSGI. - Added back-compatibility with builtin stereo matrices. - Added CustomPassUtils API to simplify Blur, Copy and DrawRenderers custom passes. +- Added support for multiple path-traced views at once (e.g., scene and game views). ### Fixed - Fix when rescale probe all direction below zero (1219246) @@ -514,16 +515,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed an issue with refraction model and ray traced recursive rendering (case 1198578). - Fixed an issue where a dynamic sky changing any frame may not update the ambient probe. - Fixed cubemap thumbnail generation at project load time. -- Fixed cubemap thumbnail generation at project load time. +- Fixed cubemap thumbnail generation at project load time. - Fixed XR culling with multiple cameras - Fixed XR single-pass with Mock HMD plugin - Fixed sRGB mismatch with XR SDK - Fixed an issue where default volume would not update when switching profile. -- Fixed issue with uncached reflection probe cameras reseting the debug mode (case 1224601) +- Fixed issue with uncached reflection probe cameras reseting the debug mode (case 1224601) - Fixed an issue where AO override would not override specular occlusion. - Fixed an issue where Volume inspector might not refresh correctly in some cases. - Fixed render texture with XR -- Fixed issue with resources being accessed before initialization process has been performed completely. +- Fixed issue with resources being accessed before initialization process has been performed completely. - Half fixed shuriken particle light that cast shadows (only the first one will be correct) - Fixed issue with atmospheric fog turning black if a planar reflection probe is placed below ground level. (case 1226588) - Fixed custom pass GC alloc issue in CustomPassVolume.GetActiveVolumes(). @@ -563,7 +564,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed NaN which can appear with real time reflection and inf value - Fixed an issue that was collapsing the volume components in the HDRP default settings - Fixed warning about missing bound decal buffer -- Fixed shader warning on Xbox for ResolveStencilBuffer.compute. +- Fixed shader warning on Xbox for ResolveStencilBuffer.compute. - Fixed PBR shader ZTest rendering in deferred. - Replaced commands incompatible with async compute in light list build process. - Diffusion Profile and Material references in HDRP materials are now correctly exported to unity packages. Note that the diffusion profile or the material references need to be edited once before this can work properly. @@ -583,7 +584,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed SceneView Draw Modes not being properly updated after opening new scene view panels or changing the editor layout. - VFX: Removed irrelevant queues in render queue selection from HDRP outputs - VFX: Motion Vector are correctly renderered with MSAA [Case 1240754](https://issuetracker.unity3d.com/product/unity/issues/guid/1240754/) -- Fixed a cause of NaN when a normal of 0-length is generated (usually via shadergraph). +- Fixed a cause of NaN when a normal of 0-length is generated (usually via shadergraph). - Fixed issue with screen-space shadows not enabled properly when RT is disabled (case 1235821) - Fixed a performance issue with stochastic ray traced area shadows. - Fixed cookie texture not updated when changing an import settings (srgb for example). @@ -592,7 +593,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed transparent motion vectors not working when in MSAA. - Fix error when removing DecalProjector from component contextual menu (case 1243960) - Fixed issue with post process when running in RGBA16 and an object with additive blending is in the scene. -- Fixed corrupted values on LayeredLit when using Vertex Color multiply mode to multiply and MSAA is activated. +- Fixed corrupted values on LayeredLit when using Vertex Color multiply mode to multiply and MSAA is activated. - Fix conflicts with Handles manipulation when performing a Reset in DecalComponent (case 1238833) - Fixed depth prepass and postpass being disabled after changing the shader in the material UI. - Fixed issue with sceneview camera settings not being saved after Editor restart. @@ -601,7 +602,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed some GCAlloc in the debug window. - Fixed shader graphs not casting semi-transparent and color shadows (case 1242617) - Fixed thin refraction mode not working properly. -- Fixed assert on tests caused by probe culling results being requested when culling did not happen. (case 1246169) +- Fixed assert on tests caused by probe culling results being requested when culling did not happen. (case 1246169) - Fixed over consumption of GPU memory by the Physically Based Sky. - Fixed an invalid rotation in Planar Reflection Probe editor display, that was causing an error message (case 1182022) - Put more information in Camera background type tooltip and fixed inconsistent exposure behavior when changing bg type. From 2ef4c34223bbc77a3bae169172dd8b92cc975ec3 Mon Sep 17 00:00:00 2001 From: Emmanuel Turquin Date: Mon, 25 May 2020 18:57:04 +0200 Subject: [PATCH 6/8] Fixed issue with unlit shader graphs in path-traced mode. --- .../Editor/Material/Unlit/ShaderGraph/HDUnlitSubTarget.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/Unlit/ShaderGraph/HDUnlitSubTarget.cs b/com.unity.render-pipelines.high-definition/Editor/Material/Unlit/ShaderGraph/HDUnlitSubTarget.cs index 48fab5efa23..7e8ccfead5f 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/Unlit/ShaderGraph/HDUnlitSubTarget.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/Unlit/ShaderGraph/HDUnlitSubTarget.cs @@ -356,7 +356,7 @@ static class UnlitPasses useInPreview = false, // Template - passTemplatePath = raytracingPassTemplatePath, + passTemplatePath = passTemplatePath, sharedTemplateDirectory = HDTarget.sharedTemplateDirectory, // Port Mask @@ -367,7 +367,7 @@ static class UnlitPasses structs = CoreStructCollections.Default, fieldDependencies = CoreFieldDependencies.Default, pragmas = CorePragmas.RaytracingBasic, - keywords = CoreKeywords.HDBaseNoCrossFade, + keywords = CoreKeywords.HDBase, includes = CoreIncludes.Raytracing, requiredFields = new FieldCollection(){ HDFields.SubShader.Unlit, HDFields.ShaderPass.RaytracingPathTracing }, }; @@ -536,7 +536,7 @@ static class UnlitKeywords static class UnlitIncludes { const string kPassForwardUnlit = "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassForwardUnlit.hlsl"; - + public static IncludeCollection Meta = new IncludeCollection { { CoreIncludes.CorePregraph }, From 45aac1e8ad32844948255d4e04bad1fa6d0660c8 Mon Sep 17 00:00:00 2001 From: Sebastien Lagarde Date: Wed, 27 May 2020 14:49:54 +0200 Subject: [PATCH 7/8] Update CHANGELOG.md --- .../CHANGELOG.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 7ff2b46671a..48815fd951e 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -517,16 +517,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed an issue with refraction model and ray traced recursive rendering (case 1198578). - Fixed an issue where a dynamic sky changing any frame may not update the ambient probe. - Fixed cubemap thumbnail generation at project load time. -- Fixed cubemap thumbnail generation at project load time. +- Fixed cubemap thumbnail generation at project load time. - Fixed XR culling with multiple cameras - Fixed XR single-pass with Mock HMD plugin - Fixed sRGB mismatch with XR SDK - Fixed an issue where default volume would not update when switching profile. -- Fixed issue with uncached reflection probe cameras reseting the debug mode (case 1224601) +- Fixed issue with uncached reflection probe cameras reseting the debug mode (case 1224601) - Fixed an issue where AO override would not override specular occlusion. - Fixed an issue where Volume inspector might not refresh correctly in some cases. - Fixed render texture with XR -- Fixed issue with resources being accessed before initialization process has been performed completely. +- Fixed issue with resources being accessed before initialization process has been performed completely. - Half fixed shuriken particle light that cast shadows (only the first one will be correct) - Fixed issue with atmospheric fog turning black if a planar reflection probe is placed below ground level. (case 1226588) - Fixed custom pass GC alloc issue in CustomPassVolume.GetActiveVolumes(). @@ -566,7 +566,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed NaN which can appear with real time reflection and inf value - Fixed an issue that was collapsing the volume components in the HDRP default settings - Fixed warning about missing bound decal buffer -- Fixed shader warning on Xbox for ResolveStencilBuffer.compute. +- Fixed shader warning on Xbox for ResolveStencilBuffer.compute. - Fixed PBR shader ZTest rendering in deferred. - Replaced commands incompatible with async compute in light list build process. - Diffusion Profile and Material references in HDRP materials are now correctly exported to unity packages. Note that the diffusion profile or the material references need to be edited once before this can work properly. @@ -586,7 +586,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed SceneView Draw Modes not being properly updated after opening new scene view panels or changing the editor layout. - VFX: Removed irrelevant queues in render queue selection from HDRP outputs - VFX: Motion Vector are correctly renderered with MSAA [Case 1240754](https://issuetracker.unity3d.com/product/unity/issues/guid/1240754/) -- Fixed a cause of NaN when a normal of 0-length is generated (usually via shadergraph). +- Fixed a cause of NaN when a normal of 0-length is generated (usually via shadergraph). - Fixed issue with screen-space shadows not enabled properly when RT is disabled (case 1235821) - Fixed a performance issue with stochastic ray traced area shadows. - Fixed cookie texture not updated when changing an import settings (srgb for example). @@ -595,7 +595,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed transparent motion vectors not working when in MSAA. - Fix error when removing DecalProjector from component contextual menu (case 1243960) - Fixed issue with post process when running in RGBA16 and an object with additive blending is in the scene. -- Fixed corrupted values on LayeredLit when using Vertex Color multiply mode to multiply and MSAA is activated. +- Fixed corrupted values on LayeredLit when using Vertex Color multiply mode to multiply and MSAA is activated. - Fix conflicts with Handles manipulation when performing a Reset in DecalComponent (case 1238833) - Fixed depth prepass and postpass being disabled after changing the shader in the material UI. - Fixed issue with sceneview camera settings not being saved after Editor restart. @@ -604,7 +604,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed some GCAlloc in the debug window. - Fixed shader graphs not casting semi-transparent and color shadows (case 1242617) - Fixed thin refraction mode not working properly. -- Fixed assert on tests caused by probe culling results being requested when culling did not happen. (case 1246169) +- Fixed assert on tests caused by probe culling results being requested when culling did not happen. (case 1246169) - Fixed over consumption of GPU memory by the Physically Based Sky. - Fixed an invalid rotation in Planar Reflection Probe editor display, that was causing an error message (case 1182022) - Put more information in Camera background type tooltip and fixed inconsistent exposure behavior when changing bg type. From c8c23bd7ed5c44dd7d35dd987980573b9dfda5af Mon Sep 17 00:00:00 2001 From: Sebastien Lagarde Date: Wed, 27 May 2020 15:01:39 +0200 Subject: [PATCH 8/8] Update HDUnlitSubTarget.cs --- .../Editor/Material/Unlit/ShaderGraph/HDUnlitSubTarget.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/Unlit/ShaderGraph/HDUnlitSubTarget.cs b/com.unity.render-pipelines.high-definition/Editor/Material/Unlit/ShaderGraph/HDUnlitSubTarget.cs index 0b07932a133..6bbd526d913 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/Unlit/ShaderGraph/HDUnlitSubTarget.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/Unlit/ShaderGraph/HDUnlitSubTarget.cs @@ -367,7 +367,7 @@ static class UnlitPasses structs = CoreStructCollections.Default, fieldDependencies = CoreFieldDependencies.Default, pragmas = CorePragmas.RaytracingBasic, - keywords = CoreKeywords.HDBase, + keywords = CoreKeywords.HDBaseNoCrossFade, includes = CoreIncludes.Raytracing, requiredFields = new FieldCollection(){ HDFields.SubShader.Unlit, HDFields.ShaderPass.RaytracingPathTracing }, };