Skip to content

Commit

Permalink
Revert "Expose bilateral blur aggressiveness for spatial SSAO blur wh…
Browse files Browse the repository at this point in the history
…en temporal accumulation (#1569)"

This reverts commit 98b0174.
  • Loading branch information
sebastienlagarde committed Sep 18, 2020
1 parent c665a3b commit b10d6bb
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 16 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ For information on how to use a Texture to specify ambient occlusion caused by d
| **Full Resolution** | Enable the checkbox to process the ambient occlusion algorithm in full resolution. This improves quality significantly but is a resource-intensive operation and has an impact on performance. Disable the checkbox to process the ambient occlusion algorithm at half the resolution your application runs at. This setting is disabled by default. |
| **Temporal Accumulation** | Enable the checkbox to accumulate the result of AO over time. This will lead to better quality, but it might result in artifacts like non instant convergence and ghosting. **Note:** This mode will not lead to good results if motion vectors are not available. |
| **Ghosting Reduction** | This is only available when Temporal Accumulation is enabled.<br />Moving this factor closer to 0 will increase the amount of accepted samples during temporal accumulation, increasing the ghosting, but reducing the temporal noise. Moving the value closer to 1 will reduce the ghosting, at expense of more visible temporal noise. |
| **Bilateral Aggressiveness** | This is only available when Temporal Accumulation is enabled.<br />Higher this value, the less lenient with depth differences the spatial filter is and therefore more likely is to reject samples that are at different depth values. Increasing this for could reduce white halos where AO should be around objects. |
| **Bilateral Upsample** | Enable the checkbox to upsample the low resolution AO through bilateral upsampling. This preserves sharp edges better, however it is slightly more expensive and might result is more visible aliasing. **Note:** This mode is available only when Full Resolution is set to false. |
| **Direction Count** | Determines how many directions are searched for occlusion, increasing this will impact performance considerably. **Note:** This mode is available only when Temporal Accumulation is set to false. |
| **Blur sharpness** | Determines the sharpness of the non-temporal blur. Higher values preserve sharp features better (with higher risk of noise), lower values have a softer look. **Note:** This mode is available only when Temporal Accumulation is set to false. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class AmbientOcclusionEditor : VolumeComponentWithQualityEditor
SerializedDataParameter m_FullResolution;
SerializedDataParameter m_MaximumRadiusInPixels;
SerializedDataParameter m_DirectLightingStrength;
SerializedDataParameter m_SpatialBilateralAggressiveness;

// Temporal only parameters
SerializedDataParameter m_TemporalAccumulation;
Expand Down Expand Up @@ -53,7 +52,6 @@ public override void OnEnable()
m_DirectLightingStrength = Unpack(o.Find(x => x.directLightingStrength));
m_GhostingAdjustement = Unpack(o.Find(x => x.ghostingReduction));
m_BilateralUpsample = Unpack(o.Find("m_BilateralUpsample"));
m_SpatialBilateralAggressiveness = Unpack(o.Find(x => x.spatialBilateralAggressiveness));

m_RayTracing = Unpack(o.Find(x => x.rayTracing));
m_LayerMask = Unpack(o.Find(x => x.layerMask));
Expand Down Expand Up @@ -126,7 +124,6 @@ public override void OnInspectorGUI()
}
else
{
PropertyField(m_SpatialBilateralAggressiveness, EditorGUIUtility.TrTextContent("Bilateral Aggressiveness", "Higher this value, the less lenient with depth differences the spatial filter is. Increase if for example noticing white halos where AO should be."));
PropertyField(m_GhostingAdjustement, EditorGUIUtility.TrTextContent("Ghosting reduction", "Moving this factor closer to 0 will increase the amount of accepted samples during temporal accumulation, increasing the ghosting, but reducing the temporal noise."));
if (isInAdvancedMode && !m_FullResolution.value.boolValue)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,6 @@ public sealed class AmbientOcclusion : VolumeComponentWithQuality
/// Sampling radius. Bigger the radius, wider AO will be achieved, risking to lose fine details and increasing cost of the effect due to increasing cache misses.
/// </summary>
public ClampedFloatParameter radius = new ClampedFloatParameter(2.0f, 0.25f, 5.0f);

/// <summary>
/// Moving this factor closer to 0 will increase the amount of accepted samples during temporal accumulation, increasing the ghosting, but reducing the temporal noise.
/// </summary>
public ClampedFloatParameter spatialBilateralAggressiveness = new ClampedFloatParameter(0.15f, 0.0f, 1.0f);


/// <summary>
/// Whether the results are accumulated over time or not. This can get higher quality results at a cheaper cost, but it can lead to temporal artifacts such as ghosting.
/// </summary>
Expand Down Expand Up @@ -439,7 +432,7 @@ RenderAOParameters PrepareRenderAOParameters(HDCamera camera, Vector2 historySiz
settings.directionCount,
upperNudgeFactor,
minUpperNudgeLimit,
settings.spatialBilateralAggressiveness.value * 15.0f
0
);

cb._FirstTwoDepthMipOffsets = new Vector4(depthMipInfo.mipLevelOffsets[1].x, depthMipInfo.mipLevelOffsets[1].y, depthMipInfo.mipLevelOffsets[2].x, depthMipInfo.mipLevelOffsets[2].y);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#define _StepSize _AOParams3.w
#define _AOTemporalUpperNudgeLimit _AOParams4.y
#define _AOTemporalLowerNudgeLimit _AOParams4.z
#define _AOSpatialBilateralAggressiveness _AOParams4.w


// If this is set to 0 best quality is achieved when full res, but performance is significantly lower.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ RW_TEXTURE2D_X(float, _OcclusionTexture);

#define DEBUG_VISUALIZE_BILATERAL_WEIGHTS 0

#define DEPTH_SCALE 1
#define BILATERAL_EPSILON 0.01

float BilateralWeight(float sampleDepth, float linearCentralDepth)
{
float linearSample = LinearEyeDepth(sampleDepth, _ZBufferParams);
float delta = abs(linearSample - linearCentralDepth);
float w = saturate(1.0f - (_AOSpatialBilateralAggressiveness * delta + BILATERAL_EPSILON));
float w = saturate(1.0f - (DEPTH_SCALE * delta + BILATERAL_EPSILON));

return w;
}
Expand Down

0 comments on commit b10d6bb

Please sign in to comment.