Skip to content

Commit 9207b4c

Browse files
authored
[HDRP][Path Tracing] Environment (sky) importance sampling (#6472)
* WIP... * ... * Refactor. * WIP... * Added marginal texture. * Data generation (almost) complete. * First working version. * Further polish. * ... * ... * Added dichotomic search. * Fixed visibility in light evaluation. * Removed unused code (incl. PDF storage). * Updated changelog. * Fixed Jacobian. * Removed commented out code. * Fixed volume attenuation on env light eval. * Renamed variables only used in path tracing. * Only activate sky importance sampling for HDRIs. * Updated ref images that use HDRIs. * Fixed formatting. * Cosmetic. * Update HDRP resources asset. * Fixed sky auto-exposure mismatch. * Updated changelog. * Fixed camera clear color. * Fixed unlit transparent. * Minor clean up. * Changed intensity clamping method. * Added sky importance sampling parameter. * Reordered params. * Improved robustness with null PDFs. * ... * Updated doc with section on sky sampling. * Cosmetic.
1 parent 371af9d commit 9207b4c

25 files changed

+682
-192
lines changed
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading

com.unity.render-pipelines.high-definition/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1010
- Added FSR sharpness override to camera and pipeline asset.
1111
- Added an option on the lit shader to perform Planar and Triplanar mapping in Object Space.
1212
- Added a button in the Probe Volume Baking window to open the Probe Volume debug panel.
13+
- Added importance sampling of the sky in path tracing (aka environment sampling).
1314

1415
### Fixed
1516
- Fixed some XR devices: Pulling camera world space position from mainViewConstants instead of transform.

com.unity.render-pipelines.high-definition/Documentation~/Ray-Tracing-Path-Tracing.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,13 @@ Path tracing uses the [Volume](Volumes.md) framework, so to enable this feature,
3333

3434
## Properties
3535

36-
| Property | Description |
37-
| --------------------- | ------------------------------------------------------------ |
38-
| **Maximum Samples** | Set the number of frames to accumulate for the final image. There is a progress bar at the bottom of the Scene view which indicates the current accumulation with respect to this value. |
39-
| **Minimum Depth** | Set the minimum number of light bounces in each path. |
40-
| **Maximum Depth** | Set the maximum number of light bounces in each path. You can not set this to be lower than Minimum Depth.<br /> **Note**: You can set this and Minimum Depth to 1 if you only want to direct lighting. You can set them both to 2 if you only want to visualize indirect lighting (which is only visible on the second bounce). |
41-
| **Maximum Intensity** | Set a value to clamp the intensity of the light value each bounce returns. This avoids very bright, isolated pixels in the final result.<br />**Note**: This property makes the final image dimmer, so if the result looks dark, increase the value of this property. |
36+
| Property | Description |
37+
| --------------------------- | ------------------------------------------------------------ |
38+
| **Maximum Samples** | Set the number of frames to accumulate for the final image. There is a progress bar at the bottom of the Scene view which indicates the current accumulation with respect to this value. |
39+
| **Minimum Depth** | Set the minimum number of light bounces in each path. |
40+
| **Maximum Depth** | Set the maximum number of light bounces in each path. You can not set this to be lower than Minimum Depth.<br /> **Note**: You can set this and Minimum Depth to 1 if you only want to direct lighting. You can set them both to 2 if you only want to visualize indirect lighting (which is only visible on the second bounce). |
41+
| **Maximum Intensity** | Set a value to clamp the intensity of the light value each bounce returns. This avoids very bright, isolated pixels in the final result.<br />**Note**: This property can make the final image dimmer, so if the result looks dark, increase the value of this property. |
42+
| **Sky Importance Sampling** | Set the sky sampling mode. Importance sampling favors the brightest directions, which is beneficial when using a sky model with high contrast and very intense spots (like a sun, or street lights). On the other hand, it can be slightly detrimental when using a smooth, uniform sky. It is active by default for HDRI skies only, but can also be turned On and Off, regardless of the type of sky in use. |
4243

4344
![](Images/RayTracingPathTracing4.png)
4445

com.unity.render-pipelines.high-definition/Editor/RenderPipeline/PathTracing/PathTracingEditor.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class PathTracingEditor : VolumeComponentEditor
1717
SerializedDataParameter m_MinDepth;
1818
SerializedDataParameter m_MaxDepth;
1919
SerializedDataParameter m_MaxIntensity;
20+
SerializedDataParameter m_SkyImportanceSampling;
2021

2122
public override void OnEnable()
2223
{
@@ -28,6 +29,7 @@ public override void OnEnable()
2829
m_MinDepth = Unpack(o.Find(x => x.minimumDepth));
2930
m_MaxDepth = Unpack(o.Find(x => x.maximumDepth));
3031
m_MaxIntensity = Unpack(o.Find(x => x.maximumIntensity));
32+
m_SkyImportanceSampling = Unpack(o.Find(x => x.skyImportanceSampling));
3133
}
3234

3335
public override void OnInspectorGUI()
@@ -54,6 +56,7 @@ public override void OnInspectorGUI()
5456
PropertyField(m_MinDepth);
5557
PropertyField(m_MaxDepth);
5658
PropertyField(m_MaxIntensity);
59+
PropertyField(m_SkyImportanceSampling);
5760
}
5861

5962
// Make sure MaxDepth is always greater or equal than MinDepth

0 commit comments

Comments
 (0)