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 77d0b1cdd74..32358051f8f 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 @@ -103,7 +103,7 @@ bool CreateMaterialData(PathIntersection pathIntersection, BuiltinData builtinDa mtlData.subsurfaceWeightFactor = subsurfaceWeight; SSS::Result subsurfaceResult; - float3 meanFreePath = -0.001 / (_ShapeParamsAndMaxScatterDists[mtlData.bsdfData.diffusionProfileIndex].rgb * _WorldScalesAndFilterRadiiAndThicknessRemaps[mtlData.bsdfData.diffusionProfileIndex].x); + float3 meanFreePath = 0.001 / (_ShapeParamsAndMaxScatterDists[mtlData.bsdfData.diffusionProfileIndex].rgb * _WorldScalesAndFilterRadiiAndThicknessRemaps[mtlData.bsdfData.diffusionProfileIndex].x); if (!SSS::RandomWalk(shadingPosition, mtlData.bsdfData.normalWS, mtlData.bsdfData.diffuseColor, meanFreePath, pathIntersection.pixelCoord, subsurfaceResult)) return false; diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/SubFrameManager.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/SubFrameManager.cs index 745e2c52650..12f1acbb47f 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/SubFrameManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/SubFrameManager.cs @@ -174,7 +174,9 @@ internal Vector4 GetFrameWeights() float weight = isRecording ? ShutterProfile(time) : 1.0f; - m_AccumulatedWeight += weight; + if (m_CurrentIteration < m_AccumulationSamples) + m_AccumulatedWeight += weight; + if (m_AccumulatedWeight > 0) { return new Vector4(weight, totalWeight, 1.0f / m_AccumulatedWeight, 0.0f); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs index d558250091e..be059b353ca 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs @@ -256,7 +256,6 @@ void RenderPathTracing(HDCamera hdCamera, CommandBuffer cmd, RTHandle outputText cmd.SetGlobalTexture(HDShaderIDs._ScramblingTexture, m_Asset.renderPipelineResources.textures.scramblingTex); // Inject the ray generation data - cmd.SetGlobalFloat(HDShaderIDs._RaytracingNumSamples, m_SubFrameManager.subFrameCount); cmd.SetGlobalFloat(HDShaderIDs._RaytracingMinRecursion, m_PathTracingSettings.minimumDepth.value); cmd.SetGlobalFloat(HDShaderIDs._RaytracingMaxRecursion, m_PathTracingSettings.maximumDepth.value); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RayTracingSubSurface.raytrace b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RayTracingSubSurface.raytrace index ee418bafeb1..ac00a2ca669 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RayTracingSubSurface.raytrace +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RayTracingSubSurface.raytrace @@ -76,8 +76,7 @@ void RayGenSubSurface() DECODE_FROM_SSSBUFFER(posInput.positionSS, sssData); float3 shapeParam = _ShapeParamsAndMaxScatterDists[sssData.diffusionProfileIndex].rgb * _WorldScalesAndFilterRadiiAndThicknessRemaps[sssData.diffusionProfileIndex].x; - // Deduce our scattering distance - // For some reason the value in shapeParam is negative, convert it to milimeters while we are there. + // Deduce our scattering distance (converted to mm) float3 scatteringDistance = 1.0 / shapeParam * 0.001; // Define which sample in the sequence we are up to.