Skip to content

Disabled specular occlusion for what we consider medium and larger scale rtao > 1.25 with a 25cm falloff interval. #3023

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 2 commits into from
Jan 12, 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 @@ -60,6 +60,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Improved robustness of volumetric sampling in path tracing (case 1295187).
- Changed the clamping approach for RTR and RTGI (in both perf and quality) to improve visual quality.
- Changed the warning message for ray traced area shadows (case 1303410).
- Disabled specular occlusion for what we consider medium and larger scale ao > 1.25 with a 25cm falloff interval.

## [10.3.0] - 2020-12-01

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ CBUFFER_START(ShaderVariablesDebugDisplay)
int _MatcapMixAlbedo;
float _MatcapViewScale;
int _DebugSingleShadowIndex;
int _DebugProbeVolumeMode;
float3 _DebugDisplayPad0;
int _DebugDisplayPad0;
CBUFFER_END


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,16 @@ internal void InitRaytracing(HDRenderPipeline renderPipeline)
m_RaytracingAmbientOcclusion.Init(renderPipeline);
}

internal float EvaluateSpecularOcclusionFlag(HDCamera hdCamera)
{
AmbientOcclusion ssoSettings = hdCamera.volumeStack.GetComponent<AmbientOcclusion>();
bool enableRTAO = hdCamera.frameSettings.IsEnabled(FrameSettingsField.RayTracing) && ssoSettings.rayTracing.value;
if (enableRTAO)
return m_RaytracingAmbientOcclusion.EvaluateRTSpecularOcclusionFlag(hdCamera, ssoSettings);
else
return 1.0f;
}

internal bool IsActive(HDCamera camera, AmbientOcclusion settings) => camera.frameSettings.IsEnabled(FrameSettingsField.SSAO) && settings.intensity.value > 0f;

struct RenderAOParameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void GetScreenSpaceAmbientOcclusionMultibounce(float2 positionSS, float NdotV, f
float directAmbientOcclusion = lerp(1.0, indirectAmbientOcclusion, _AmbientOcclusionParam.w);

float roughness = PerceptualRoughnessToRoughness(perceptualRoughness);
float indirectSpecularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(NdotV), indirectAmbientOcclusion, roughness);
float indirectSpecularOcclusion = lerp(1.0, GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(NdotV), indirectAmbientOcclusion, roughness), _SpecularOcclusionBlend);
float directSpecularOcclusion = lerp(1.0, indirectSpecularOcclusion, _AmbientOcclusionParam.w);

aoFactor.indirectSpecularOcclusion = GTAOMultiBounce(min(specularOcclusionFromData, indirectSpecularOcclusion), fresnel0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1039,11 +1039,14 @@ void UpdateShaderVariablesGlobalCB(HDCamera hdCamera, CommandBuffer cmd)
m_ShaderVariablesGlobalCB._EnableRayTracedReflections = enableRaytracedReflections ? 1 : 0;
RecursiveRendering recursiveSettings = hdCamera.volumeStack.GetComponent<RecursiveRendering>();
m_ShaderVariablesGlobalCB._EnableRecursiveRayTracing = recursiveSettings.enable.value ? 1u : 0u;

m_ShaderVariablesGlobalCB._SpecularOcclusionBlend = m_AmbientOcclusionSystem.EvaluateSpecularOcclusionFlag(hdCamera);
}
else
{
m_ShaderVariablesGlobalCB._EnableRayTracedReflections = 0;
m_ShaderVariablesGlobalCB._EnableRecursiveRayTracing = 0;
m_ShaderVariablesGlobalCB._SpecularOcclusionBlend = 0.0f;
}

ConstantBuffer.PushGlobal(cmd, m_ShaderVariablesGlobalCB, HDShaderIDs._ShaderVariablesGlobal);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ public void Init(HDRenderPipeline renderPipeline)
m_RTAOApplyIntensityKernel = m_PipelineRayTracingResources.aoRaytracingCS.FindKernel("RTAOApplyIntensity");
}

public float EvaluateRTSpecularOcclusionFlag(HDCamera hdCamera, AmbientOcclusion ssoSettings)
{
float remappedRayLength = (Mathf.Clamp(ssoSettings.rayLength, 1.25f, 1.5f) - 1.25f) / 0.25f;
return Mathf.Lerp(0.0f, 1.0f, 1.0f - remappedRayLength);
}

static RTHandle AmbientOcclusionHistoryBufferAllocatorFunction(string viewName, int frameIndex, RTHandleSystem rtHandleSystem)
{
return rtHandleSystem.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.R16G16_SFloat, dimension: TextureXR.dimension,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ unsafe struct ShaderVariablesGlobal
// Because the DepthPrepass doesn't have a DEBUG_DISPLAY variant, it is the only way to disable it for debug modes
public float _GlobalTessellationFactorMultiplier;

public float _Pad8;
public float _SpecularOcclusionBlend;
public float _Pad9;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ GLOBAL_CBUFFER_START(ShaderVariablesGlobal, b0)
float4 _ProbeVolumeAmbientProbeFallbackPackedCoeffs[7];
int _TransparentCameraOnlyMotionVectors;
float _GlobalTessellationFactorMultiplier;
float _Pad8;
float _SpecularOcclusionBlend;
float _Pad9;
CBUFFER_END

Expand Down