diff --git a/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/5007_PathTracing_Materials_SG_Unlit.png b/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/5007_PathTracing_Materials_SG_Unlit.png index 4538675a3d9..ed7cff3fef2 100644 --- a/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/5007_PathTracing_Materials_SG_Unlit.png +++ b/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/5007_PathTracing_Materials_SG_Unlit.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:25f1efd31723f2c717816a34ec26fe5e5fd0e07029be9509cc642360a3474ba7 -size 55092 +oid sha256:75313116e965773d446e8027dc8e7ff244114bfef9cdc226fd7da260394de554 +size 55192 diff --git a/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D12/None/5007_PathTracing_Materials_SG_Unlit.png b/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D12/None/5007_PathTracing_Materials_SG_Unlit.png index 4538675a3d9..ed7cff3fef2 100644 --- a/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D12/None/5007_PathTracing_Materials_SG_Unlit.png +++ b/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D12/None/5007_PathTracing_Materials_SG_Unlit.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:25f1efd31723f2c717816a34ec26fe5e5fd0e07029be9509cc642360a3474ba7 -size 55092 +oid sha256:75313116e965773d446e8027dc8e7ff244114bfef9cdc226fd7da260394de554 +size 55192 diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 8f24bb9b2c0..f9039c28d8e 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -135,6 +135,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Added CustomPassUtils API to simplify Blur, Copy and DrawRenderers custom passes. - Added an API in HDRP to override the camera within the rendering of a frame (mainly for custom pass). - Added more custom pass API functions, mainly to render objects from another camera. +- Added support for transparent Unlit in path tracing. ### Fixed - Fix when rescale probe all direction below zero (1219246) diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassPathTracing.hlsl b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassPathTracing.hlsl index 46bbb8e3cee..4cc5c64cb7c 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassPathTracing.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassPathTracing.hlsl @@ -223,9 +223,30 @@ void ClosestHit(inout PathIntersection pathIntersection : SV_RayPayload, Attribu } #else // HAS_LIGHTLOOP + pathIntersection.value = (!currentDepth || computeDirect) ? bsdfData.color * GetInverseCurrentExposureMultiplier() + builtinData.emissiveColor : 0.0; + +// Simulate opacity blending by simply continuing along the current ray +#ifdef _SURFACE_TYPE_TRANSPARENT + if (builtinData.opacity < 1.0) + { + RayDesc rayDescriptor; + rayDescriptor.Origin = GetAbsolutePositionWS(fragInput.positionRWS) - fragInput.tangentToWorld[2] * _RaytracingRayBias; + rayDescriptor.Direction = WorldRayDirection(); + rayDescriptor.TMin = 0.0; + rayDescriptor.TMax = FLT_INF; + + PathIntersection nextPathIntersection = pathIntersection; + nextPathIntersection.remainingDepth--; + + TraceRay(_RaytracingAccelerationStructure, RAY_FLAG_CULL_BACK_FACING_TRIANGLES, RAYTRACINGRENDERERFLAG_PATH_TRACING, 0, 1, 2, rayDescriptor, nextPathIntersection); + + pathIntersection.value = lerp(nextPathIntersection.value, pathIntersection.value, builtinData.opacity); + } #endif +#endif // HAS_LIGHTLOOP + ApplyFogAttenuation(WorldRayOrigin(), WorldRayDirection(), pathIntersection.t, pathIntersection.value, computeDirect); if (currentDepth)