Skip to content

[HDRP] Improve path traced subsurface scattering for transmissive surfaces #5485

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

Merged
merged 3 commits into from
Sep 1, 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 @@ -381,6 +381,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed issue with depth slope scale depth bias when a material uses depth offset.
- Fixed shadow sampling artifact when using the spot light shadow option 'custom spot angle'
- Fixed issue with fading in SSR applying fade factor twice, resulting in darkening of the image in the transition areas.
- Fixed path traced subsurface scattering for transmissive surfaces (case 1329403)

### Changed
- Changed Window/Render Pipeline/HD Render Pipeline Wizard to Window/Rendering/HDRP Wizard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,16 @@ bool RandomWalk(float3 position, float3 normal, float3 diffuseColor, float3 mean
result.exitNormal = intersection.value;
}

// if the material is transmissive, pick a side for the normal randomly to properly handle thin surfaces (case 1329403)
#ifdef _MATERIAL_FEATURE_TRANSMISSION
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will accept the PR for the fix, but let's have in mind that _MATERIAL_FEATURE_TRANSMISSION isn't a standard name for "transmission". This is define only per Material and Material don't have obligation to reuse this name (on raster side). We may need to revisit how we handle transmission from a general point of view later.

// 108 is the next available dimension after the screen space sub-pixel sampling
if (GetSample(pixelCoord, _RaytracingSampleIndex, 108) < 0.5)
{
result.exitNormal = -result.exitNormal;
}
result.throughput *= 2.0;
#endif

return true;
}

Expand Down