Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HDRP][Path Tracing] Camera ray misses now return a null value with Minimum Depth > 1 #6067

Merged
merged 2 commits into from
Oct 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Use RayTracingAccelerationStructure.CullInstances to filter Renderers and populate the acceleration structure with ray tracing instances for improved CPU performance on the main thread.
- Changed the max distance for Light Anchors to avoid unstability with high values (case 1362802).
- PrepareLightsForGPU CPU Light loop performance improvement (40% to 70% faster), utilizing burst and optimized. Utilizing better sorting, distributing work in jobs and improving cache access of light data.
- In path tracing, camera ray misses now return a null value with Minimum Depth > 1.

## [13.1.0] - 2021-09-24

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,22 @@ float4 _PathTracedDoFConstants; // x: aperture radius, y: focus distance, zw: un
[shader("miss")]
void MissCamera(inout PathIntersection pathIntersection : SV_RayPayload)
{
// In indirect-only mode, it makes more sense to return a null value
if (_RaytracingMinRecursion > 1)
{
pathIntersection.value = 0.0;
pathIntersection.alpha = 0.0;
return;
}

bool skyEnabled = _EnvLightSkyEnabled && _RaytracingCameraSkyEnabled;
float4 missColor = skyEnabled ? _SkyCameraTexture[COORD_TEXTURE2D_X(pathIntersection.pixelCoord)] : _RaytracingCameraClearColor;
pathIntersection.value = missColor.xyz * GetInverseCurrentExposureMultiplier();
pathIntersection.alpha = missColor.w;
pathIntersection.value = missColor.rgb * GetInverseCurrentExposureMultiplier();
pathIntersection.alpha = missColor.a;

ApplyFogAttenuation(WorldRayOrigin(), WorldRayDirection(), pathIntersection.value, pathIntersection.alpha);

if (_EnableVolumetricFog && _RaytracingMinRecursion <= 1)
if (_EnableVolumetricFog)
{
float3 lightPosition, envValue = pathIntersection.value;

Expand Down Expand Up @@ -86,7 +94,7 @@ void MissMaterial(inout PathIntersection pathIntersection : SV_RayPayload)
return;
}

pathIntersection.value = _EnvLightSkyEnabled ? SampleSkyTexture(WorldRayDirection(), 0.0, 0).xyz : 0.0;
pathIntersection.value = _EnvLightSkyEnabled ? SampleSkyTexture(WorldRayDirection(), 0.0, 0).rgb : 0.0;
ApplyFogAttenuation(WorldRayOrigin(), WorldRayDirection(), pathIntersection.value);
}

Expand Down