From f361637c880be0a17956cd8fe28ee7b305cba758 Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Thu, 21 Jan 2021 16:56:21 +0100 Subject: [PATCH 1/9] Fix frame count in editor #3173 --- .../Reflection/HDBakedReflectionSystem.cs | 2 +- .../Runtime/Lighting/Reflection/HDProbe.cs | 7 +-- .../AmbientOcclusion.RenderGraph.cs | 6 +- .../ScreenSpaceLighting/AmbientOcclusion.cs | 5 +- .../VolumetricLighting/DensityVolume.cs | 9 ++- .../DensityVolumeManager.cs | 6 +- .../VolumetricLighting/VolumetricLighting.cs | 8 +-- .../PostProcessing/PostProcessSystem.cs | 2 +- .../Runtime/RenderPipeline/Camera/HDCamera.cs | 31 ++++++++- .../HDRenderPipeline.LightLoop.cs | 20 +++--- .../HDRenderPipeline.RenderGraph.cs | 22 +++---- .../RenderPipeline/HDRenderPipeline.cs | 60 ++++++++---------- ...DRaytracingAmbientOcclusion.RenderGraph.cs | 2 +- ...HDRaytracingIndirectDiffuse.RenderGraph.cs | 20 +++--- .../HDRaytracingReflection.RenderGraph.cs | 20 +++--- .../Runtime/Sky/CloudSystem.meta | 8 +++ .../Runtime/Sky/CloudSystem/CloudLayer.meta | 8 +++ .../Runtime/Sky/HDRISky/HDRISkyRenderer.cs | 11 +--- .../Runtime/Sky/SkyManager.cs | 63 +++++++++---------- .../Runtime/Utilities/CameraCache.cs | 4 +- 20 files changed, 167 insertions(+), 147 deletions(-) create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Sky/CloudSystem.meta create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Sky/CloudSystem/CloudLayer.meta diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/HDBakedReflectionSystem.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/HDBakedReflectionSystem.cs index d860d58914c..43c135e6682 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/HDBakedReflectionSystem.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/HDBakedReflectionSystem.cs @@ -441,7 +441,7 @@ public static bool BakeProbes(IEnumerable bakedProbes) // to update the texture. // updateCount is a transient data, so don't execute this code before the asset reload. { - UnityEngine.Random.InitState((int)(1000 * hdPipeline.GetTime())); + UnityEngine.Random.InitState((int)(1000 * EditorApplication.timeSinceStartup)); foreach (var probe in bakedProbes) { var c = UnityEngine.Random.Range(2, 10); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/HDProbe.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/HDProbe.cs index 259f179ec02..502213a726a 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/HDProbe.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/HDProbe.cs @@ -160,7 +160,6 @@ internal bool HasValidRenderedData() } else { - bool hasEverRendered = lastRenderedFrame != int.MinValue; return hasEverRendered && hasValidTexture; } } @@ -482,16 +481,16 @@ internal Matrix4x4 proxyToWorld : influenceToWorld; internal bool wasRenderedAfterOnEnable { get; private set; } = false; - internal int lastRenderedFrame { get; private set; } = int.MinValue; + internal bool hasEverRendered { get; private set; } = false; - internal void SetIsRendered(int frame) + internal void SetIsRendered() { #if UNITY_EDITOR m_WasRenderedDuringAsyncCompilation = ShaderUtil.anythingCompiling; #endif m_WasRenderedSinceLastOnDemandRequest = true; wasRenderedAfterOnEnable = true; - lastRenderedFrame = frame; + hasEverRendered = true; } // API diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/AmbientOcclusion.RenderGraph.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/AmbientOcclusion.RenderGraph.cs index 03e3ed1f536..ac2cc650f6f 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/AmbientOcclusion.RenderGraph.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/AmbientOcclusion.RenderGraph.cs @@ -10,7 +10,7 @@ TextureHandle CreateAmbientOcclusionTexture(RenderGraph renderGraph) return renderGraph.CreateTexture(new TextureDesc(Vector2.one, true, true) { enableRandomWrite = true, colorFormat = GraphicsFormat.R8_UNorm, name = "Ambient Occlusion" }); } - public TextureHandle Render(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle depthPyramid, TextureHandle normalBuffer, TextureHandle motionVectors, int frameCount, in HDUtils.PackedMipChainInfo depthMipInfo, ShaderVariablesRaytracing shaderVariablesRaytracing, TextureHandle rayCountTexture) + public TextureHandle Render(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle depthPyramid, TextureHandle normalBuffer, TextureHandle motionVectors, in HDUtils.PackedMipChainInfo depthMipInfo, ShaderVariablesRaytracing shaderVariablesRaytracing, TextureHandle rayCountTexture) { var settings = hdCamera.volumeStack.GetComponent(); @@ -31,7 +31,7 @@ public TextureHandle Render(RenderGraph renderGraph, HDCamera hdCamera, TextureH hdCamera.AllocateAmbientOcclusionHistoryBuffer(scaleFactor); if (hdCamera.frameSettings.IsEnabled(FrameSettingsField.RayTracing) && settings.rayTracing.value) - return m_RaytracingAmbientOcclusion.RenderRTAO(renderGraph, hdCamera, depthPyramid, normalBuffer, motionVectors, rayCountTexture, frameCount, shaderVariablesRaytracing); + return m_RaytracingAmbientOcclusion.RenderRTAO(renderGraph, hdCamera, depthPyramid, normalBuffer, motionVectors, rayCountTexture, shaderVariablesRaytracing); else { var historyRT = hdCamera.GetCurrentFrameRT((int)HDCameraFrameHistoryType.AmbientOcclusion); @@ -42,7 +42,7 @@ public TextureHandle Render(RenderGraph renderGraph, HDCamera hdCamera, TextureH historyRT.referenceSize.y * historyRT.scaleFactor.y); var rtScaleForHistory = hdCamera.historyRTHandleProperties.rtHandleScale; - var aoParameters = PrepareRenderAOParameters(hdCamera, historySize * rtScaleForHistory, frameCount, depthMipInfo); + var aoParameters = PrepareRenderAOParameters(hdCamera, historySize * rtScaleForHistory, depthMipInfo); var packedData = RenderAO(renderGraph, aoParameters, depthPyramid, normalBuffer); result = DenoiseAO(renderGraph, aoParameters, depthPyramid, motionVectors, packedData, currentHistory, outputHistory); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/AmbientOcclusion.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/AmbientOcclusion.cs index c2013c83b3f..e2938f15a53 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/AmbientOcclusion.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/AmbientOcclusion.cs @@ -363,7 +363,7 @@ struct RenderAOParameters public ShaderVariablesAmbientOcclusion cb; } - RenderAOParameters PrepareRenderAOParameters(HDCamera camera, Vector2 historySize, int frameCount, in HDUtils.PackedMipChainInfo depthMipInfo) + RenderAOParameters PrepareRenderAOParameters(HDCamera camera, Vector2 historySize, in HDUtils.PackedMipChainInfo depthMipInfo) { var parameters = new RenderAOParameters(); @@ -386,6 +386,7 @@ RenderAOParameters PrepareRenderAOParameters(HDCamera camera, Vector2 historySiz float invHalfTanFOV = -camera.mainViewConstants.projMatrix[1, 1]; float aspectRatio = parameters.runningRes.y / parameters.runningRes.x; + uint frameCount = camera.GetCameraFrameCount(); cb._AOParams0 = new Vector4( parameters.fullResolution ? 0.0f : 1.0f, @@ -637,7 +638,7 @@ internal void Dispatch(CommandBuffer cmd, HDCamera camera, RTHandle depthTexture var rtScaleForHistory = camera.historyRTHandleProperties.rtHandleScale; var hdrp = (RenderPipelineManager.currentPipeline as HDRenderPipeline); - var aoParameters = PrepareRenderAOParameters(camera, historySize * rtScaleForHistory, frameCount, hdrp.sharedRTManager.GetDepthBufferMipChainInfo()); + var aoParameters = PrepareRenderAOParameters(camera, historySize * rtScaleForHistory, hdrp.sharedRTManager.GetDepthBufferMipChainInfo()); using (new ProfilingScope(cmd, ProfilingSampler.Get(HDProfileId.HorizonSSAO))) { RenderAO(aoParameters, m_PackedDataTex, depthTexture, normalBuffer, cmd); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolume.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolume.cs index 6f7f75102ce..b4b3b7f8b97 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolume.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolume.cs @@ -84,13 +84,12 @@ public DensityVolumeArtistParameters(Color color, float _meanFreePath, float _an m_EditorAdvancedFade = false; } - internal void Update(bool animate, float time) + internal void Update(float time) { //Update scrolling based on deltaTime if (volumeMask != null) { - float animationTime = animate ? time : 0.0f; - textureOffset = (textureScrollingSpeed * animationTime); + textureOffset = (textureScrollingSpeed * time); // Switch from right-handed to left-handed coordinate system. textureOffset.x = -textureOffset.x; textureOffset.y = -textureOffset.y; @@ -167,7 +166,7 @@ public partial class DensityVolume : MonoBehaviour /// Gather and Update any parameters that may have changed. - internal void PrepareParameters(bool animate, float time) + internal void PrepareParameters(float time) { //Texture has been updated notify the manager bool updated = previousVolumeMask != parameters.volumeMask; @@ -185,7 +184,7 @@ internal void PrepareParameters(bool animate, float time) #endif } - parameters.Update(animate, time); + parameters.Update(time); } private void NotifyUpdatedTexure() diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolumeManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolumeManager.cs index 0786c33445a..4312188ebf3 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolumeManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolumeManager.cs @@ -67,13 +67,13 @@ public void DeRegisterVolume(DensityVolume volume) public bool ContainsVolume(DensityVolume volume) => volumes.Contains(volume); - public List PrepareDensityVolumeData(CommandBuffer cmd, HDCamera currentCam, float time) + public List PrepareDensityVolumeData(CommandBuffer cmd, HDCamera currentCam) { //Update volumes - bool animate = currentCam.animateMaterials; + float time = currentCam.time; foreach (DensityVolume volume in volumes) { - volume.PrepareParameters(animate, time); + volume.PrepareParameters(time); } if (atlasNeedsRefresh) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.cs index 9c075d26bd9..2ef267ef1c6 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.cs @@ -711,8 +711,8 @@ void UpdateShaderVariablesGlobalVolumetrics(ref ShaderVariablesGlobal cb, HDCame // Get the interpolated anisotropy value. var fog = hdCamera.volumeStack.GetComponent(); - int frameIndex = m_FrameCount; - int currIdx = (frameIndex + 0) & 1; + uint frameIndex = hdCamera.GetCameraFrameCount(); + uint currIdx = (frameIndex + 0) & 1; var currParams = hdCamera.vBufferParams[currIdx]; @@ -736,7 +736,7 @@ void UpdateShaderVariablesGlobalVolumetrics(ref ShaderVariablesGlobal cb, HDCame cb._VBufferRcpInstancedViewCount = 1.0f / hdCamera.viewCount; } - DensityVolumeList PrepareVisibleDensityVolumeList(HDCamera hdCamera, CommandBuffer cmd, float time) + DensityVolumeList PrepareVisibleDensityVolumeList(HDCamera hdCamera, CommandBuffer cmd) { DensityVolumeList densityVolumes = new DensityVolumeList(); @@ -757,7 +757,7 @@ DensityVolumeList PrepareVisibleDensityVolumeList(HDCamera hdCamera, CommandBuff m_VisibleVolumeData.Clear(); // Collect all visible finite volume data, and upload it to the GPU. - var volumes = DensityVolumeManager.manager.PrepareDensityVolumeData(cmd, hdCamera, time); + var volumes = DensityVolumeManager.manager.PrepareDensityVolumeData(cmd, hdCamera); for (int i = 0; i < Math.Min(volumes.Count, k_MaxVisibleVolumeCount); i++) { diff --git a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs index 91b052b2a9b..abfee3f351f 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs @@ -4038,7 +4038,7 @@ static void DoFinalPass( in FinalPassParameters parameters, #if HDRP_DEBUG_STATIC_POSTFX int textureId = 0; #else - int textureId = Time.frameCount % blueNoiseTexture.depth; + int textureId = (int)hdCamera.GetCameraFrameCount() % blueNoiseTexture.depth; #endif finalPassMaterial.EnableKeyword("DITHER"); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs index 52291aaa22e..361b4a9bb83 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs @@ -244,6 +244,8 @@ internal struct HistoryEffectValidity // XR multipass and instanced views are supported (see XRSystem) internal XRPass xr { get; private set; } + internal float deltaTime => time - lastTime; + // Non oblique projection matrix (RHS) // TODO: this code is never used and not compatible with XR internal Matrix4x4 nonObliqueProjMatrix @@ -451,9 +453,24 @@ internal void Update(FrameSettings currentFrameSettings, HDRenderPipeline hdrp, // Different views/tabs may have different values of the "Animated Materials" setting. animateMaterials = CoreUtils.AreAnimatedMaterialsEnabled(aniCam); - - time = animateMaterials ? hdrp.GetTime() : 0; - lastTime = animateMaterials ? hdrp.GetLastTime() : 0; + if (animateMaterials) + { + float newTime, deltaTime; +#if UNITY_EDITOR + newTime = Application.isPlaying ? Time.time : Time.realtimeSinceStartup; + deltaTime = Application.isPlaying ? Time.deltaTime : 0.033f; +#else + newTime = Time.time; + deltaTime = Time.deltaTime; +#endif + time = newTime; + lastTime = newTime - deltaTime; + } + else + { + time = 0; + lastTime = 0; + } // Make sure that the shadow history identification array is allocated and is at the right size if (shadowHistoryUsage == null || shadowHistoryUsage.Length != hdrp.currentPlatformRenderPipelineSettings.hdShadowInitParams.maxScreenSpaceShadowSlots) @@ -673,6 +690,9 @@ internal static void ResetAllHistoryRTHandleSystems(int width, int height) } } + unsafe internal void UpdateShaderVariablesGlobalCB(ref ShaderVariablesGlobal cb) + => UpdateShaderVariablesGlobalCB(ref cb, (int)cameraFrameCount); + unsafe internal void UpdateShaderVariablesGlobalCB(ref ShaderVariablesGlobal cb, int frameCount) { bool taaEnabled = frameSettings.IsEnabled(FrameSettingsField.Postprocess) @@ -707,8 +727,13 @@ unsafe internal void UpdateShaderVariablesGlobalCB(ref ShaderVariablesGlobal cb, float ct = time; float pt = lastTime; +#if UNITY_EDITOR + float dt = time - lastTime; + float sdt = dt; +#else float dt = Time.deltaTime; float sdt = Time.smoothDeltaTime; +#endif cb._Time = new Vector4(ct * 0.05f, ct, ct * 2.0f, ct * 3.0f); cb._SinTime = new Vector4(Mathf.Sin(ct * 0.125f), Mathf.Sin(ct * 0.25f), Mathf.Sin(ct * 0.5f), Mathf.Sin(ct)); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs index 18384449c4e..41029e7d7ae 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs @@ -227,7 +227,6 @@ BuildGPULightListOutput BuildGPULightList( RenderGraph rend class PushGlobalCameraParamPassData { public HDCamera hdCamera; - public int frameCount; public ShaderVariablesGlobal globalCB; public ShaderVariablesXR xrCB; @@ -238,18 +237,17 @@ void PushGlobalCameraParams(RenderGraph renderGraph, HDCamera hdCamera) using (var builder = renderGraph.AddRenderPass("Push Global Camera Parameters", out var passData)) { passData.hdCamera = hdCamera; - passData.frameCount = m_FrameCount; passData.globalCB = m_ShaderVariablesGlobalCB; passData.xrCB = m_ShaderVariablesXRCB; builder.SetRenderFunc( - (PushGlobalCameraParamPassData data, RenderGraphContext context) => - { - data.hdCamera.UpdateShaderVariablesGlobalCB(ref data.globalCB, data.frameCount); - ConstantBuffer.PushGlobal(context.cmd, data.globalCB, HDShaderIDs._ShaderVariablesGlobal); - data.hdCamera.UpdateShaderVariablesXRCB(ref data.xrCB); - ConstantBuffer.PushGlobal(context.cmd, data.xrCB, HDShaderIDs._ShaderVariablesXR); - }); + (PushGlobalCameraParamPassData data, RenderGraphContext context) => + { + data.hdCamera.UpdateShaderVariablesGlobalCB(ref data.globalCB); + ConstantBuffer.PushGlobal(context.cmd, data.globalCB, HDShaderIDs._ShaderVariablesGlobal); + data.hdCamera.UpdateShaderVariablesXRCB(ref data.xrCB); + ConstantBuffer.PushGlobal(context.cmd, data.xrCB, HDShaderIDs._ShaderVariablesXR); + }); } } @@ -440,8 +438,8 @@ TextureHandle RenderSSR( RenderGraph renderGraph, if (usesRaytracedReflections) { result = RenderRayTracedReflections(renderGraph, hdCamera, - prepassOutput.depthBuffer, prepassOutput.stencilBuffer, prepassOutput.normalBuffer, prepassOutput.resolvedMotionVectorsBuffer, clearCoatMask, skyTexture, rayCountTexture, - m_FrameCount, m_ShaderVariablesRayTracingCB, transparent); + prepassOutput.depthBuffer, prepassOutput.stencilBuffer, prepassOutput.normalBuffer, prepassOutput.resolvedMotionVectorsBuffer, clearCoatMask, skyTexture, rayCountTexture, + m_ShaderVariablesRayTracingCB, transparent); } else { diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs index 7d79dc2bab4..bceadfe725d 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs @@ -31,7 +31,7 @@ void ExecuteWithRenderGraph(RenderRequest renderRequest, { scriptableRenderContext = renderContext, commandBuffer = commandBuffer, - currentFrameIndex = GetFrameCount() + currentFrameIndex = m_FrameCount }; m_RenderGraph.Begin(renderGraphParams); @@ -105,7 +105,7 @@ void ExecuteWithRenderGraph(RenderRequest renderRequest, { gpuLightListOutput = BuildGPULightList(m_RenderGraph, hdCamera, m_TileAndClusterData, m_TotalLightCount, ref m_ShaderVariablesLightListCB, prepassOutput.depthBuffer, prepassOutput.stencilBuffer, prepassOutput.gbuffer); - lightingBuffers.ambientOcclusionBuffer = m_AmbientOcclusionSystem.Render(m_RenderGraph, hdCamera, prepassOutput.depthPyramidTexture, prepassOutput.resolvedNormalBuffer, prepassOutput.resolvedMotionVectorsBuffer, m_FrameCount, m_DepthBufferMipChainInfo, m_ShaderVariablesRayTracingCB, rayCountTexture); + lightingBuffers.ambientOcclusionBuffer = m_AmbientOcclusionSystem.Render(m_RenderGraph, hdCamera, prepassOutput.depthPyramidTexture, prepassOutput.resolvedNormalBuffer, prepassOutput.resolvedMotionVectorsBuffer, m_DepthBufferMipChainInfo, m_ShaderVariablesRayTracingCB, rayCountTexture); // Should probably be inside the AO render function but since it's a separate class it's currently not super clean to do. PushFullScreenDebugTexture(m_RenderGraph, lightingBuffers.ambientOcclusionBuffer, FullScreenDebugMode.ScreenSpaceAmbientOcclusion); @@ -135,8 +135,8 @@ void ExecuteWithRenderGraph(RenderRequest renderRequest, case IndirectDiffuseMode.Raytrace: lightingBuffers.ssgiLightingBuffer = RenderRayTracedIndirectDiffuse(m_RenderGraph, hdCamera, - prepassOutput.depthBuffer, prepassOutput.stencilBuffer, prepassOutput.normalBuffer, prepassOutput.resolvedMotionVectorsBuffer, m_SkyManager.GetSkyReflection(hdCamera), rayCountTexture, - m_FrameCount, m_ShaderVariablesRayTracingCB); + prepassOutput.depthBuffer, prepassOutput.stencilBuffer, prepassOutput.normalBuffer, prepassOutput.resolvedMotionVectorsBuffer, m_SkyManager.GetSkyReflection(hdCamera), rayCountTexture, + m_ShaderVariablesRayTracingCB); break; default: lightingBuffers.ssgiLightingBuffer = m_RenderGraph.defaultResources.blackTextureXR; @@ -1117,7 +1117,6 @@ class PreRenderSkyPassData public TextureHandle normalBuffer; public DebugDisplaySettings debugDisplaySettings; public SkyManager skyManager; - public int frameCount; } void PreRenderSky(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle colorBuffer, TextureHandle depthStencilBuffer, TextureHandle normalbuffer) @@ -1137,13 +1136,12 @@ void PreRenderSky(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle colo passData.normalBuffer = builder.WriteTexture(normalbuffer); passData.debugDisplaySettings = m_CurrentDebugDisplaySettings; passData.skyManager = m_SkyManager; - passData.frameCount = m_FrameCount; builder.SetRenderFunc( - (PreRenderSkyPassData data, RenderGraphContext context) => - { - data.skyManager.PreRenderSky(data.hdCamera, data.sunLight, data.colorBuffer, data.normalBuffer, data.depthStencilBuffer, data.debugDisplaySettings, data.frameCount, context.cmd); - }); + (PreRenderSkyPassData data, RenderGraphContext context) => + { + data.skyManager.PreRenderSky(data.hdCamera, data.sunLight, data.colorBuffer, data.normalBuffer, data.depthStencilBuffer, data.debugDisplaySettings, context.cmd); + }); } } @@ -1159,7 +1157,6 @@ class RenderSkyPassData public TextureHandle intermediateBuffer; public DebugDisplaySettings debugDisplaySettings; public SkyManager skyManager; - public int frameCount; } void RenderSky(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle colorBuffer, TextureHandle volumetricLighting, TextureHandle depthStencilBuffer, TextureHandle depthTexture) @@ -1181,7 +1178,6 @@ void RenderSky(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle colorBu passData.intermediateBuffer = builder.CreateTransientTexture(colorBuffer); passData.debugDisplaySettings = m_CurrentDebugDisplaySettings; passData.skyManager = m_SkyManager; - passData.frameCount = m_FrameCount; builder.SetRenderFunc( (RenderSkyPassData data, RenderGraphContext context) => @@ -1189,7 +1185,7 @@ void RenderSky(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle colorBu // Necessary to perform dual-source (polychromatic alpha) blending which is not supported by Unity. // We load from the color buffer, perform blending manually, and store to the atmospheric scattering buffer. // Then we perform a copy from the atmospheric scattering buffer back to the color buffer. - data.skyManager.RenderSky(data.hdCamera, data.sunLight, data.colorBuffer, data.depthStencilBuffer, data.debugDisplaySettings, data.frameCount, context.cmd); + data.skyManager.RenderSky(data.hdCamera, data.sunLight, data.colorBuffer, data.depthStencilBuffer, data.debugDisplaySettings, context.cmd); if (Fog.IsFogEnabled(data.hdCamera) || Fog.IsPBRFogEnabled(data.hdCamera)) { diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs index 72a956ddba0..25bcafaf651 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs @@ -256,13 +256,8 @@ internal static Volume GetOrCreateDefaultVolume() // Keep track of the maximum number of XR instanced views int m_MaxViewCount = 1; - // Use to detect frame changes + // Use to detect frame changes (for accurate frame count in editor, consider using hdCamera.GetCameraFrameCount) int m_FrameCount; - float m_LastTime, m_Time; // Do NOT take the 'animateMaterials' setting into account. - - internal int GetFrameCount() { return m_FrameCount; } - internal float GetLastTime() { return m_LastTime; } - internal float GetTime() { return m_Time; } GraphicsFormat GetColorBufferFormat() => (GraphicsFormat)m_Asset.currentPlatformRenderPipelineSettings.colorBufferFormat; @@ -1287,7 +1282,7 @@ void UpdateGlobalConstantBuffers(HDCamera hdCamera, CommandBuffer cmd) void UpdateShaderVariablesGlobalCB(HDCamera hdCamera, CommandBuffer cmd) { - hdCamera.UpdateShaderVariablesGlobalCB(ref m_ShaderVariablesGlobalCB, m_FrameCount); + hdCamera.UpdateShaderVariablesGlobalCB(ref m_ShaderVariablesGlobalCB); Fog.UpdateShaderVariablesGlobalCB(ref m_ShaderVariablesGlobalCB, hdCamera); UpdateShaderVariablesGlobalSubsurface(ref m_ShaderVariablesGlobalCB, hdCamera); UpdateShaderVariablesGlobalDecal(ref m_ShaderVariablesGlobalCB, hdCamera); @@ -1577,24 +1572,29 @@ protected override void Render(ScriptableRenderContext renderContext, Camera[] c BeginContextRendering(renderContext, cameras); #else BeginFrameRendering(renderContext, cameras); - #endif // Check if we can speed up FrameSettings process by skiping history // or go in detail if debug is activated. Done once for all renderer. m_FrameSettingsHistoryEnabled = FrameSettingsHistory.enabled; - int newCount = Time.frameCount; - bool newFrame = newCount != m_FrameCount; - m_FrameCount = newCount; - - if (newFrame) +#if UNITY_EDITOR + int newCount = m_FrameCount; + foreach (var c in cameras) { - m_LastTime = m_Time; // Only update time once per frame. - m_Time = Time.time; // Does NOT take the 'animateMaterials' setting into account. - m_LastTime = Mathf.Min(m_Time, m_LastTime); // Guard against broken Unity behavior. Should not be necessary. - - m_ProbeCameraCache.ClearCamerasUnusedFor(2, m_FrameCount); + if (c.cameraType != CameraType.Preview) + { + newCount++; + break; + } + } +#else + int newCount = Time.frameCount; +#endif + if (newCount != m_FrameCount) + { + m_FrameCount = newCount; + m_ProbeCameraCache.ClearCamerasUnusedFor(2, Time.frameCount); HDCamera.CleanUnused(); } @@ -1811,7 +1811,7 @@ void AddVisibleProbeVisibleIndexIfUpdateIsRequired(HDProbe probe, int visibleInI // (see m_SkyManager.HasSetValidAmbientProbe in this function). // Also, we need to set the probe as rendered only if we'll actually render it and this won't happen if visibility is not > 0. if (m_FrameCount > 1 && visibility > 0.0f) - probe.SetIsRendered(m_FrameCount); + probe.SetIsRendered(); if (!renderRequestIndicesWhereTheProbeIsVisible.TryGetValue(probe, out var visibleInIndices)) { @@ -1966,7 +1966,7 @@ ref List renderDatas for (int j = 0; j < cameraSettings.Count; ++j) { - var camera = m_ProbeCameraCache.GetOrCreate((viewerTransform, visibleProbe, j), m_FrameCount, CameraType.Reflection); + var camera = m_ProbeCameraCache.GetOrCreate((viewerTransform, visibleProbe, j), Time.frameCount, CameraType.Reflection); var additionalCameraData = camera.GetComponent(); if (additionalCameraData == null) @@ -2434,7 +2434,7 @@ AOVRequestData aovRequest material.Bind(cmd); // Frustum cull density volumes on the CPU. Can be performed as soon as the camera is set up. - DensityVolumeList densityVolumes = PrepareVisibleDensityVolumeList(hdCamera, cmd, hdCamera.time); + DensityVolumeList densityVolumes = PrepareVisibleDensityVolumeList(hdCamera, cmd); // Frustum cull probe volumes on the CPU. Can be performed as soon as the camera is set up. ProbeVolumeList probeVolumes = PrepareVisibleProbeVolumeList(renderContext, hdCamera, cmd); @@ -4251,7 +4251,7 @@ void RenderFullScreenDebug(CullingResults cullResults, HDCamera hdCamera, Script void UpdateSkyEnvironment(HDCamera hdCamera, ScriptableRenderContext renderContext, int frameIndex, CommandBuffer cmd) { - m_SkyManager.UpdateEnvironment(hdCamera, renderContext, GetCurrentSunLight(), frameIndex, cmd); + m_SkyManager.UpdateEnvironment(hdCamera, renderContext, GetCurrentSunLight(), cmd); } /// @@ -4279,7 +4279,7 @@ void PreRenderSky(HDCamera hdCamera, CommandBuffer cmd) var depthBuffer = m_SharedRTManager.GetDepthStencilBuffer(msaaEnabled); var normalBuffer = m_SharedRTManager.GetNormalBuffer(msaaEnabled); - m_SkyManager.PreRenderSky(hdCamera, GetCurrentSunLight(), colorBuffer, normalBuffer, depthBuffer, m_CurrentDebugDisplaySettings, m_FrameCount, cmd); + m_SkyManager.PreRenderSky(hdCamera, GetCurrentSunLight(), colorBuffer, normalBuffer, depthBuffer, m_CurrentDebugDisplaySettings, cmd); } void RenderSky(HDCamera hdCamera, CommandBuffer cmd) @@ -4298,7 +4298,7 @@ void RenderSky(HDCamera hdCamera, CommandBuffer cmd) var depthBuffer = m_SharedRTManager.GetDepthStencilBuffer(msaaEnabled); var visualEnv = hdCamera.volumeStack.GetComponent(); - m_SkyManager.RenderSky(hdCamera, GetCurrentSunLight(), colorBuffer, depthBuffer, m_CurrentDebugDisplaySettings, m_FrameCount, cmd); + m_SkyManager.RenderSky(hdCamera, GetCurrentSunLight(), colorBuffer, depthBuffer, m_CurrentDebugDisplaySettings, cmd); if (Fog.IsFogEnabled(hdCamera) || Fog.IsPBRFogEnabled(hdCamera)) { @@ -5703,9 +5703,6 @@ struct PostProcessParameters // After Postprocess public bool useDepthBuffer; - public float time; - public float lastTime; - public int frameCount; public RendererListDesc opaqueAfterPPDesc; public RendererListDesc transparentAfterPPDesc; } @@ -5722,9 +5719,6 @@ PostProcessParameters PreparePostProcess(CullingResults cullResults, HDCamera hd result.blueNoise = m_BlueNoise; result.useDepthBuffer = !hdCamera.IsTAAEnabled() && hdCamera.frameSettings.IsEnabled(FrameSettingsField.ZTestAfterPostProcessTAA); - result.time = m_Time; - result.lastTime = m_LastTime; - result.frameCount = m_FrameCount; result.opaqueAfterPPDesc = CreateOpaqueRendererListDesc(cullResults, hdCamera.camera, HDShaderPassNames.s_ForwardOnlyName, renderQueueRange: HDRenderQueue.k_RenderQueue_AfterPostProcessOpaque); result.transparentAfterPPDesc = CreateTransparentRendererListDesc(cullResults, hdCamera.camera, HDShaderPassNames.s_ForwardOnlyName, renderQueueRange: HDRenderQueue.k_RenderQueue_AfterPostProcessTransparent); @@ -5804,7 +5798,7 @@ static void RenderAfterPostProcess( PostProcessParameters parameters, // The issue is that the only available depth buffer is jittered so pixels would wobble around depth tested edges. // In order to avoid that we decide that objects rendered after Post processes while TAA is active will not benefit from the depth buffer so we disable it. parameters.hdCamera.UpdateAllViewConstants(false); - parameters.hdCamera.UpdateShaderVariablesGlobalCB(ref parameters.globalCB, parameters.frameCount); + parameters.hdCamera.UpdateShaderVariablesGlobalCB(ref parameters.globalCB); UpdateOffscreenRenderingConstants(ref parameters.globalCB, true, 1); ConstantBuffer.PushGlobal(cmd, parameters.globalCB, HDShaderIDs._ShaderVariablesGlobal); @@ -5996,7 +5990,7 @@ public OverrideCameraRendering(CommandBuffer cmd, Camera overrideCamera) overrideHDCamera.Update(overrideHDCamera.frameSettings, hdrp, hdrp.m_MSAASamples, hdrp.m_XRSystem.emptyPass, allocateHistoryBuffers: false); // Reset the reference size as it could have been changed by the override camera hdrp.m_CurrentHDCamera.SetReferenceSize(); - overrideHDCamera.UpdateShaderVariablesGlobalCB(ref hdrp.m_ShaderVariablesGlobalCB, hdrp.m_FrameCount); + overrideHDCamera.UpdateShaderVariablesGlobalCB(ref hdrp.m_ShaderVariablesGlobalCB); ConstantBuffer.PushGlobal(cmd, hdrp.m_ShaderVariablesGlobalCB, HDShaderIDs._ShaderVariablesGlobal); } @@ -6031,7 +6025,7 @@ void IDisposable.Dispose() var hdrp = HDRenderPipeline.currentPipeline; // Reset the reference size as it could have been changed by the override camera hdrp.m_CurrentHDCamera.SetReferenceSize(); - hdrp.m_CurrentHDCamera.UpdateShaderVariablesGlobalCB(ref hdrp.m_ShaderVariablesGlobalCB, hdrp.m_FrameCount); + hdrp.m_CurrentHDCamera.UpdateShaderVariablesGlobalCB(ref hdrp.m_ShaderVariablesGlobalCB); ConstantBuffer.PushGlobal(cmd, hdrp.m_ShaderVariablesGlobalCB, HDShaderIDs._ShaderVariablesGlobal); } } diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingAmbientOcclusion.RenderGraph.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingAmbientOcclusion.RenderGraph.cs index 9288132f6c6..0a97d774a07 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingAmbientOcclusion.RenderGraph.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingAmbientOcclusion.RenderGraph.cs @@ -5,7 +5,7 @@ namespace UnityEngine.Rendering.HighDefinition { partial class HDRaytracingAmbientOcclusion { - public TextureHandle RenderRTAO(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle depthPyramid, TextureHandle normalBuffer, TextureHandle motionVectors, TextureHandle rayCountTexture, int frameCount, ShaderVariablesRaytracing shaderVariablesRaytracing) + public TextureHandle RenderRTAO(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle depthPyramid, TextureHandle normalBuffer, TextureHandle motionVectors, TextureHandle rayCountTexture, ShaderVariablesRaytracing shaderVariablesRaytracing) { var settings = hdCamera.volumeStack.GetComponent(); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingIndirectDiffuse.RenderGraph.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingIndirectDiffuse.RenderGraph.cs index 1e7bb727b79..a4471195b26 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingIndirectDiffuse.RenderGraph.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingIndirectDiffuse.RenderGraph.cs @@ -120,8 +120,8 @@ static RTHandle RequestRayTracedIndirectDiffuseHistoryTexture(HDCamera hdCamera) } TextureHandle RenderIndirectDiffusePerformance(RenderGraph renderGraph, HDCamera hdCamera, - TextureHandle depthPyramid, TextureHandle stencilBuffer, TextureHandle normalBuffer, TextureHandle motionVectors, TextureHandle rayCountTexture, Texture skyTexture, - int frameCount, ShaderVariablesRaytracing shaderVariablesRaytracing) + TextureHandle depthPyramid, TextureHandle stencilBuffer, TextureHandle normalBuffer, TextureHandle motionVectors, TextureHandle rayCountTexture, Texture skyTexture, + ShaderVariablesRaytracing shaderVariablesRaytracing) { // Pointer to the final result TextureHandle rtgiResult; @@ -187,8 +187,8 @@ TextureHandle QualityRTGI(RenderGraph renderGraph, in QualityRTIndirectDiffusePa } TextureHandle RenderIndirectDiffuseQuality(RenderGraph renderGraph, HDCamera hdCamera, - TextureHandle depthPyramid, TextureHandle stencilBuffer, TextureHandle normalBuffer, TextureHandle motionVectors, TextureHandle rayCountTexture, Texture skyTexture, - int frameCount, ShaderVariablesRaytracing shaderVariablesRaytracing) + TextureHandle depthPyramid, TextureHandle stencilBuffer, TextureHandle normalBuffer, TextureHandle motionVectors, TextureHandle rayCountTexture, Texture skyTexture, + ShaderVariablesRaytracing shaderVariablesRaytracing) { var settings = hdCamera.volumeStack.GetComponent(); @@ -268,8 +268,8 @@ TextureHandle DenoiseRTGI(RenderGraph renderGraph, HDCamera hdCamera, TextureHan } TextureHandle RenderRayTracedIndirectDiffuse(RenderGraph renderGraph, HDCamera hdCamera, - TextureHandle depthPyramid, TextureHandle stencilBuffer, TextureHandle normalBuffer, TextureHandle motionVectors, Texture skyTexture, TextureHandle rayCountTexture, - int frameCount, ShaderVariablesRaytracing shaderVariablesRaytracing) + TextureHandle depthPyramid, TextureHandle stencilBuffer, TextureHandle normalBuffer, TextureHandle motionVectors, Texture skyTexture, TextureHandle rayCountTexture, + ShaderVariablesRaytracing shaderVariablesRaytracing) { GlobalIllumination giSettings = hdCamera.volumeStack.GetComponent(); @@ -285,12 +285,12 @@ TextureHandle RenderRayTracedIndirectDiffuse(RenderGraph renderGraph, HDCamera h if (qualityMode) rtreflResult = RenderIndirectDiffuseQuality(renderGraph, hdCamera, - depthPyramid, stencilBuffer, normalBuffer, motionVectors, rayCountTexture, skyTexture, - frameCount, shaderVariablesRaytracing); + depthPyramid, stencilBuffer, normalBuffer, motionVectors, rayCountTexture, skyTexture, + shaderVariablesRaytracing); else rtreflResult = RenderIndirectDiffusePerformance(renderGraph, hdCamera, - depthPyramid, stencilBuffer, normalBuffer, motionVectors, rayCountTexture, skyTexture, - frameCount, shaderVariablesRaytracing); + depthPyramid, stencilBuffer, normalBuffer, motionVectors, rayCountTexture, skyTexture, + shaderVariablesRaytracing); return rtreflResult; } diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingReflection.RenderGraph.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingReflection.RenderGraph.cs index 49393895789..895b8e694a1 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingReflection.RenderGraph.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingReflection.RenderGraph.cs @@ -99,8 +99,8 @@ static RTHandle RequestRayTracedReflectionsHistoryTexture(HDCamera hdCamera) } TextureHandle RenderReflectionsPerformance(RenderGraph renderGraph, HDCamera hdCamera, - TextureHandle depthPyramid, TextureHandle stencilBuffer, TextureHandle normalBuffer, TextureHandle motionVectors, TextureHandle rayCountTexture, TextureHandle clearCoatTexture, Texture skyTexture, - int frameCount, ShaderVariablesRaytracing shaderVariablesRaytracing, bool transparent) + TextureHandle depthPyramid, TextureHandle stencilBuffer, TextureHandle normalBuffer, TextureHandle motionVectors, TextureHandle rayCountTexture, TextureHandle clearCoatTexture, Texture skyTexture, + ShaderVariablesRaytracing shaderVariablesRaytracing, bool transparent) { // Pointer to the final result TextureHandle rtrResult; @@ -179,8 +179,8 @@ TextureHandle QualityRTR(RenderGraph renderGraph, in RTRQualityRenderingParamete } TextureHandle RenderReflectionsQuality(RenderGraph renderGraph, HDCamera hdCamera, - TextureHandle depthPyramid, TextureHandle stencilBuffer, TextureHandle normalBuffer, TextureHandle motionVectors, TextureHandle rayCountTexture, TextureHandle clearCoatTexture, Texture skyTexture, - int frameCount, ShaderVariablesRaytracing shaderVariablesRaytracing, bool transparent) + TextureHandle depthPyramid, TextureHandle stencilBuffer, TextureHandle normalBuffer, TextureHandle motionVectors, TextureHandle rayCountTexture, TextureHandle clearCoatTexture, Texture skyTexture, + ShaderVariablesRaytracing shaderVariablesRaytracing, bool transparent) { TextureHandle rtrResult; @@ -206,8 +206,8 @@ TextureHandle RenderReflectionsQuality(RenderGraph renderGraph, HDCamera hdCamer } TextureHandle RenderRayTracedReflections(RenderGraph renderGraph, HDCamera hdCamera, - TextureHandle depthPyramid, TextureHandle stencilBuffer, TextureHandle normalBuffer, TextureHandle motionVectors, TextureHandle clearCoatTexture, Texture skyTexture, TextureHandle rayCountTexture, - int frameCount, ShaderVariablesRaytracing shaderVariablesRaytracing, bool transparent) + TextureHandle depthPyramid, TextureHandle stencilBuffer, TextureHandle normalBuffer, TextureHandle motionVectors, TextureHandle clearCoatTexture, Texture skyTexture, TextureHandle rayCountTexture, + ShaderVariablesRaytracing shaderVariablesRaytracing, bool transparent) { ScreenSpaceReflection reflectionSettings = hdCamera.volumeStack.GetComponent(); @@ -223,12 +223,12 @@ TextureHandle RenderRayTracedReflections(RenderGraph renderGraph, HDCamera hdCam if (qualityMode) rtreflResult = RenderReflectionsQuality(renderGraph, hdCamera, - depthPyramid, stencilBuffer, normalBuffer, motionVectors, rayCountTexture, clearCoatTexture, skyTexture, - frameCount, shaderVariablesRaytracing, transparent); + depthPyramid, stencilBuffer, normalBuffer, motionVectors, rayCountTexture, clearCoatTexture, skyTexture, + shaderVariablesRaytracing, transparent); else rtreflResult = RenderReflectionsPerformance(renderGraph, hdCamera, - depthPyramid, stencilBuffer, normalBuffer, motionVectors, rayCountTexture, clearCoatTexture, skyTexture, - frameCount, shaderVariablesRaytracing, transparent); + depthPyramid, stencilBuffer, normalBuffer, motionVectors, rayCountTexture, clearCoatTexture, skyTexture, + shaderVariablesRaytracing, transparent); return rtreflResult; } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudSystem.meta b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudSystem.meta new file mode 100644 index 00000000000..85c3bb87421 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudSystem.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0f3ed6530485b8b458c045a1e4a74969 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudSystem/CloudLayer.meta b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudSystem/CloudLayer.meta new file mode 100644 index 00000000000..fe231cef469 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudSystem/CloudLayer.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7dcf5056f0dd3734f9ca32594205a8a5 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs index 200e8f556fb..140dd6261a1 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs @@ -146,20 +146,15 @@ public override void RenderSky(BuiltinSkyParameters builtinParams, bool renderFo else m_SkyHDRIMaterial.DisableKeyword("USE_FLOWMAP"); + var hdCamera = builtinParams.hdCamera; float rot = -Mathf.Deg2Rad*hdriSky.scrollDirection.value; bool upperHemisphereOnly = hdriSky.upperHemisphereOnly.value || hdriSky.procedural.value; Vector4 flowmapParam = new Vector4(upperHemisphereOnly ? 1.0f : 0.0f, scrollFactor, Mathf.Cos(rot), Mathf.Sin(rot)); m_SkyHDRIMaterial.SetVector(HDShaderIDs._FlowmapParam, flowmapParam); -#if UNITY_EDITOR - // Time.time is not always updated in editor - float time = (float)EditorApplication.timeSinceStartup; -#else - float time = Time.time; -#endif - scrollFactor += hdriSky.scrollSpeed.value * (time - lastTime) * 0.01f; - lastTime = time; + scrollFactor += hdCamera.animateMaterials ? hdriSky.scrollSpeed.value * (hdCamera.time - lastTime) * 0.01f : 0.0f; + lastTime = hdCamera.time; } else m_SkyHDRIMaterial.DisableKeyword("SKY_MOTION"); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs index fa23ebc67c1..35914f615cf 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs @@ -687,20 +687,19 @@ internal void RequestStaticEnvironmentUpdate() m_RequireWaitForAsyncReadBackRequest = true; } - public void UpdateEnvironment( HDCamera hdCamera, - ScriptableRenderContext renderContext, - SkyUpdateContext skyContext, - Light sunLight, - bool updateRequired, - bool updateAmbientProbe, - bool staticSky, - SkyAmbientMode ambientMode, - int frameIndex, - CommandBuffer cmd) + public void UpdateEnvironment(HDCamera hdCamera, + ScriptableRenderContext renderContext, + SkyUpdateContext skyContext, + Light sunLight, + bool updateRequired, + bool updateAmbientProbe, + bool staticSky, + SkyAmbientMode ambientMode, + CommandBuffer cmd) { if (skyContext.IsValid()) { - skyContext.currentUpdateTime += Time.deltaTime; // Consider using HDRenderPipeline.GetTime(). + skyContext.currentUpdateTime += hdCamera.deltaTime; m_BuiltinParameters.hdCamera = hdCamera; m_BuiltinParameters.commandBuffer = cmd; @@ -720,7 +719,7 @@ public void UpdateEnvironment( HDCamera hdCamera, m_BuiltinParameters.viewMatrix = hdCamera.mainViewConstants.viewMatrix; m_BuiltinParameters.screenSize = m_CubemapScreenSize; m_BuiltinParameters.debugSettings = null; // We don't want any debug when updating the environment. - m_BuiltinParameters.frameIndex = frameIndex; + m_BuiltinParameters.frameIndex = (int)hdCamera.GetCameraFrameCount(); m_BuiltinParameters.skySettings = skyContext.skySettings; // When update is not requested and the context is already valid (ie: already computed at least once), @@ -811,11 +810,11 @@ public void UpdateEnvironment( HDCamera hdCamera, } } - public void UpdateEnvironment(HDCamera hdCamera, ScriptableRenderContext renderContext, Light sunLight, int frameIndex, CommandBuffer cmd) + public void UpdateEnvironment(HDCamera hdCamera, ScriptableRenderContext renderContext, Light sunLight, CommandBuffer cmd) { SkyAmbientMode ambientMode = hdCamera.volumeStack.GetComponent().skyAmbientMode.value; - UpdateEnvironment(hdCamera, renderContext, hdCamera.lightingSky, sunLight, m_UpdateRequired, ambientMode == SkyAmbientMode.Dynamic, false, ambientMode, frameIndex, cmd); + UpdateEnvironment(hdCamera, renderContext, hdCamera.lightingSky, sunLight, m_UpdateRequired, ambientMode == SkyAmbientMode.Dynamic, false, ambientMode, cmd); // Preview camera will have a different sun, therefore the hash for the static lighting sky will change and force a recomputation // because we only maintain one static sky. Since we don't care that the static lighting may be a bit different in the preview we never recompute @@ -832,7 +831,7 @@ public void UpdateEnvironment(HDCamera hdCamera, ScriptableRenderContext renderC if ((ambientMode == SkyAmbientMode.Static || forceStaticUpdate) && hdCamera.camera.cameraType != CameraType.Preview) { m_StaticLightingSky.skySettings = staticLightingSky != null ? staticLightingSky.skySettings : null; - UpdateEnvironment(hdCamera, renderContext, m_StaticLightingSky, sunLight, m_StaticSkyUpdateRequired || m_UpdateRequired, true, true, SkyAmbientMode.Static, frameIndex, cmd); + UpdateEnvironment(hdCamera, renderContext, m_StaticLightingSky, sunLight, m_StaticSkyUpdateRequired || m_UpdateRequired, true, true, SkyAmbientMode.Static, cmd); m_StaticSkyUpdateRequired = false; } @@ -844,7 +843,7 @@ public void UpdateEnvironment(HDCamera hdCamera, ScriptableRenderContext renderC cmd.SetGlobalTexture(HDShaderIDs._SkyTexture, reflectionTexture); } - internal void UpdateBuiltinParameters(SkyUpdateContext skyContext, HDCamera hdCamera, Light sunLight, RTHandle colorBuffer, RTHandle depthBuffer, DebugDisplaySettings debugSettings, int frameIndex, CommandBuffer cmd) + internal void UpdateBuiltinParameters(SkyUpdateContext skyContext, HDCamera hdCamera, Light sunLight, RTHandle colorBuffer, RTHandle depthBuffer, DebugDisplaySettings debugSettings, CommandBuffer cmd) { m_BuiltinParameters.hdCamera = hdCamera; m_BuiltinParameters.commandBuffer = cmd; @@ -856,7 +855,7 @@ internal void UpdateBuiltinParameters(SkyUpdateContext skyContext, HDCamera hdCa m_BuiltinParameters.colorBuffer = colorBuffer; m_BuiltinParameters.depthBuffer = depthBuffer; m_BuiltinParameters.debugSettings = debugSettings; - m_BuiltinParameters.frameIndex = frameIndex; + m_BuiltinParameters.frameIndex = (int)hdCamera.GetCameraFrameCount(); m_BuiltinParameters.skySettings = skyContext.skySettings; } @@ -866,19 +865,18 @@ public bool RequiresPreRenderSky(HDCamera hdCamera) return skyContext.IsValid() && skyContext.skyRenderer.RequiresPreRenderSky(m_BuiltinParameters); } - public void PreRenderSky(HDCamera hdCamera, Light sunLight, RTHandle colorBuffer, RTHandle normalBuffer, RTHandle depthBuffer, DebugDisplaySettings debugSettings, int frameIndex, CommandBuffer cmd) + public void PreRenderSky(HDCamera hdCamera, Light sunLight, RTHandle colorBuffer, RTHandle normalBuffer, RTHandle depthBuffer, DebugDisplaySettings debugSettings, CommandBuffer cmd) { var skyContext = hdCamera.visualSky; if (skyContext.IsValid()) { UpdateBuiltinParameters(skyContext, - hdCamera, - sunLight, - colorBuffer, - depthBuffer, - debugSettings, - frameIndex, - cmd); + hdCamera, + sunLight, + colorBuffer, + depthBuffer, + debugSettings, + cmd); SkyAmbientMode ambientMode = hdCamera.volumeStack.GetComponent().skyAmbientMode.value; int skyHash = ComputeSkyHash(hdCamera, skyContext, sunLight, ambientMode); @@ -896,7 +894,7 @@ public void PreRenderSky(HDCamera hdCamera, Light sunLight, RTHandle colorBuffer } } - public void RenderSky(HDCamera hdCamera, Light sunLight, RTHandle colorBuffer, RTHandle depthBuffer, DebugDisplaySettings debugSettings, int frameIndex, CommandBuffer cmd) + public void RenderSky(HDCamera hdCamera, Light sunLight, RTHandle colorBuffer, RTHandle depthBuffer, DebugDisplaySettings debugSettings, CommandBuffer cmd) { var skyContext = hdCamera.visualSky; if (skyContext.IsValid() && hdCamera.clearColorMode == HDAdditionalCameraData.ClearColorMode.Sky) @@ -904,13 +902,12 @@ public void RenderSky(HDCamera hdCamera, Light sunLight, RTHandle colorBuffer, R using (new ProfilingScope(cmd, ProfilingSampler.Get(HDProfileId.RenderSky))) { UpdateBuiltinParameters(skyContext, - hdCamera, - sunLight, - colorBuffer, - depthBuffer, - debugSettings, - frameIndex, - cmd); + hdCamera, + sunLight, + colorBuffer, + depthBuffer, + debugSettings, + cmd); SkyAmbientMode ambientMode = hdCamera.volumeStack.GetComponent().skyAmbientMode.value; int skyHash = ComputeSkyHash(hdCamera, skyContext, sunLight, ambientMode); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Utilities/CameraCache.cs b/com.unity.render-pipelines.high-definition/Runtime/Utilities/CameraCache.cs index e3e802ba12d..909a0cd4ce6 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Utilities/CameraCache.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Utilities/CameraCache.cs @@ -41,7 +41,7 @@ public Camera GetOrCreate(K key, int frameCount, CameraType cameraType = CameraT } else { - camera.lastFrame = Time.frameCount; + camera.lastFrame = frameCount; m_Cache[key] = camera; } return camera.camera; @@ -65,7 +65,7 @@ public void ClearCamerasUnusedFor(int frameWindow, int frameCount) { if (m_Cache.TryGetValue(key, out var value)) { - if ((frameCount - value.lastFrame) > frameWindow) + if (Math.Abs(frameCount - value.lastFrame) > frameWindow) { if (value.camera != null) { From 47855ee0645a4c406d782e1199809dfd85a865e8 Mon Sep 17 00:00:00 2001 From: John Parsaie Date: Wed, 20 Jan 2021 09:58:15 -0500 Subject: [PATCH 2/9] Change Light Unit Slider Value Ranges #3195 --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 1 + .../Editor/Lighting/LightUnit/LightUnitSliderSettings.cs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 89a88001e8b..1214031cf38 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -90,6 +90,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Disabled specular occlusion for what we consider medium and larger scale ao > 1.25 with a 25cm falloff interval. - Change the source value for the ray tracing frame index iterator from m_FrameCount to the camera frame count (case 1301356). - Removed backplate from rendering of lighting cubemap as it did not really work conceptually and caused artefacts. +- Change some light unit slider value ranges to better reflect the lighting scenario. ## [10.2.1] - 2020-11-30 diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/LightUnit/LightUnitSliderSettings.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/LightUnit/LightUnitSliderSettings.cs index bb987eae4fe..1ff262ce6f6 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/LightUnit/LightUnitSliderSettings.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/LightUnit/LightUnitSliderSettings.cs @@ -120,7 +120,7 @@ private static class LightUnitValueRanges public static readonly LightUnitSliderUIRange[] LuxValueTable = { - new LightUnitSliderUIRange(LightUnitIcon.BrightSky, LightUnitTooltips.k_LuxBrightSky, new Vector2(80000, 120000), 100000), + new LightUnitSliderUIRange(LightUnitIcon.BrightSky, LightUnitTooltips.k_LuxBrightSky, new Vector2(80000, 130000), 100000), new LightUnitSliderUIRange(LightUnitIcon.Overcast, LightUnitTooltips.k_LuxOvercastSky, new Vector2(10000, 80000), 20000), new LightUnitSliderUIRange(LightUnitIcon.SunriseSunset, LightUnitTooltips.k_LuxSunriseSunset, new Vector2(1, 10000), 5000), new LightUnitSliderUIRange(LightUnitIcon.Moonlight, LightUnitTooltips.k_LuxMoonlight, new Vector2(0, 1), 0.5f), @@ -128,7 +128,7 @@ private static class LightUnitValueRanges public static readonly LightUnitSliderUIRange[] ExposureValueTable = { - new LightUnitSliderUIRange(LightUnitIcon.BrightSky, LightUnitTooltips.k_ExposureBrightSky, new Vector2(12, 16)), + new LightUnitSliderUIRange(LightUnitIcon.BrightSky, LightUnitTooltips.k_ExposureBrightSky, new Vector2(12, 15), 13), new LightUnitSliderUIRange(LightUnitIcon.Overcast, LightUnitTooltips.k_ExposureOvercastSky, new Vector2(8, 12)), new LightUnitSliderUIRange(LightUnitIcon.SunriseSunset, LightUnitTooltips.k_ExposureSunriseSunset, new Vector2(6, 8)), new LightUnitSliderUIRange(LightUnitIcon.InteriorLight, LightUnitTooltips.k_ExposureInterior, new Vector2(3, 6)), From c38a4c70b00dc4aed9592bfed655e56d6c1bf34c Mon Sep 17 00:00:00 2001 From: anisunity <42026998+anisunity@users.noreply.github.com> Date: Thu, 21 Jan 2021 11:02:39 +0100 Subject: [PATCH 3/9] Fixed a regression introduced when changing the clamping algorithm for RTR and RTGI (case 1307479). #3206 --- ...ualityKeyword_MaterialQuality_Indirect.png | 4 +- .../None/303_GlobalIlluminationQuality.png | 4 +- .../303_GlobalIlluminationQualityExposure.png | 3 + ...GlobalIlluminationQualityExposure.png.meta | 96 ++++ ...03_GlobalIlluminationQualityExposure.unity | 530 ++++++++++++++++++ ...obalIlluminationQualityExposure.unity.meta | 7 + .../GlobalIlluminationQualityExposure.asset | 414 ++++++++++++++ ...obalIlluminationQualityExposure.asset.meta | 8 + .../ProjectSettings/EditorBuildSettings.asset | 3 + .../RaytracingIndirectDiffuse.raytrace | 2 +- 10 files changed, 1066 insertions(+), 5 deletions(-) create mode 100644 TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/303_GlobalIlluminationQualityExposure.png create mode 100644 TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/303_GlobalIlluminationQualityExposure.png.meta create mode 100644 TestProjects/HDRP_DXR_Tests/Assets/Scenes/303_GlobalIlluminationQualityExposure.unity create mode 100644 TestProjects/HDRP_DXR_Tests/Assets/Scenes/303_GlobalIlluminationQualityExposure.unity.meta create mode 100644 TestProjects/HDRP_DXR_Tests/Assets/Scenes/GlobalIlluminationData/GlobalIlluminationQualityExposure.asset create mode 100644 TestProjects/HDRP_DXR_Tests/Assets/Scenes/GlobalIlluminationData/GlobalIlluminationQualityExposure.asset.meta diff --git a/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/1000_RaytracingQualityKeyword_MaterialQuality_Indirect.png b/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/1000_RaytracingQualityKeyword_MaterialQuality_Indirect.png index 3d4b7d42de0..d9486f748df 100644 --- a/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/1000_RaytracingQualityKeyword_MaterialQuality_Indirect.png +++ b/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/1000_RaytracingQualityKeyword_MaterialQuality_Indirect.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:761e6dbe4d93864697cb73984d22a901e0e5d6471322fe8454430b00a77d8d39 -size 450666 +oid sha256:55aa76662905e52d90db2d2eaa8e9deb2b40aeb60952f82a31fa05087242b85f +size 435170 diff --git a/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/303_GlobalIlluminationQuality.png b/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/303_GlobalIlluminationQuality.png index 447d6ad6a34..e9134869326 100644 --- a/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/303_GlobalIlluminationQuality.png +++ b/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/303_GlobalIlluminationQuality.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c6749ca479300e16254c14f210b7ba76e5a0edbc29d85a42e294e9bf0f4c8cd7 -size 702655 +oid sha256:052453522d9aece86ec5ba1caf63031d912984c01ec99f016c684ac61cdc338b +size 696175 diff --git a/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/303_GlobalIlluminationQualityExposure.png b/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/303_GlobalIlluminationQualityExposure.png new file mode 100644 index 00000000000..df733924051 --- /dev/null +++ b/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/303_GlobalIlluminationQualityExposure.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2ee0b893261d02c31d812a17bd5e1c06c90a37d116f363bfac9c6c3ff93b4131 +size 766145 diff --git a/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/303_GlobalIlluminationQualityExposure.png.meta b/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/303_GlobalIlluminationQualityExposure.png.meta new file mode 100644 index 00000000000..94233e14d67 --- /dev/null +++ b/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/303_GlobalIlluminationQualityExposure.png.meta @@ -0,0 +1,96 @@ +fileFormatVersion: 2 +guid: 254eb6b541a09b345bc18b2098e45e5d +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 1 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: -1 + wrapV: -1 + wrapW: -1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/HDRP_DXR_Tests/Assets/Scenes/303_GlobalIlluminationQualityExposure.unity b/TestProjects/HDRP_DXR_Tests/Assets/Scenes/303_GlobalIlluminationQualityExposure.unity new file mode 100644 index 00000000000..2d4f7eed80a --- /dev/null +++ b/TestProjects/HDRP_DXR_Tests/Assets/Scenes/303_GlobalIlluminationQualityExposure.unity @@ -0,0 +1,530 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0.45543814, g: 0.44937316, b: 0.46072885, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &101661933 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 101661935} + - component: {fileID: 101661934} + m_Layer: 0 + m_Name: Volume + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &101661934 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 101661933} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 172515602e62fb746b5d573b38a5fe58, type: 3} + m_Name: + m_EditorClassIdentifier: + isGlobal: 1 + priority: 0 + blendDistance: 0 + weight: 1 + sharedProfile: {fileID: 11400000, guid: f1a4a5f4a498f034295dd00c1beec97d, type: 2} +--- !u!4 &101661935 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 101661933} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &856466313 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 6117102520564098274, guid: 0c9fcf2263b163643b5bc77eddcf9135, + type: 3} + propertyPath: m_Name + value: RayTracingFrameIndexDisplay + objectReference: {fileID: 0} + - target: {fileID: 6117102520564098278, guid: 0c9fcf2263b163643b5bc77eddcf9135, + type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 6117102520564098278, guid: 0c9fcf2263b163643b5bc77eddcf9135, + type: 3} + propertyPath: m_LocalScale.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6117102520564098278, guid: 0c9fcf2263b163643b5bc77eddcf9135, + type: 3} + propertyPath: m_LocalScale.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6117102520564098278, guid: 0c9fcf2263b163643b5bc77eddcf9135, + type: 3} + propertyPath: m_LocalScale.z + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6117102520564098278, guid: 0c9fcf2263b163643b5bc77eddcf9135, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6117102520564098278, guid: 0c9fcf2263b163643b5bc77eddcf9135, + type: 3} + propertyPath: m_LocalPosition.y + value: 0.048 + objectReference: {fileID: 0} + - target: {fileID: 6117102520564098278, guid: 0c9fcf2263b163643b5bc77eddcf9135, + type: 3} + propertyPath: m_LocalPosition.z + value: 0.064 + objectReference: {fileID: 0} + - target: {fileID: 6117102520564098278, guid: 0c9fcf2263b163643b5bc77eddcf9135, + type: 3} + propertyPath: m_LocalRotation.w + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6117102520564098278, guid: 0c9fcf2263b163643b5bc77eddcf9135, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6117102520564098278, guid: 0c9fcf2263b163643b5bc77eddcf9135, + type: 3} + propertyPath: m_LocalRotation.y + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 6117102520564098278, guid: 0c9fcf2263b163643b5bc77eddcf9135, + type: 3} + propertyPath: m_LocalRotation.z + value: -0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 6117102520564098278, guid: 0c9fcf2263b163643b5bc77eddcf9135, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 90 + objectReference: {fileID: 0} + - target: {fileID: 6117102520564098278, guid: 0c9fcf2263b163643b5bc77eddcf9135, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 180 + objectReference: {fileID: 0} + - target: {fileID: 6117102520564098278, guid: 0c9fcf2263b163643b5bc77eddcf9135, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 0c9fcf2263b163643b5bc77eddcf9135, type: 3} +--- !u!1 &1453285547 +GameObject: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1453285549} + - component: {fileID: 1453285548} + m_Layer: 0 + m_Name: StaticLightingSky + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1453285548 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1453285547} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 441482e8936e35048a1dffac814e3ef8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Profile: {fileID: 11400000, guid: f06b9004565bf224fbb985123bab253a, type: 2} + m_StaticLightingSkyUniqueID: 1 + m_StaticLightingCloudsUniqueID: 0 +--- !u!4 &1453285549 +Transform: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1453285547} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &1859526232 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1132393308280272, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_Name + value: HDRP_Test_Camera + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_RootOrder + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalPosition.y + value: 1.1530278 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalPosition.z + value: 1.87 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalRotation.w + value: 0.007828522 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalRotation.x + value: -0.002500722 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalRotation.y + value: 0.99832326 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalRotation.z + value: -0.057298686 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 114777190906822814, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: m_Version + value: 7 + objectReference: {fileID: 0} + - target: {fileID: 114777190906822814, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: m_RenderingPathCustomFrameSettings.bitDatas.data1 + value: 70005818916701 + objectReference: {fileID: 0} + - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: waitFrames + value: 5 + objectReference: {fileID: 0} + - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: renderPipelineAsset + value: + objectReference: {fileID: 11400000, guid: 14a0f3aaa5e78a3439ec76d270471ebe, + type: 2} + - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: checkMemoryAllocation + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: renderGraphCompatible + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: ImageComparisonSettings.TargetHeight + value: 480 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} +--- !u!1001 &5229108846403476070 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 3428701081926499078, guid: 9345716ac27248541acf0f882313d4be, + type: 3} + propertyPath: m_Name + value: GlobalIlluminationScene + objectReference: {fileID: 0} + - target: {fileID: 5229108844755917182, guid: 9345716ac27248541acf0f882313d4be, + type: 3} + propertyPath: m_Version + value: 11 + objectReference: {fileID: 0} + - target: {fileID: 5229108844755917182, guid: 9345716ac27248541acf0f882313d4be, + type: 3} + propertyPath: m_Intensity + value: 1000 + objectReference: {fileID: 0} + - target: {fileID: 5229108844755917183, guid: 9345716ac27248541acf0f882313d4be, + type: 3} + propertyPath: m_Intensity + value: 79.57747 + objectReference: {fileID: 0} + - target: {fileID: 5229108844755917183, guid: 9345716ac27248541acf0f882313d4be, + type: 3} + propertyPath: m_AreaSize.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 5229108844755917183, guid: 9345716ac27248541acf0f882313d4be, + type: 3} + propertyPath: m_AreaSize.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 5229108845396451521, guid: 9345716ac27248541acf0f882313d4be, + type: 3} + propertyPath: m_Version + value: 11 + objectReference: {fileID: 0} + - target: {fileID: 5229108845396451521, guid: 9345716ac27248541acf0f882313d4be, + type: 3} + propertyPath: m_ApplyRangeAttenuation + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5229108845396451534, guid: 9345716ac27248541acf0f882313d4be, + type: 3} + propertyPath: m_AreaSize.x + value: 0.11 + objectReference: {fileID: 0} + - target: {fileID: 5229108845396451534, guid: 9345716ac27248541acf0f882313d4be, + type: 3} + propertyPath: m_AreaSize.y + value: 0.8 + objectReference: {fileID: 0} + - target: {fileID: 5229108846346827036, guid: 9345716ac27248541acf0f882313d4be, + type: 3} + propertyPath: m_Version + value: 11 + objectReference: {fileID: 0} + - target: {fileID: 5229108846346827036, guid: 9345716ac27248541acf0f882313d4be, + type: 3} + propertyPath: m_ApplyRangeAttenuation + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5229108846346827037, guid: 9345716ac27248541acf0f882313d4be, + type: 3} + propertyPath: m_AreaSize.x + value: 0.11 + objectReference: {fileID: 0} + - target: {fileID: 5229108846346827037, guid: 9345716ac27248541acf0f882313d4be, + type: 3} + propertyPath: m_AreaSize.y + value: 0.8 + objectReference: {fileID: 0} + - target: {fileID: 5379669199747340271, guid: 9345716ac27248541acf0f882313d4be, + type: 3} + propertyPath: m_RootOrder + value: 4 + objectReference: {fileID: 0} + - target: {fileID: 5379669199747340271, guid: 9345716ac27248541acf0f882313d4be, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5379669199747340271, guid: 9345716ac27248541acf0f882313d4be, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5379669199747340271, guid: 9345716ac27248541acf0f882313d4be, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5379669199747340271, guid: 9345716ac27248541acf0f882313d4be, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5379669199747340271, guid: 9345716ac27248541acf0f882313d4be, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5379669199747340271, guid: 9345716ac27248541acf0f882313d4be, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5379669199747340271, guid: 9345716ac27248541acf0f882313d4be, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5379669199747340271, guid: 9345716ac27248541acf0f882313d4be, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5379669199747340271, guid: 9345716ac27248541acf0f882313d4be, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5379669199747340271, guid: 9345716ac27248541acf0f882313d4be, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 9345716ac27248541acf0f882313d4be, type: 3} diff --git a/TestProjects/HDRP_DXR_Tests/Assets/Scenes/303_GlobalIlluminationQualityExposure.unity.meta b/TestProjects/HDRP_DXR_Tests/Assets/Scenes/303_GlobalIlluminationQualityExposure.unity.meta new file mode 100644 index 00000000000..914bb3436f8 --- /dev/null +++ b/TestProjects/HDRP_DXR_Tests/Assets/Scenes/303_GlobalIlluminationQualityExposure.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: e70bf9fd006f6b84f9f543febdb384bb +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/HDRP_DXR_Tests/Assets/Scenes/GlobalIlluminationData/GlobalIlluminationQualityExposure.asset b/TestProjects/HDRP_DXR_Tests/Assets/Scenes/GlobalIlluminationData/GlobalIlluminationQualityExposure.asset new file mode 100644 index 00000000000..aa50ec9c73e --- /dev/null +++ b/TestProjects/HDRP_DXR_Tests/Assets/Scenes/GlobalIlluminationData/GlobalIlluminationQualityExposure.asset @@ -0,0 +1,414 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-5719349156774603544 +MonoBehaviour: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0d7593b3a9277ac4696b20006c21dde2, type: 3} + m_Name: VisualEnvironment + m_EditorClassIdentifier: + active: 1 + m_AdvancedMode: 0 + skyType: + m_OverrideState: 1 + m_Value: 1 + cloudType: + m_OverrideState: 0 + m_Value: 0 + skyAmbientMode: + m_OverrideState: 0 + m_Value: 0 + fogType: + m_OverrideState: 0 + m_Value: 0 +--- !u!114 &-602189600455701405 +MonoBehaviour: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 59b6606ef2548734bb6d11b9d160bc7e, type: 3} + m_Name: HDRISky + m_EditorClassIdentifier: + active: 1 + m_AdvancedMode: 0 + rotation: + m_OverrideState: 0 + m_Value: 0 + min: 0 + max: 360 + skyIntensityMode: + m_OverrideState: 0 + m_Value: 0 + exposure: + m_OverrideState: 1 + m_Value: 5 + multiplier: + m_OverrideState: 0 + m_Value: 1 + min: 0 + upperHemisphereLuxValue: + m_OverrideState: 0 + m_Value: 5.207424 + min: 0 + upperHemisphereLuxColor: + m_OverrideState: 0 + m_Value: {x: 0, y: 0, z: 0} + desiredLuxValue: + m_OverrideState: 0 + m_Value: 20000 + updateMode: + m_OverrideState: 0 + m_Value: 0 + updatePeriod: + m_OverrideState: 0 + m_Value: 0 + min: 0 + includeSunInBaking: + m_OverrideState: 0 + m_Value: 0 + hdriSky: + m_OverrideState: 1 + m_Value: {fileID: 8900000, guid: 614ae0372d7dfb847a1926990e89fa06, type: 3} + enableDistortion: + m_OverrideState: 0 + m_Value: 0 + procedural: + m_OverrideState: 0 + m_Value: 1 + flowmap: + m_OverrideState: 0 + m_Value: {fileID: 0} + upperHemisphereOnly: + m_OverrideState: 0 + m_Value: 1 + scrollDirection: + m_OverrideState: 0 + m_Value: 0 + min: 0 + max: 360 + scrollSpeed: + m_OverrideState: 0 + m_Value: 2 + min: 0 + enableBackplate: + m_OverrideState: 0 + m_Value: 0 + backplateType: + m_OverrideState: 0 + m_Value: 0 + groundLevel: + m_OverrideState: 0 + m_Value: 0 + scale: + m_OverrideState: 0 + m_Value: {x: 32, y: 32} + projectionDistance: + m_OverrideState: 0 + m_Value: 16 + min: 0.0000001 + plateRotation: + m_OverrideState: 0 + m_Value: 0 + min: 0 + max: 360 + plateTexRotation: + m_OverrideState: 0 + m_Value: 0 + min: 0 + max: 360 + plateTexOffset: + m_OverrideState: 0 + m_Value: {x: 0, y: 0} + blendAmount: + m_OverrideState: 0 + m_Value: 0 + min: 0 + max: 100 + shadowTint: + m_OverrideState: 0 + m_Value: {r: 0.5, g: 0.5, b: 0.5, a: 1} + hdr: 0 + showAlpha: 1 + showEyeDropper: 1 + pointLightShadow: + m_OverrideState: 0 + m_Value: 0 + dirLightShadow: + m_OverrideState: 0 + m_Value: 0 + rectLightShadow: + m_OverrideState: 0 + m_Value: 0 +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d7fd9488000d3734a9e00ee676215985, type: 3} + m_Name: GlobalIlluminationQualityExposure + m_EditorClassIdentifier: + components: + - {fileID: 4156480805197577711} + - {fileID: -5719349156774603544} + - {fileID: -602189600455701405} + - {fileID: 1079231456660895217} +--- !u!114 &1079231456660895217 +MonoBehaviour: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2d08ce26990eb1a4a9177b860541e702, type: 3} + m_Name: Exposure + m_EditorClassIdentifier: + active: 1 + m_AdvancedMode: 0 + mode: + m_OverrideState: 1 + m_Value: 0 + meteringMode: + m_OverrideState: 0 + m_Value: 2 + luminanceSource: + m_OverrideState: 0 + m_Value: 1 + fixedExposure: + m_OverrideState: 1 + m_Value: 5 + compensation: + m_OverrideState: 0 + m_Value: 0 + limitMin: + m_OverrideState: 0 + m_Value: -1 + limitMax: + m_OverrideState: 0 + m_Value: 14 + curveMap: + m_OverrideState: 0 + m_Value: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: -10 + value: -10 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 20 + value: 20 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + limitMinCurveMap: + m_OverrideState: 0 + m_Value: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: -10 + value: -12 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 20 + value: 18 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + limitMaxCurveMap: + m_OverrideState: 0 + m_Value: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: -10 + value: -8 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 20 + value: 22 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + adaptationMode: + m_OverrideState: 0 + m_Value: 1 + adaptationSpeedDarkToLight: + m_OverrideState: 0 + m_Value: 3 + min: 0.001 + adaptationSpeedLightToDark: + m_OverrideState: 0 + m_Value: 1 + min: 0.001 + weightTextureMask: + m_OverrideState: 0 + m_Value: {fileID: 0} + histogramPercentages: + m_OverrideState: 0 + m_Value: {x: 40, y: 90} + min: 0 + max: 100 + histogramUseCurveRemapping: + m_OverrideState: 0 + m_Value: 0 + targetMidGray: + m_OverrideState: 0 + m_Value: 0 + centerAroundExposureTarget: + m_OverrideState: 0 + m_Value: 0 + proceduralCenter: + m_OverrideState: 0 + m_Value: {x: 0.5, y: 0.5} + proceduralRadii: + m_OverrideState: 0 + m_Value: {x: 0.3, y: 0.3} + maskMinIntensity: + m_OverrideState: 0 + m_Value: -30 + maskMaxIntensity: + m_OverrideState: 0 + m_Value: 30 + proceduralSoftness: + m_OverrideState: 0 + m_Value: 0.5 + min: 0 +--- !u!114 &4156480805197577711 +MonoBehaviour: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 42ef2681fa3dc8c4fa031f044e68c63f, type: 3} + m_Name: GlobalIllumination + m_EditorClassIdentifier: + active: 1 + m_AdvancedMode: 0 + quality: + m_OverrideState: 0 + m_Value: 1 + enable: + m_OverrideState: 1 + m_Value: 1 + depthBufferThickness: + m_OverrideState: 0 + m_Value: 0.01 + min: 0 + max: 1 + m_RaySteps: + m_OverrideState: 0 + m_Value: 24 + min: 16 + max: 128 + m_FullResolutionSS: + m_OverrideState: 0 + m_Value: 1 + m_FilterRadius: + m_OverrideState: 0 + m_Value: 2 + min: 2 + max: 4 + rayTracing: + m_OverrideState: 1 + m_Value: 1 + layerMask: + m_OverrideState: 0 + m_Value: + serializedVersion: 2 + m_Bits: 4294967295 + mode: + m_OverrideState: 1 + m_Value: 2 + sampleCount: + m_OverrideState: 1 + m_Value: 5 + min: 1 + max: 32 + bounceCount: + m_OverrideState: 1 + m_Value: 2 + min: 1 + max: 31 + m_RayLength: + m_OverrideState: 1 + m_Value: 2.2 + min: 0.001 + m_ClampValue: + m_OverrideState: 1 + m_Value: 0.83 + min: 0.001 + max: 10 + m_FullResolution: + m_OverrideState: 0 + m_Value: 0 + m_UpscaleRadius: + m_OverrideState: 0 + m_Value: 2 + min: 2 + max: 4 + m_Denoise: + m_OverrideState: 1 + m_Value: 0 + m_HalfResolutionDenoiser: + m_OverrideState: 0 + m_Value: 0 + m_DenoiserRadius: + m_OverrideState: 0 + m_Value: 0.6 + min: 0.001 + max: 1 + m_SecondDenoiserPass: + m_OverrideState: 0 + m_Value: 1 diff --git a/TestProjects/HDRP_DXR_Tests/Assets/Scenes/GlobalIlluminationData/GlobalIlluminationQualityExposure.asset.meta b/TestProjects/HDRP_DXR_Tests/Assets/Scenes/GlobalIlluminationData/GlobalIlluminationQualityExposure.asset.meta new file mode 100644 index 00000000000..1e21898fbbc --- /dev/null +++ b/TestProjects/HDRP_DXR_Tests/Assets/Scenes/GlobalIlluminationData/GlobalIlluminationQualityExposure.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f1a4a5f4a498f034295dd00c1beec97d +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/HDRP_DXR_Tests/ProjectSettings/EditorBuildSettings.asset b/TestProjects/HDRP_DXR_Tests/ProjectSettings/EditorBuildSettings.asset index 25f9e6df73b..e977490f64e 100644 --- a/TestProjects/HDRP_DXR_Tests/ProjectSettings/EditorBuildSettings.asset +++ b/TestProjects/HDRP_DXR_Tests/ProjectSettings/EditorBuildSettings.asset @@ -56,6 +56,9 @@ EditorBuildSettings: - enabled: 1 path: Assets/Scenes/303_GlobalIlluminationQuality.unity guid: f307591c78b0e9746978e76d99bd938a + - enabled: 1 + path: Assets/Scenes/303_GlobalIlluminationQualityExposure.unity + guid: e70bf9fd006f6b84f9f543febdb384bb - enabled: 1 path: Assets/Scenes/304_GlobalIlluminationDenoised1.unity guid: 0db3dff8955342e42be12d7838614df9 diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/IndirectDiffuse/RaytracingIndirectDiffuse.raytrace b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/IndirectDiffuse/RaytracingIndirectDiffuse.raytrace index 5b3035fae0f..39f60de2f57 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/IndirectDiffuse/RaytracingIndirectDiffuse.raytrace +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/IndirectDiffuse/RaytracingIndirectDiffuse.raytrace @@ -135,7 +135,7 @@ void RayGenIntegration() finalColor.z = clamp(finalColor.z, 0.0, _RaytracingIntensityClamp); // Convert back to HSV space - finalColor = HsvToRgb(finalColor) * GetInverseCurrentExposureMultiplier(); + finalColor = HsvToRgb(finalColor); // We store the sampled color and the weight that shall be used for it (1.0f) _IndirectDiffuseTextureRW[COORD_TEXTURE2D_X(currentCoord)] = float4(finalColor, 1.0f); } From 6f560e75aea817b22e792e5d1dcb09850d66c4d3 Mon Sep 17 00:00:00 2001 From: Sebastien Lagarde Date: Thu, 21 Jan 2021 21:16:06 +0100 Subject: [PATCH 4/9] Fixed a regression introduced when changing the clamping algorithm for RTR and RTGI (case 1307479). #3206 bis --- .../None/105_ReflectionsAndGlobalIlluminationCollision.png | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/105_ReflectionsAndGlobalIlluminationCollision.png b/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/105_ReflectionsAndGlobalIlluminationCollision.png index a344cdf5584..3b7058becbb 100644 --- a/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/105_ReflectionsAndGlobalIlluminationCollision.png +++ b/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/105_ReflectionsAndGlobalIlluminationCollision.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4c3c3a68385575746c4160e0a837422344e321f207ccd0ee578e6545328080fe -size 401182 +oid sha256:03ff26103e2bfa2aff02adfd4a2bcee41c3f7b7791a988a98e8b86a25b902985 +size 370 From 63273695391a736e058992b614c696b69a4184d9 Mon Sep 17 00:00:00 2001 From: peterjohnlong <73894199+peterjohnlong@users.noreply.github.com> Date: Thu, 21 Jan 2021 14:45:46 +0000 Subject: [PATCH 5/9] rename occurrences of sample when used as a variable name #3216 --- .../Runtime/Material/Eye/EyeRaytracing.hlsl | 4 +-- .../Material/Fabric/FabricRaytracing.hlsl | 4 +-- .../Runtime/Material/Hair/HairRayTracing.hlsl | 4 +-- .../Runtime/Material/Lit/LitPathTracing.hlsl | 8 +++--- .../Runtime/Material/Lit/LitRaytracing.hlsl | 4 +-- .../Material/StackLit/StackLitRayTracing.hlsl | 4 +-- .../PathTracing/Shaders/PathTracingLight.hlsl | 12 ++++---- .../Shaders/PathTracingVolume.hlsl | 22 +++++++-------- .../RaytracingIndirectDiffuse.compute | 12 ++++---- .../RaytracingIndirectDiffuse.raytrace | 8 +++--- .../Reflections/RaytracingReflections.compute | 28 +++++++++---------- .../RaytracingReflections.raytrace | 8 +++--- .../Shaders/Shadows/RaytracingMIS.hlsl | 4 +-- .../ShaderPassRaytracingIndirect.hlsl | 10 +++---- 14 files changed, 66 insertions(+), 66 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/Eye/EyeRaytracing.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Material/Eye/EyeRaytracing.hlsl index 8b4d16911e8..16b1c19ad51 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Material/Eye/EyeRaytracing.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Material/Eye/EyeRaytracing.hlsl @@ -1,10 +1,10 @@ -float3 SampleSpecularBRDF(BSDFData bsdfData, float2 sample, float3 viewWS) +float3 SampleSpecularBRDF(BSDFData bsdfData, float2 theSample, float3 viewWS) { float roughness = PerceptualRoughnessToRoughness(bsdfData.perceptualRoughness); float3x3 localToWorld = GetLocalFrame(bsdfData.normalWS); float NdotL, NdotH, VdotH; float3 sampleDir; - SampleGGXDir(sample, viewWS, localToWorld, roughness, sampleDir, NdotL, NdotH, VdotH); + SampleGGXDir(theSample, viewWS, localToWorld, roughness, sampleDir, NdotL, NdotH, VdotH); return sampleDir; } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/Fabric/FabricRaytracing.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Material/Fabric/FabricRaytracing.hlsl index 8bf02869b6c..e4253e588c7 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Material/Fabric/FabricRaytracing.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Material/Fabric/FabricRaytracing.hlsl @@ -1,4 +1,4 @@ -float3 SampleSpecularBRDF(BSDFData bsdfData, float2 sample, float3 viewWS) +float3 SampleSpecularBRDF(BSDFData bsdfData, float2 theSample, float3 viewWS) { float roughness = PerceptualRoughnessToRoughness(bsdfData.perceptualRoughness); float3x3 localToWorld; @@ -12,7 +12,7 @@ float3 SampleSpecularBRDF(BSDFData bsdfData, float2 sample, float3 viewWS) } float NdotL, NdotH, VdotH; float3 sampleDir; - SampleGGXDir(sample, viewWS, localToWorld, roughness, sampleDir, NdotL, NdotH, VdotH); + SampleGGXDir(theSample, viewWS, localToWorld, roughness, sampleDir, NdotL, NdotH, VdotH); return sampleDir; } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/Hair/HairRayTracing.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Material/Hair/HairRayTracing.hlsl index 96358e5e15c..de5545b89d6 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Material/Hair/HairRayTracing.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Material/Hair/HairRayTracing.hlsl @@ -1,11 +1,11 @@ -float3 SampleSpecularBRDF(BSDFData bsdfData, float2 sample, float3 viewWS) +float3 SampleSpecularBRDF(BSDFData bsdfData, float2 theSample, float3 viewWS) { float roughness = PerceptualRoughnessToRoughness(bsdfData.perceptualRoughness); float3x3 localToWorld = GetLocalFrame(bsdfData.normalWS); float NdotL, NdotH, VdotH; float3 sampleDir; - SampleGGXDir(sample, viewWS, localToWorld, roughness, sampleDir, NdotL, NdotH, VdotH); + SampleGGXDir(theSample, viewWS, localToWorld, roughness, sampleDir, NdotL, NdotH, VdotH); return sampleDir; } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitPathTracing.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitPathTracing.hlsl index 3ec50c5253f..1b1a93966a2 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitPathTracing.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitPathTracing.hlsl @@ -43,7 +43,7 @@ void ProcessBSDFData(PathIntersection pathIntersection, BuiltinData builtinData, #endif } -bool CreateMaterialData(PathIntersection pathIntersection, BuiltinData builtinData, BSDFData bsdfData, inout float3 shadingPosition, inout float sample, out MaterialData mtlData) +bool CreateMaterialData(PathIntersection pathIntersection, BuiltinData builtinData, BSDFData bsdfData, inout float3 shadingPosition, inout float theSample, out MaterialData mtlData) { // Alter values in the material's bsdfData struct, to better suit path tracing mtlData.bsdfData = bsdfData; @@ -95,7 +95,7 @@ bool CreateMaterialData(PathIntersection pathIntersection, BuiltinData builtinDa #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING float subsurfaceWeight = mtlData.bsdfWeight[0] * mtlData.bsdfData.subsurfaceMask * (1.0 - pathIntersection.maxRoughness); - mtlData.isSubsurface = sample < subsurfaceWeight; + mtlData.isSubsurface = theSample < subsurfaceWeight; if (mtlData.isSubsurface) { // We do a full, ray-traced subsurface scattering computation here: @@ -121,11 +121,11 @@ bool CreateMaterialData(PathIntersection pathIntersection, BuiltinData builtinDa mtlData.bsdfWeight[0] = max(mtlData.bsdfWeight[0] - subsurfaceWeight, BSDF_WEIGHT_EPSILON); mtlData.bsdfWeight /= mtlData.subsurfaceWeightFactor; - sample -= subsurfaceWeight; + theSample -= subsurfaceWeight; } // Rescale the sample we used for the SSS selection test - sample /= mtlData.subsurfaceWeightFactor; + theSample /= mtlData.subsurfaceWeightFactor; #endif return true; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitRaytracing.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitRaytracing.hlsl index 3b580bf736d..f41e3693372 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitRaytracing.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitRaytracing.hlsl @@ -1,4 +1,4 @@ -float3 SampleSpecularBRDF(BSDFData bsdfData, float2 sample, float3 viewWS) +float3 SampleSpecularBRDF(BSDFData bsdfData, float2 theSample, float3 viewWS) { float roughness = PerceptualRoughnessToRoughness(bsdfData.perceptualRoughness); float3x3 localToWorld; @@ -12,7 +12,7 @@ float3 SampleSpecularBRDF(BSDFData bsdfData, float2 sample, float3 viewWS) } float NdotL, NdotH, VdotH; float3 sampleDir; - SampleGGXDir(sample, viewWS, localToWorld, roughness, sampleDir, NdotL, NdotH, VdotH); + SampleGGXDir(theSample, viewWS, localToWorld, roughness, sampleDir, NdotL, NdotH, VdotH); return sampleDir; } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/StackLit/StackLitRayTracing.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Material/StackLit/StackLitRayTracing.hlsl index 9f5445f31f6..00a313bf445 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Material/StackLit/StackLitRayTracing.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Material/StackLit/StackLitRayTracing.hlsl @@ -1,4 +1,4 @@ -float3 SampleSpecularBRDF(BSDFData bsdfData, float2 sample, float3 viewWS) +float3 SampleSpecularBRDF(BSDFData bsdfData, float2 theSample, float3 viewWS) { float roughness = bsdfData.roughnessAT; float3x3 localToWorld; @@ -12,7 +12,7 @@ float3 SampleSpecularBRDF(BSDFData bsdfData, float2 sample, float3 viewWS) } float NdotL, NdotH, VdotH; float3 sampleDir; - SampleGGXDir(sample, viewWS, localToWorld, roughness, sampleDir, NdotL, NdotH, VdotH); + SampleGGXDir(theSample, viewWS, localToWorld, roughness, sampleDir, NdotL, NdotH, VdotH); return sampleDir; } diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/Shaders/PathTracingLight.hlsl b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/Shaders/PathTracingLight.hlsl index 00fcd6ab653..37b48c469f7 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/Shaders/PathTracingLight.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/Shaders/PathTracingLight.hlsl @@ -224,23 +224,23 @@ float GetDistantLightWeight(LightList list) return list.distantWeight / list.distantCount; } -bool PickLocalLights(LightList list, inout float sample) +bool PickLocalLights(LightList list, inout float theSample) { - if (sample < list.localWeight) + if (theSample < list.localWeight) { // We pick local lighting - sample /= list.localWeight; + theSample /= list.localWeight; return true; } // Otherwise, distant lighting - sample = (sample - list.localWeight) / list.distantWeight; + theSample = (theSample - list.localWeight) / list.distantWeight; return false; } -bool PickDistantLights(LightList list, inout float sample) +bool PickDistantLights(LightList list, inout float theSample) { - return !PickLocalLights(list, sample); + return !PickLocalLights(list, theSample); } float3 GetPunctualEmission(LightData lightData, float3 outgoingDir, float dist) diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/Shaders/PathTracingVolume.hlsl b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/Shaders/PathTracingVolume.hlsl index 750a4b5ff2c..d550fc0c611 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/Shaders/PathTracingVolume.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/Shaders/PathTracingVolume.hlsl @@ -10,7 +10,7 @@ float ComputeHeightFogMultiplier(float height) return ComputeHeightFogMultiplier(height, _HeightFogBaseHeight, _HeightFogExponents); } -bool SampleVolumeScatteringPosition(inout float sample, inout float t, inout float pdf, out bool sampleLocalLights) +bool SampleVolumeScatteringPosition(inout float theSample, inout float t, inout float pdf, out bool sampleLocalLights) { sampleLocalLights = false; @@ -28,14 +28,14 @@ bool SampleVolumeScatteringPosition(inout float sample, inout float t, inout flo if (localWeight < 0.0) return false; - sampleLocalLights = sample < localWeight; + sampleLocalLights = theSample < localWeight; if (sampleLocalLights) { tMax = min(tMax, tFog); if (tMin >= tMax) return false; - sample /= localWeight; + theSample /= localWeight; pdfVol *= localWeight; } else @@ -43,8 +43,8 @@ bool SampleVolumeScatteringPosition(inout float sample, inout float t, inout flo tMin = 0.0; tMax = tFog; - sample -= localWeight; - sample /= 1.0 - localWeight; + theSample -= localWeight; + theSample /= 1.0 - localWeight; pdfVol *= 1.0 - localWeight; } #else @@ -57,11 +57,11 @@ bool SampleVolumeScatteringPosition(inout float sample, inout float t, inout flo const float transmittanceTMax = max(exp(-tMax * sigmaT), 0.01); const float transmittanceThreshold = t < FLT_MAX ? 1.0 - min(0.5, transmittanceTMax) : 1.0; - if (sample >= transmittanceThreshold) + if (theSample >= transmittanceThreshold) { // Re-scale the sample - sample -= transmittanceThreshold; - sample /= 1.0 - transmittanceThreshold; + theSample -= transmittanceThreshold; + theSample /= 1.0 - transmittanceThreshold; // Adjust the pdf pdf *= 1.0 - transmittanceThreshold; @@ -70,7 +70,7 @@ bool SampleVolumeScatteringPosition(inout float sample, inout float t, inout flo } // Re-scale the sample - sample /= transmittanceThreshold; + theSample /= transmittanceThreshold; // Adjust the pdf pdf *= pdfVol * transmittanceThreshold; @@ -79,7 +79,7 @@ bool SampleVolumeScatteringPosition(inout float sample, inout float t, inout flo { // Linear sampling float deltaT = tMax - tMin; - t = tMin + sample * deltaT; + t = tMin + theSample * deltaT; // Adjust the pdf pdf /= deltaT; @@ -87,7 +87,7 @@ bool SampleVolumeScatteringPosition(inout float sample, inout float t, inout flo else { // Exponential sampling - float transmittance = transmittanceTMax + sample * (1.0 - transmittanceTMax); + float transmittance = transmittanceTMax + theSample * (1.0 - transmittanceTMax); t = -log(transmittance) / sigmaT; // Adjust the pdf diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/IndirectDiffuse/RaytracingIndirectDiffuse.compute b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/IndirectDiffuse/RaytracingIndirectDiffuse.compute index d23b95719ea..93bca209e7a 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/IndirectDiffuse/RaytracingIndirectDiffuse.compute +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/IndirectDiffuse/RaytracingIndirectDiffuse.compute @@ -107,12 +107,12 @@ void RaytracingIndirectDiffuseFullRes(uint3 dispatchThreadId : SV_DispatchThread DecodeFromNormalBuffer(currentCoord, normalData); // Generate the new sample (follwing values of the sequence) - float2 sample; - sample.x = GetBNDSequenceSample(currentCoord, _RaytracingFrameIndex, 0); - sample.y = GetBNDSequenceSample(currentCoord, _RaytracingFrameIndex, 1); + float2 theSample; + theSample.x = GetBNDSequenceSample(currentCoord, _RaytracingFrameIndex, 0); + theSample.y = GetBNDSequenceSample(currentCoord, _RaytracingFrameIndex, 1); // Importance sample with a cosine lobe - float3 sampleDir = SampleHemisphereCosine(sample.x, sample.y, normalData.normalWS); + float3 sampleDir = SampleHemisphereCosine(theSample.x, theSample.y, normalData.normalWS); // PDF is the cosine float samplePDF = dot(sampleDir, normalData.normalWS); @@ -209,8 +209,8 @@ void INDIRECT_DIFFUSE_INTEGRATION_UPSCALE(uint3 dispatchThreadId : SV_DispatchTh if(sampleDepth == UNITY_RAW_FAR_CLIP_VALUE) continue; // Compute the target pixel that it will impact - float sample = _BlueNoiseTexture[int3(relativeHRShift, noiseIndex)].x; - int index = clamp(floor(sample * 4.0f), 0, 3); + float theSample = _BlueNoiseTexture[int3(relativeHRShift, noiseIndex)].x; + int index = clamp(floor(theSample * 4.0f), 0, 3); if (index != localIndex) continue; diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/IndirectDiffuse/RaytracingIndirectDiffuse.raytrace b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/IndirectDiffuse/RaytracingIndirectDiffuse.raytrace index 39f60de2f57..ddc690de4d3 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/IndirectDiffuse/RaytracingIndirectDiffuse.raytrace +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/IndirectDiffuse/RaytracingIndirectDiffuse.raytrace @@ -90,12 +90,12 @@ void RayGenIntegration() int globalSampleIndex = _RaytracingFrameIndex * _RaytracingNumSamples + sampleIndex; // Generate the new sample (follwing values of the sequence) - float2 sample; - sample.x = GetBNDSequenceSample(currentCoord, globalSampleIndex, 0); - sample.y = GetBNDSequenceSample(currentCoord, globalSampleIndex, 1); + float2 theSample; + theSample.x = GetBNDSequenceSample(currentCoord, globalSampleIndex, 0); + theSample.y = GetBNDSequenceSample(currentCoord, globalSampleIndex, 1); // Importance sample with a cosine lobe - float3 sampleDir = SampleHemisphereCosine(sample.x, sample.y, normalData.normalWS); + float3 sampleDir = SampleHemisphereCosine(theSample.x, theSample.y, normalData.normalWS); // Create the ray descriptor for this pixel RayDesc rayDescriptor; diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Reflections/RaytracingReflections.compute b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Reflections/RaytracingReflections.compute index ecf3caa573c..367c45f652f 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Reflections/RaytracingReflections.compute +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Reflections/RaytracingReflections.compute @@ -94,14 +94,14 @@ void RaytracingReflectionsHalfRes(uint3 dispatchThreadId : SV_DispatchThreadID, int globalSampleIndex = _RaytracingFrameIndex; // Generate the new sample (follwing values of the sequence) - float2 sample; - sample.x = GetBNDSequenceSample(halfResCoord, globalSampleIndex, 0); - sample.y = GetBNDSequenceSample(halfResCoord, globalSampleIndex, 1); + float2 theSample; + theSample.x = GetBNDSequenceSample(halfResCoord, globalSampleIndex, 0); + theSample.y = GetBNDSequenceSample(halfResCoord, globalSampleIndex, 1); // Importance sample the direction float3 sampleDir = float3(0.0, 0.0, 0.0); float NdotL, NdotH, VdotH; - SampleGGXDir(sample, viewWS, localToWorld, roughness, sampleDir, NdotL, NdotH, VdotH); + SampleGGXDir(theSample, viewWS, localToWorld, roughness, sampleDir, NdotL, NdotH, VdotH); // If this direction is under the surface, let's generate a new one that won't be // TODO: use Eric's paper on visible normal distribution sampling @@ -111,9 +111,9 @@ void RaytracingReflectionsHalfRes(uint3 dispatchThreadId : SV_DispatchThreadID, if (dot(sampleDir, normalData.normalWS) >= 0.00f) break; - sample.x = GetBNDSequenceSample(halfResCoord, globalSampleIndex + i, 0); - sample.y = GetBNDSequenceSample(halfResCoord, globalSampleIndex + i, 1); - SampleGGXDir(sample, viewWS, localToWorld, roughness, sampleDir, NdotL, NdotH, VdotH); + theSample.x = GetBNDSequenceSample(halfResCoord, globalSampleIndex + i, 0); + theSample.y = GetBNDSequenceSample(halfResCoord, globalSampleIndex + i, 1); + SampleGGXDir(theSample, viewWS, localToWorld, roughness, sampleDir, NdotL, NdotH, VdotH); } // If we were not able to generate a direction over the surface, we are done @@ -231,14 +231,14 @@ void RaytracingReflectionsFullRes(uint3 dispatchThreadId : SV_DispatchThreadID, // Generate the new sample (follwing values of the sequence) int globalSampleIndex = _RaytracingFrameIndex; - float2 sample; - sample.x = GetBNDSequenceSample(currentCoord, globalSampleIndex, 0); - sample.y = GetBNDSequenceSample(currentCoord, globalSampleIndex, 1); + float2 theSample; + theSample.x = GetBNDSequenceSample(currentCoord, globalSampleIndex, 0); + theSample.y = GetBNDSequenceSample(currentCoord, globalSampleIndex, 1); // Importance sample the direction float3 sampleDir = float3(0.0, 0.0, 0.0); float NdotL, NdotH, VdotH; - SampleGGXDir(sample, viewWS, localToWorld, roughness, sampleDir, NdotL, NdotH, VdotH); + SampleGGXDir(theSample, viewWS, localToWorld, roughness, sampleDir, NdotL, NdotH, VdotH); // If this direction is under the surface, let's generate a new one that won't be // TODO: use Eric's paper on visible normal distribution sampling @@ -248,9 +248,9 @@ void RaytracingReflectionsFullRes(uint3 dispatchThreadId : SV_DispatchThreadID, if (dot(sampleDir, normalData.normalWS) >= 0.00f) break; - sample.x = GetBNDSequenceSample(currentCoord, globalSampleIndex + i, 0); - sample.y = GetBNDSequenceSample(currentCoord, globalSampleIndex + i, 1); - SampleGGXDir(sample, viewWS, localToWorld, roughness, sampleDir, NdotL, NdotH, VdotH); + theSample.x = GetBNDSequenceSample(currentCoord, globalSampleIndex + i, 0); + theSample.y = GetBNDSequenceSample(currentCoord, globalSampleIndex + i, 1); + SampleGGXDir(theSample, viewWS, localToWorld, roughness, sampleDir, NdotL, NdotH, VdotH); } // If we were not able to generate a direction over the surface, we are done diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Reflections/RaytracingReflections.raytrace b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Reflections/RaytracingReflections.raytrace index 069213daa87..7b4ce4cd058 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Reflections/RaytracingReflections.raytrace +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Reflections/RaytracingReflections.raytrace @@ -112,14 +112,14 @@ void RayGenIntegration() int globalSampleIndex = _RaytracingFrameIndex * realSampleCount + sampleIndex; // Generate the new sample (follwing values of the sequence) - float2 sample; - sample.x = GetBNDSequenceSample(currentCoord, globalSampleIndex, 0); - sample.y = GetBNDSequenceSample(currentCoord, globalSampleIndex, 1); + float2 theSample; + theSample.x = GetBNDSequenceSample(currentCoord, globalSampleIndex, 0); + theSample.y = GetBNDSequenceSample(currentCoord, globalSampleIndex, 1); // Importance sample the direction using GGX float3 sampleDir = float3(0.0, 0.0, 0.0); float NdotL, NdotH, VdotH; - SampleGGXDir(sample, viewWS, localToWorld, roughness, sampleDir, NdotL, NdotH, VdotH); + SampleGGXDir(theSample, viewWS, localToWorld, roughness, sampleDir, NdotL, NdotH, VdotH); // If the sample is under the surface if (dot(sampleDir, normalData.normalWS) <= 0.0) diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Shadows/RaytracingMIS.hlsl b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Shadows/RaytracingMIS.hlsl index ac265c35f69..e80be2623bc 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Shadows/RaytracingMIS.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Shadows/RaytracingMIS.hlsl @@ -188,9 +188,9 @@ bool GenerateMISSample(inout MISSamplingInput misInput, SphQuad squad, float3 vi return validity; } -void GenerateLightSample(float3 positionWS, float2 sample, SphQuad squad, float3 viewVector, out LightSamplingOutput lightSamplingOutput) +void GenerateLightSample(float3 positionWS, float2 theSample, SphQuad squad, float3 viewVector, out LightSamplingOutput lightSamplingOutput) { - lightSamplingOutput.pos = SphQuadSample(squad, sample.x, sample.y); + lightSamplingOutput.pos = SphQuadSample(squad, theSample.x, theSample.y); lightSamplingOutput.dir = normalize(lightSamplingOutput.pos - positionWS); lightSamplingOutput.lightPDF = 1.0f / squad.S; } diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingIndirect.hlsl b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingIndirect.hlsl index 9ea6f4f1275..5edc7db246d 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingIndirect.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingIndirect.hlsl @@ -56,18 +56,18 @@ void ClosestHitMain(inout RayIntersection rayIntersection : SV_RayPayload, Attri if (rayIntersection.remainingDepth < _RaytracingMaxRecursion) { // Generate the new sample (follwing values of the sequence) - float2 sample = float2(0.0, 0.0); - sample.x = GetBNDSequenceSample(rayIntersection.pixelCoord, rayIntersection.sampleIndex, rayIntersection.remainingDepth * 2); - sample.y = GetBNDSequenceSample(rayIntersection.pixelCoord, rayIntersection.sampleIndex, rayIntersection.remainingDepth * 2 + 1); + float2 theSample = float2(0.0, 0.0); + theSample.x = GetBNDSequenceSample(rayIntersection.pixelCoord, rayIntersection.sampleIndex, rayIntersection.remainingDepth * 2); + theSample.y = GetBNDSequenceSample(rayIntersection.pixelCoord, rayIntersection.sampleIndex, rayIntersection.remainingDepth * 2 + 1); float3 sampleDir; if (_RayTracingDiffuseLightingOnly) { - sampleDir = SampleHemisphereCosine(sample.x, sample.y, bsdfData.normalWS); + sampleDir = SampleHemisphereCosine(theSample.x, theSample.y, bsdfData.normalWS); } else { - sampleDir = SampleSpecularBRDF(bsdfData, sample, viewWS); + sampleDir = SampleSpecularBRDF(bsdfData, theSample, viewWS); } // Create the ray descriptor for this pixel From de90507c4882605dbc1e33546ab53e9c5d97eb63 Mon Sep 17 00:00:00 2001 From: sebastienlagarde Date: Thu, 21 Jan 2021 19:04:35 +0100 Subject: [PATCH 6/9] [HDRP] Merge Hd/bugfix #3222 --- com.unity.render-pipelines.core/Editor/LookDev/LookDev.cs | 7 ++++++- com.unity.render-pipelines.high-definition/CHANGELOG.md | 6 ++++++ .../Documentation~/hair-shader.md | 6 +++--- .../Editor/BuildProcessors/HDRPPreprocessBuild.cs | 2 ++ .../Editor/Lighting/HDLightUI.cs | 8 ++++---- .../ShaderGraph/DiffusionProfileShaderProperty.cs | 2 +- .../Editor/Material/ShaderGraph/HDSubShaderUtilities.cs | 8 ++++++++ .../Material/ShaderGraph/SurfaceOptionPropertyBlock.cs | 5 +++++ .../Runtime/PostProcessing/PostProcessSystem.cs | 6 +++--- .../Runtime/ShaderLibrary/UpsampleTransparent.shader | 8 +++++--- 10 files changed, 43 insertions(+), 15 deletions(-) diff --git a/com.unity.render-pipelines.core/Editor/LookDev/LookDev.cs b/com.unity.render-pipelines.core/Editor/LookDev/LookDev.cs index 6548aa12bef..589ea1e56a8 100644 --- a/com.unity.render-pipelines.core/Editor/LookDev/LookDev.cs +++ b/com.unity.render-pipelines.core/Editor/LookDev/LookDev.cs @@ -237,7 +237,12 @@ static void LinkViewDisplayer() static void LinkEnvironmentDisplayer() { - s_EnvironmentDisplayer.OnChangingEnvironmentLibrary += currentContext.UpdateEnvironmentLibrary; + s_EnvironmentDisplayer.OnChangingEnvironmentLibrary += UpdateEnvironmentLibrary; + } + + static void UpdateEnvironmentLibrary(EnvironmentLibrary library) + { + LookDev.currentContext.UpdateEnvironmentLibrary(library); } static void ReloadStage(bool reloadWithTemporaryID) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 1214031cf38..4a1743b9db2 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -76,6 +76,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed shadow matte not working with ambient occlusion when MSAA is enabled - Fixed issues with compositor's undo (cases 1305633, 1307170). - VFX : Debug material view incorrect depth test. (case 1293291) +- Fixed exception when changing the current render pipeline to from HDRP to universal (case 1306291). +- Fixed an issue in shadergraph when switch from a RenderingPass (case 1307653) +- Fixed LookDev environment library assignement after leaving playmode. +- Fixed a locale issue with the diffusion profile property values in ShaderGraph on PC where comma is the decimal separator. +- Fixed error in the RTHandle scale of Depth Of Field when TAA is enabled. +- Fixed Quality Level set to the last one of the list after a Build (case 1307450) ### Changed - Now reflection probes cannot have SSAO, SSGI, SSR, ray tracing effects or volumetric reprojection. diff --git a/com.unity.render-pipelines.high-definition/Documentation~/hair-shader.md b/com.unity.render-pipelines.high-definition/Documentation~/hair-shader.md index 5bd12f46493..b5fa650152f 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/hair-shader.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/hair-shader.md @@ -49,10 +49,10 @@ New Materials in HDRP use the [Lit shader](Lit-Shader.md) by default. To create | **Smoothness UV Scale Transform** | Sets the tiling rate (xy) and offsets (zw) for the Smoothness Mask Map. | | **Smoothness Min** | Set the minimum smoothness for this Material. | | **Smoothness Max** | Set the maximum smoothness for this Material. | -| **Specular Color** | Set the color of the primary specular highlight. | -| **Specular Multiplier** | Modifies the **Specular Color** by this multiplier. | +| **Specular Color** | Set the representative color of the highlight that Unity uses to drive both the primary specular highlight color, which is mainly monochrome, and the secondary specular highlight color, which is chromatic.| +| **Specular Multiplier** | Modifies the primary specular highlight by this multiplier. | | **Specular Shift** | Modifies the position of the primary specular highlight. | -| **Secondary Specular Multiplier** | Modifies the **Secondary Specular Color** by this multiplier. | +| **Secondary Specular Multiplier** | Modifies the secondary specular highlight by this multiplier. | | **Secondary Specular Shift** | Modifies the position of the secondary specular highlight | | **Transmission Color** | Set the fraction of specular lighting that penetrates the hair from behind. This is on a per-color channel basis so you can use this property to set the color of penetrating light. Set this to (0, 0, 0) to stop any light from penetrating through the hair. Set this to (1, 1, 1) to have a strong effect with a lot of white light transmitting through the hair. | | **Transmission Rim** | Set the intensity of back lit hair around the edge of the hair. Set this to 0 to completely remove the transmission effect. | diff --git a/com.unity.render-pipelines.high-definition/Editor/BuildProcessors/HDRPPreprocessBuild.cs b/com.unity.render-pipelines.high-definition/Editor/BuildProcessors/HDRPPreprocessBuild.cs index 5dd02bd5e59..db02cdac968 100644 --- a/com.unity.render-pipelines.high-definition/Editor/BuildProcessors/HDRPPreprocessBuild.cs +++ b/com.unity.render-pipelines.high-definition/Editor/BuildProcessors/HDRPPreprocessBuild.cs @@ -59,6 +59,7 @@ public void OnPreprocessBuild(BuildReport report) // Update all quality levels with the right max lod so that meshes can be stripped. // We don't take lod bias into account because it can be overridden per camera. + int currentQualityLevel = QualitySettings.GetQualityLevel(); int qualityLevelCount = QualitySettings.names.Length; for (int i = 0; i < qualityLevelCount; ++i) { @@ -73,6 +74,7 @@ public void OnPreprocessBuild(BuildReport report) QualitySettings.maximumLODLevel = GetMinimumMaxLoDValue(hdPipelineAsset); } } + QualitySettings.SetQualityLevel(currentQualityLevel, false); } } } diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.cs index 174670bdb20..bc2872dd82d 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.cs @@ -29,7 +29,7 @@ public static IntScalableSetting ShadowResolution(HDLightType lightType, HDRende enum ShadowmaskMode { - ShadowMask, + Shadowmask, DistanceShadowmask } @@ -1082,14 +1082,14 @@ static void DrawShadowMapContent(SerializedHDLight serialized, Editor owner) EditorGUI.BeginProperty(nonLightmappedOnlyRect, s_Styles.nonLightmappedOnly, serialized.nonLightmappedOnly); { EditorGUI.BeginChangeCheck(); - ShadowmaskMode shadowmask = serialized.nonLightmappedOnly.boolValue ? ShadowmaskMode.ShadowMask : ShadowmaskMode.DistanceShadowmask; + ShadowmaskMode shadowmask = serialized.nonLightmappedOnly.boolValue ? ShadowmaskMode.Shadowmask : ShadowmaskMode.DistanceShadowmask; shadowmask = (ShadowmaskMode)EditorGUI.EnumPopup(nonLightmappedOnlyRect, s_Styles.nonLightmappedOnly, shadowmask); if (EditorGUI.EndChangeCheck()) { Undo.RecordObjects(owner.targets, "Light Update Shadowmask Mode"); - serialized.nonLightmappedOnly.boolValue = shadowmask == ShadowmaskMode.ShadowMask; + serialized.nonLightmappedOnly.boolValue = shadowmask == ShadowmaskMode.Shadowmask; foreach (Light target in owner.targets) - target.lightShadowCasterMode = shadowmask == ShadowmaskMode.ShadowMask ? LightShadowCasterMode.NonLightmappedOnly : LightShadowCasterMode.Everything; + target.lightShadowCasterMode = shadowmask == ShadowmaskMode.Shadowmask ? LightShadowCasterMode.NonLightmappedOnly : LightShadowCasterMode.Everything; } } EditorGUI.EndProperty(); diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/DiffusionProfileShaderProperty.cs b/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/DiffusionProfileShaderProperty.cs index f1d7ba49d41..51285c72da5 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/DiffusionProfileShaderProperty.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/DiffusionProfileShaderProperty.cs @@ -40,7 +40,7 @@ internal override string GetPropertyBlockString() } /// Float to string convertion function without any loss of precision - string f2s(float f) => System.Convert.ToDouble(f).ToString("0." + new string('#', 339)); + string f2s(float f) => System.Convert.ToDouble(f).ToString("0." + new string('#', 339), CultureInfo.InvariantCulture); return $@"[DiffusionProfile]{referenceName}(""{displayName}"", Float) = {f2s(HDShadowUtils.Asfloat(hash))} diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/HDSubShaderUtilities.cs b/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/HDSubShaderUtilities.cs index 29d78c28cb3..69bb4592241 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/HDSubShaderUtilities.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/HDSubShaderUtilities.cs @@ -266,6 +266,14 @@ public static string RenderQueueName(HDRenderQueue.RenderQueueType value) return result; } + public static bool IsValidRenderingPassValue(HDRenderQueue.RenderQueueType value, bool needAfterPostProcess) + { + if (!needAfterPostProcess && (value == HDRenderQueue.RenderQueueType.AfterPostProcessOpaque || value == HDRenderQueue.RenderQueueType.AfterPostprocessTransparent)) + return false; + + return true; + } + public static bool UpgradeLegacyAlphaClip(IMasterNode1 masterNode) { var clipThresholdId = 8; diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/SurfaceOptionPropertyBlock.cs b/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/SurfaceOptionPropertyBlock.cs index dc3290a3f0e..d54ff9f0567 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/SurfaceOptionPropertyBlock.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/SurfaceOptionPropertyBlock.cs @@ -48,6 +48,11 @@ protected override void CreatePropertyGUI() context.globalIndentLevel++; var renderingPassList = HDSubShaderUtilities.GetRenderingPassList(systemData.surfaceType == SurfaceType.Opaque, enabledFeatures == Features.Unlit); // Show after post process for unlit shaders var renderingPassValue = systemData.surfaceType == SurfaceType.Opaque ? HDRenderQueue.GetOpaqueEquivalent(systemData.renderQueueType) : HDRenderQueue.GetTransparentEquivalent(systemData.renderQueueType); + // It is possible when switching from Unlit with an after postprocess pass to any kind of lit shader to get an out of array value. In this case we switch back to default. + if (!HDSubShaderUtilities.IsValidRenderingPassValue(renderingPassValue, enabledFeatures == Features.Unlit)) + { + renderingPassValue = systemData.surfaceType == SurfaceType.Opaque ? HDRenderQueue.RenderQueueType.Opaque : HDRenderQueue.RenderQueueType.Transparent; + } var renderQueueType = systemData.surfaceType == SurfaceType.Opaque ? HDRenderQueue.RenderQueueType.Opaque : HDRenderQueue.RenderQueueType.Transparent; context.AddProperty(renderingPassText, new PopupField(renderingPassList, renderQueueType, HDSubShaderUtilities.RenderQueueName, HDSubShaderUtilities.RenderQueueName) { value = renderingPassValue }, (evt) => diff --git a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs index abfee3f351f..38119e7e393 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs @@ -2115,9 +2115,9 @@ static void DoDepthOfField(in DepthOfFieldParameters dofParameters, CommandBuffe float nearMaxBlur = dofParameters.nearMaxBlur * resolutionScale; // If TAA is enabled we use the camera history system to grab CoC history textures, but - // because these don't use the same RTHandle system as the global one we'll have a - // different scale than _RTHandleScale so we need to handle our own - var cocHistoryScale = RTHandles.rtHandleProperties.rtHandleScale; + // because these don't use the same RTHandleScale as the global one, we need to use + // the RTHandleScale of the history RTHandles + var cocHistoryScale = taaEnabled ? dofParameters.camera.historyRTHandleProperties.rtHandleScale : RTHandles.rtHandleProperties.rtHandleScale; ComputeShader cs; int kernel; diff --git a/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/UpsampleTransparent.shader b/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/UpsampleTransparent.shader index 5b99327ae47..605cb117cfa 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/UpsampleTransparent.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/UpsampleTransparent.shader @@ -49,9 +49,7 @@ Shader "Hidden/HDRP/UpsampleTransparent" float2 fullResTexelSize = _ScreenSize.zw; float2 halfResTexelSize = 2.0f * fullResTexelSize; - #ifdef BILINEAR - return SAMPLE_TEXTURE2D_X_LOD(_LowResTransparent, s_linear_clamp_sampler, ClampAndScaleUVForBilinear(uv, halfResTexelSize), 0.0); - #elif NEAREST_DEPTH + #ifdef NEAREST_DEPTH // The following is an implementation of NVIDIA's http://developer.download.nvidia.com/assets/gamedev/files/sdk/11/OpacityMappingSDKWhitePaper.pdf @@ -101,6 +99,10 @@ Shader "Hidden/HDRP/UpsampleTransparent" return SAMPLE_TEXTURE2D_X_LOD(_LowResTransparent, s_point_clamp_sampler, ClampAndScaleUVForPoint(nearestUV), 0); #endif } + #else // BILINEAR + + return SAMPLE_TEXTURE2D_X_LOD(_LowResTransparent, s_linear_clamp_sampler, ClampAndScaleUVForBilinear(uv, halfResTexelSize), 0.0); + #endif } From 3ab6fabcfef4be092df57ccac398e9a9772bcae0 Mon Sep 17 00:00:00 2001 From: Fabien Houlmann <44069206+fabien-unity@users.noreply.github.com> Date: Thu, 21 Jan 2021 16:10:17 -0500 Subject: [PATCH 7/9] Fix XR depth copy #3200 --- .../CHANGELOG.md | 1 + .../RenderPipeline/HDRenderPipeline.RenderGraph.cs | 10 +++++++--- .../Runtime/ShaderLibrary/CopyDepthBuffer.shader | 3 ++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 4a1743b9db2..ba554b147cb 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -82,6 +82,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed a locale issue with the diffusion profile property values in ShaderGraph on PC where comma is the decimal separator. - Fixed error in the RTHandle scale of Depth Of Field when TAA is enabled. - Fixed Quality Level set to the last one of the list after a Build (case 1307450) +- Fixed XR depth copy (case 1286908). ### Changed - Now reflection probes cannot have SSAO, SSGI, SSR, ray tracing effects or volumetric reprojection. diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs index bceadfe725d..7bec78fc442 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs @@ -390,6 +390,7 @@ void SetFinalTarget(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle de #if UNITY_EDITOR passData.copyDepth = passData.copyDepth || hdCamera.isMainGameView; // Specific case of Debug.DrawLine and Debug.Ray #endif + passData.copyDepth = passData.copyDepth && !hdCamera.xr.enabled; passData.copyDepthMaterial = m_CopyDepth; passData.finalTarget = builder.WriteTexture(finalTarget); passData.finalViewport = hdCamera.finalViewport; @@ -425,6 +426,7 @@ class CopyXRDepthPassData public Rect viewport; public TextureHandle depthBuffer; public TextureHandle output; + public float dynamicResolutionScale; } void CopyXRDepth(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle depthBuffer, TextureHandle output) @@ -438,6 +440,7 @@ void CopyXRDepth(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle depth passData.viewport = hdCamera.finalViewport; passData.depthBuffer = builder.ReadTexture(depthBuffer); passData.output = builder.WriteTexture(output); + passData.dynamicResolutionScale = DynamicResolutionHandler.instance.GetCurrentScale(); builder.SetRenderFunc( (CopyXRDepthPassData data, RenderGraphContext ctx) => @@ -445,9 +448,10 @@ void CopyXRDepth(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle depth var mpb = ctx.renderGraphPool.GetTempMaterialPropertyBlock(); RTHandle depthRT = data.depthBuffer; - mpb.SetTexture(HDShaderIDs._InputDepth, data.depthBuffer); - mpb.SetVector(HDShaderIDs._BlitScaleBias, depthRT.rtHandleProperties.rtHandleScale / DynamicResolutionHandler.instance.GetCurrentScale()); - mpb.SetInt("_FlipY", 1); + mpb.SetTexture(HDShaderIDs._InputDepth, data.depthBuffer); + mpb.SetVector(HDShaderIDs._BlitScaleBias, new Vector4(data.dynamicResolutionScale, data.dynamicResolutionScale, 0.0f, 0.0f)); + mpb.SetInt("_FlipY", 1); + ctx.cmd.SetRenderTarget(data.output, 0, CubemapFace.Unknown, -1); ctx.cmd.SetViewport(data.viewport); diff --git a/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/CopyDepthBuffer.shader b/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/CopyDepthBuffer.shader index a6a74c576c0..d1c573c257e 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/CopyDepthBuffer.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/CopyDepthBuffer.shader @@ -59,11 +59,12 @@ Shader "Hidden/HDRP/CopyDepthBuffer" UNITY_SETUP_INSTANCE_ID(input); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); output.positionCS = GetFullScreenTriangleVertexPosition(input.vertexID); - output.texcoord = GetFullScreenTriangleTexCoord(input.vertexID) * _BlitScaleBias.xy; + output.texcoord = GetFullScreenTriangleTexCoord(input.vertexID); if (_FlipY) { output.texcoord.y = 1.0 - output.texcoord.y; } + output.texcoord *= _BlitScaleBias.xy; return output; } From 0fc26cea39f4bb104d7657d672c8142a34a4af27 Mon Sep 17 00:00:00 2001 From: Sebastien Lagarde Date: Thu, 21 Jan 2021 23:16:54 +0100 Subject: [PATCH 8/9] Revert "Fixed a regression introduced when changing the clamping algorithm for RTR and RTGI (case 1307479). #3206 bis" This reverts commit 6f560e75aea817b22e792e5d1dcb09850d66c4d3. --- .../None/105_ReflectionsAndGlobalIlluminationCollision.png | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/105_ReflectionsAndGlobalIlluminationCollision.png b/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/105_ReflectionsAndGlobalIlluminationCollision.png index 3b7058becbb..a344cdf5584 100644 --- a/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/105_ReflectionsAndGlobalIlluminationCollision.png +++ b/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/105_ReflectionsAndGlobalIlluminationCollision.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:03ff26103e2bfa2aff02adfd4a2bcee41c3f7b7791a988a98e8b86a25b902985 -size 370 +oid sha256:4c3c3a68385575746c4160e0a837422344e321f207ccd0ee578e6545328080fe +size 401182 From eb30a614c97862b574a8a82a666222f04f28c32e Mon Sep 17 00:00:00 2001 From: Sebastien Lagarde Date: Thu, 21 Jan 2021 23:19:21 +0100 Subject: [PATCH 9/9] Update 105_ReflectionsAndGlobalIlluminationCollision.png --- .../None/105_ReflectionsAndGlobalIlluminationCollision.png | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/105_ReflectionsAndGlobalIlluminationCollision.png b/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/105_ReflectionsAndGlobalIlluminationCollision.png index a344cdf5584..02be2784b14 100644 --- a/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/105_ReflectionsAndGlobalIlluminationCollision.png +++ b/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/105_ReflectionsAndGlobalIlluminationCollision.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4c3c3a68385575746c4160e0a837422344e321f207ccd0ee578e6545328080fe -size 401182 +oid sha256:87c358823af653bf117e063be044299b58e159522b24f376b1d72cbe0b63ab3f +size 451837