diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 6ff40a07cad..c13edbec416 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -169,6 +169,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed NaNs when denoising pixels where the dot product between normal and view direction is near zero (case 1329624). - Fixed ray traced reflections that were too dark for unlit materials. Reflections are now more consistent with the material emissiveness. - Fixed pyramid color being incorrect when hardware dynamic resolution is enabled. +- Fixed SSR Accumulation with Offset with Viewport Rect Offset on Camera ### 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/ScreenSpaceLighting/ScreenSpaceReflections.compute b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceReflections.compute index 59b248826a0..8206440f6d4 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceReflections.compute +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceReflections.compute @@ -687,8 +687,10 @@ void ScreenSpaceReflectionsAccumulate(uint3 dispatchThreadId : SV_DispatchThread DecodeFromNormalBuffer(hitSS, hitNormalData); float3 hitN = hitNormalData.normalWS; + float2 prevHistoryScale = _RTHandleScaleHistory.zw / _RTHandleScaleHistory.xy; + float4 original = _SSRAccumTexture[COORD_TEXTURE2D_X(positionSS)]; - float4 previous = _SsrAccumPrev[COORD_TEXTURE2D_X(positionSS * _RTHandleScaleHistory.zw / _RTHandleScaleHistory.xy)]; + float4 previous = _SsrAccumPrev[COORD_TEXTURE2D_X(positionSS * prevHistoryScale + 0.5f / prevHistoryScale)]; float2 motionVectorNDC; DecodeMotionVector(SAMPLE_TEXTURE2D_X_LOD(_CameraMotionVectorsTexture, s_linear_clamp_sampler, min(hitPositionNDC.xy, 1.0f - 0.5f * _ScreenSize.zw) * _RTHandleScale.xy, 0), motionVectorNDC); @@ -698,7 +700,7 @@ void ScreenSpaceReflectionsAccumulate(uint3 dispatchThreadId : SV_DispatchThread float2 positionNDC = positionSS * _ScreenSize.zw + (0.5 * _ScreenSize.zw); DecodeMotionVector(SAMPLE_TEXTURE2D_X_LOD(_CameraMotionVectorsTexture, s_linear_clamp_sampler, min(positionNDC, 1.0f - 0.5f * _ScreenSize.zw) * _RTHandleScale.xy, 0), motionVectorCenterNDC); float speedSrc = length(motionVectorCenterNDC); - float speed = saturate((speedDst + speedDst) * 128.0f); // 128 is arbitrary + float speed = saturate((speedDst + speedSrc) * 128.0f); // 128 is arbitrary float coefExpAvg = lerp(_SsrAccumulationAmount, 1.0f, speed);