diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 2bb26376f33..a7217061590 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -72,6 +72,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed missing option to use POM on emissive for tessellated shaders. - Fixed an issue in the planar reflection probe convolution. - Fixed an issue with debug overriding emissive material color for deferred path (case 1313123). +- Fixed a limit case when the camera is exactly at the lower cloud level (case 1316988). +- Fixed the various history buffers being discarded when the fog was enabled/disabled (case 1316072). ### Changed - Changed Window/Render Pipeline/HD Render Pipeline Wizard to Window/Rendering/HDRP Wizard diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricClouds.compute b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricClouds.compute index 4281d2679d6..5eb8759891a 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricClouds.compute +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricClouds.compute @@ -162,7 +162,7 @@ CloudRay BuildRay(uint2 halfResCoord) // 1.0 means above the cloud domain if (ray.toEarthCenter < _EarthRadius) ray.insideClouds = -2.0; - else if (ray.toEarthCenter < (_LowestCloudAltitude + _EarthRadius)) + else if (ray.toEarthCenter <= (_LowestCloudAltitude + _EarthRadius)) ray.insideClouds = -1.0; else if (ray.toEarthCenter > (_HighestCloudAltitude + _EarthRadius)) ray.insideClouds = 1.0f; 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 590140cffb8..d3b2675e2ce 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 @@ -564,35 +564,35 @@ internal void Update(FrameSettings currentFrameSettings, HDRenderPipeline hdrp, if (isHistoryColorPyramidRequired) // Superset of case above numColorPyramidBuffersRequired = 2; - int numVolumetricBuffersRequired = isVolumetricHistoryRequired ? 2 : 0; // History + feedback - - if ((m_NumColorPyramidBuffersAllocated != numColorPyramidBuffersRequired) || - (m_NumVolumetricBuffersAllocated != numVolumetricBuffersRequired)) + // Handle the color buffers + if (m_NumColorPyramidBuffersAllocated != numColorPyramidBuffersRequired) { // Reinit the system. colorPyramidHistoryIsValid = false; // Since we nuke all history we must inform the post process system too. resetPostProcessingHistory = true; - HDRenderPipeline.DestroyVolumetricHistoryBuffers(this); - // The history system only supports the "nuke all" option. + // TODO: Fix this, only the color buffers should be discarded. m_HistoryRTSystem.Dispose(); m_HistoryRTSystem = new BufferedRTHandleSystem(); if (numColorPyramidBuffersRequired != 0) - { AllocHistoryFrameRT((int)HDCameraFrameHistoryType.ColorBufferMipChain, HistoryBufferAllocatorFunction, numColorPyramidBuffersRequired); - } + // Mark as init. + m_NumColorPyramidBuffersAllocated = numColorPyramidBuffersRequired; + } + + // Handle the volumetric fog buffers + int numVolumetricBuffersRequired = isVolumetricHistoryRequired ? 2 : 0; // History + feedback + if (m_NumVolumetricBuffersAllocated != numVolumetricBuffersRequired) + { + HDRenderPipeline.DestroyVolumetricHistoryBuffers(this); if (numVolumetricBuffersRequired != 0) - { HDRenderPipeline.CreateVolumetricHistoryBuffers(this, numVolumetricBuffersRequired); - } - // Mark as init. - m_NumColorPyramidBuffersAllocated = numColorPyramidBuffersRequired; - m_NumVolumetricBuffersAllocated = numVolumetricBuffersRequired; + m_NumVolumetricBuffersAllocated = numVolumetricBuffersRequired; } }