Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ public struct GlobalDynamicResolutionSettings
// It fall-backs to software when not supported, so it makes sense to have it on by default.
dynResType = DynamicResolutionType.Hardware,
upsampleFilter = DynamicResUpscaleFilter.CatmullRom,
forcedPercentage = 100.0f
forcedPercentage = 100.0f,

//Defaults for dlss
enableDLSS = false,
DLSSUseOptimalSettings = true,
DLSSPerfQualitySetting = 0,
DLSSSharpness = 0.5f
};

/// <summary>Select whether the dynamic resolution is enabled or not.</summary>
Expand Down
3 changes: 3 additions & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed issue with velocity rejection when using physically-based DoF.
- Fixed HDRP's ShaderGraphVersion migration management which was broken.
- Fixed missing API documentation for LTC area light code.
- Fixed AxF debug output in certain configurations (case 1333780).
- Fixed white flash when camera is reset and SSR Accumulation mode is on.

### Changed
- Changed Window/Render Pipeline/HD Render Pipeline Wizard to Window/Rendering/HDRP Wizard
Expand Down Expand Up @@ -276,6 +278,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Global Camera shader constants are now pushed when doing a custom render callback.
- Splited HDProjectSettings with new HDUserSettings in UserProject. Now Wizard working variable should not bother versioning tool anymore (case 1330640)
- Removed redundant Show Inactive Objects and Isolate Selection checkboxes from the Emissive Materials tab of the Light Explorer (case 1331750).
- Display an info box and disable MSAA asset entry when ray tracing is enabled.

## [11.0.0] - 2020-10-21

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,14 @@ After you install the NVIDIA package, more properties appear in [HDRP Assets](HD
Your Unity project now supports DLSS and you can now enable DLSS for Cameras in your scene. Enabling DLSS in the HDRP Asset exposes other properties that you can use to customize DLSS. For information about these properties, see the [HDRP Asset](HDRP-Asset.md) documentation.

1. In the Hierarchy or Scene view, select a Camera and view it in the Inspector.
2. Select **Allow DLSS**.
3. Enabling **Allow DLSS** exposes other properties that you can use to customize DLSS for the Camera. For information about these properties, see the [Camera](HDRP-Camera.md) documentation.
2. Select **Allow Dynamic Resolution** to expose the DLSS settings. For more information see the [Dynamic Resolution](Dynamic-Resolution.md) guide.
3. Select **Allow DLSS**.
4. Enabling **Allow DLSS** exposes other properties that you can use to customize DLSS for the Camera. For information about these properties, see the [Camera](HDRP-Camera.md) documentation.
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove passive voice:

Enable Allow DLSS to expose other properties that you can use to customize DLSS for the Camera.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! thank you.


### DLSS and Dynamic Resolution

By default the [HDRP Assets](HDRP-Asset.md) has the **Use Optimal Settings** checkbox enabled. This means that DLSS will try and set the dynamic resolution scale automatically. If this checkbox is disabled,
DLSS will utilize the same dynamic resolution scale set by the project. For more information see the [Dynamic Resolution](Dynamic-Resolution.md) guide.

Copy link
Contributor

Choose a reason for hiding this comment

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

Some small tweaks:

The Use Optimal Settings checkbox in the HDRP Asset is enabled by default. This means that DLSS sets the dynamic resolution scale automatically. If you disable this checkbox DLSS uses the same dynamic resolution scale set by the project. For more information see the Dynamic Resolution guide.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! thank you.

### Setting the DLSS quality mode

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ public class Styles
public static readonly GUIContent supportedRayTracingMode = EditorGUIUtility.TrTextContent("Supported Ray Tracing Mode (Preview)");
public static readonly GUIContent rayTracingUnsupportedWarning = EditorGUIUtility.TrTextContent("Ray tracing is not supported on your device. Please refer to the documentation.");
public static readonly GUIContent rayTracingDX12OnlyWarning = EditorGUIUtility.TrTextContent("Ray tracing is currently only supported on DX12.");
public static readonly GUIContent rayTracingMSAAUnsupported = EditorGUIUtility.TrTextContent("When Ray tracing is enabled in asset, MSAA is not supported. Please refer to the documentation.");
public static readonly GUIContent maximumLODLevel = EditorGUIUtility.TrTextContent("Maximum LOD Level");
public static readonly GUIContent LODBias = EditorGUIUtility.TrTextContent("LOD Bias");
public static readonly GUIContent supportProbeVolumeContent = EditorGUIUtility.TrTextContent("Enable", "When enabled, HDRP allocates Shader variants and memory for probe volume based GI. This allows you to use probe volumes in your Unity Project.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1138,17 +1138,26 @@ static void Drawer_SectionRenderingUnsorted(SerializedHDRenderPipelineAsset seri
// MSAA is an option that is only available in full forward but Camera can be set in Full Forward only. Thus MSAA have no dependency currently
//Note: do not use SerializedProperty.enumValueIndex here as this enum not start at 0 as it is used as flags.
bool msaaAllowed = true;
bool hasRayTracing = false;
for (int index = 0; index < serialized.serializedObject.targetObjects.Length && msaaAllowed; ++index)
{
var litShaderMode = (serialized.serializedObject.targetObjects[index] as HDRenderPipelineAsset).currentPlatformRenderPipelineSettings.supportedLitShaderMode;
msaaAllowed &= litShaderMode == SupportedLitShaderMode.ForwardOnly || litShaderMode == SupportedLitShaderMode.Both;
var settings = (serialized.serializedObject.targetObjects[index] as HDRenderPipelineAsset).currentPlatformRenderPipelineSettings;
var litShaderMode = settings.supportedLitShaderMode;
bool rayTracedSupported = settings.supportRayTracing;
hasRayTracing |= rayTracedSupported;
msaaAllowed &= (litShaderMode == SupportedLitShaderMode.ForwardOnly || litShaderMode == SupportedLitShaderMode.Both) && !rayTracedSupported;
}

using (new EditorGUI.DisabledScope(!msaaAllowed))
{
++EditorGUI.indentLevel;
EditorGUILayout.PropertyField(serialized.renderPipelineSettings.MSAASampleCount, Styles.MSAASampleCountContent);
--EditorGUI.indentLevel;
}
if (hasRayTracing && serialized.renderPipelineSettings.MSAASampleCount.intValue != (int)MSAASamples.None)
{
EditorGUILayout.HelpBox(Styles.rayTracingMSAAUnsupported.text, MessageType.Info, wide: true);
}

EditorGUILayout.PropertyField(serialized.renderPipelineSettings.supportMotionVectors, Styles.supportMotionVectorContent);
EditorGUILayout.PropertyField(serialized.renderPipelineSettings.supportRuntimeDebugDisplay, Styles.supportRuntimeDebugDisplayContent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,17 @@ void GetSurfaceAndBuiltinData(FragInputs input, float3 V, inout PositionInputs p

// The AxF models include both a general coloring term that they call "specular color" while the f0 is actually another term,
// seemingly always scalar:
#ifndef DEBUG_DISPLAY
surfaceData.fresnel0 = AXF_SAMPLE_SMP_TEXTURE2D(_SVBRDF_FresnelMap, sampler_SVBRDF_FresnelMap, uvMapping).x;
surfaceData.height_mm = AXF_SAMPLE_SMP_TEXTURE2D(_SVBRDF_HeightMap, sampler_SVBRDF_HeightMap, uvMapping).x * _SVBRDF_HeightMapMaxMM;
#else
// [case 1333780]: For debug display we run out of samplers (max 16 on dx11/ps5.0) in certain configurations for two reasons:
// - An extra sampler is used for mat cap
// - The auto-generated debug code can visualize all texture properties so nothing is stripped out (unlike the non-debug case)
// To save sampler states in Debug, we reuse the sampler state of the color map for some other maps too.
surfaceData.fresnel0 = AXF_SAMPLE_SMP_TEXTURE2D(_SVBRDF_FresnelMap, sampler_SVBRDF_DiffuseColorMap, uvMapping).x;
surfaceData.height_mm = AXF_SAMPLE_SMP_TEXTURE2D(_SVBRDF_HeightMap, sampler_SVBRDF_DiffuseColorMap, uvMapping).x * _SVBRDF_HeightMapMaxMM;
#endif
// Our importer range remaps the [-HALF_PI, HALF_PI) range to [0,1). We map back here:
surfaceData.anisotropyAngle =
HALF_PI * (2.0 * AXF_SAMPLE_SMP_TEXTURE2D(_SVBRDF_AnisoRotationMap, sampler_SVBRDF_AnisoRotationMap, uvMapping).x - 1.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public struct ViewConstants
public bool volumetricHistoryIsValid = false;

internal int volumetricValidFrames = 0;
internal int colorPyramidHistoryValidFrames = 0;

/// <summary>Width actually used for rendering after dynamic resolution and XR is applied.</summary>
public int actualWidth { get; private set; }
Expand Down Expand Up @@ -147,6 +148,7 @@ public void Reset()
volumetricHistoryIsValid = false;
volumetricValidFrames = 0;
colorPyramidHistoryIsValid = false;
colorPyramidHistoryValidFrames = 0;
dofHistoryIsValid = false;

// Reset the volumetric cloud offset animation data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ class RenderSSRPassData
public bool usePBRAlgo;
public bool accumNeedClear;
public bool previousAccumNeedClear;
public bool validColorPyramid;

public int width, height, viewCount;

Expand Down Expand Up @@ -511,6 +512,7 @@ TextureHandle RenderSSR(RenderGraph renderGraph,
passData.accumNeedClear = usePBRAlgo;
passData.previousAccumNeedClear = usePBRAlgo && (hdCamera.currentSSRAlgorithm == ScreenSpaceReflectionAlgorithm.Approximation || hdCamera.isFirstFrame || hdCamera.resetPostProcessingHistory);
hdCamera.currentSSRAlgorithm = volumeSettings.usedAlgorithm.value; // Store for next frame comparison
passData.validColorPyramid = hdCamera.colorPyramidHistoryValidFrames > 1;

passData.depthBuffer = builder.ReadTexture(prepassOutput.depthBuffer);
passData.depthPyramid = builder.ReadTexture(prepassOutput.depthPyramidTexture);
Expand Down Expand Up @@ -603,22 +605,30 @@ TextureHandle RenderSSR(RenderGraph renderGraph,

if (data.usePBRAlgo)
{
using (new ProfilingScope(ctx.cmd, ProfilingSampler.Get(HDProfileId.SsrAccumulate)))
if (!data.validColorPyramid)
{
ctx.cmd.SetComputeTextureParam(cs, data.accumulateKernel, HDShaderIDs._DepthTexture, data.depthBuffer);
ctx.cmd.SetComputeTextureParam(cs, data.accumulateKernel, HDShaderIDs._CameraDepthTexture, data.depthPyramid);
ctx.cmd.SetComputeTextureParam(cs, data.accumulateKernel, HDShaderIDs._NormalBufferTexture, data.normalBuffer);
ctx.cmd.SetComputeTextureParam(cs, data.accumulateKernel, HDShaderIDs._ColorPyramidTexture, data.colorPyramid);
ctx.cmd.SetComputeTextureParam(cs, data.accumulateKernel, HDShaderIDs._SsrHitPointTexture, data.hitPointsTexture);
ctx.cmd.SetComputeTextureParam(cs, data.accumulateKernel, HDShaderIDs._SSRAccumTexture, data.ssrAccum);
ctx.cmd.SetComputeTextureParam(cs, data.accumulateKernel, HDShaderIDs._SsrLightingTextureRW, data.lightingTexture);
ctx.cmd.SetComputeTextureParam(cs, data.accumulateKernel, HDShaderIDs._SsrAccumPrev, data.ssrAccumPrev);
ctx.cmd.SetComputeTextureParam(cs, data.accumulateKernel, HDShaderIDs._SsrClearCoatMaskTexture, data.clearCoatMask);
ctx.cmd.SetComputeTextureParam(cs, data.accumulateKernel, HDShaderIDs._CameraMotionVectorsTexture, data.motionVectorsBuffer);

ConstantBuffer.Push(ctx.cmd, data.cb, cs, HDShaderIDs._ShaderVariablesScreenSpaceReflection);

ctx.cmd.DispatchCompute(cs, data.accumulateKernel, HDUtils.DivRoundUp(data.width, 8), HDUtils.DivRoundUp(data.height, 8), data.viewCount);
CoreUtils.SetRenderTarget(ctx.cmd, data.ssrAccum, ClearFlag.Color, Color.clear);
CoreUtils.SetRenderTarget(ctx.cmd, data.ssrAccumPrev, ClearFlag.Color, Color.clear);
}
else
{
using (new ProfilingScope(ctx.cmd, ProfilingSampler.Get(HDProfileId.SsrAccumulate)))
{
ctx.cmd.SetComputeTextureParam(cs, data.accumulateKernel, HDShaderIDs._DepthTexture, data.depthBuffer);
ctx.cmd.SetComputeTextureParam(cs, data.accumulateKernel, HDShaderIDs._CameraDepthTexture, data.depthPyramid);
ctx.cmd.SetComputeTextureParam(cs, data.accumulateKernel, HDShaderIDs._NormalBufferTexture, data.normalBuffer);
ctx.cmd.SetComputeTextureParam(cs, data.accumulateKernel, HDShaderIDs._ColorPyramidTexture, data.colorPyramid);
ctx.cmd.SetComputeTextureParam(cs, data.accumulateKernel, HDShaderIDs._SsrHitPointTexture, data.hitPointsTexture);
ctx.cmd.SetComputeTextureParam(cs, data.accumulateKernel, HDShaderIDs._SSRAccumTexture, data.ssrAccum);
ctx.cmd.SetComputeTextureParam(cs, data.accumulateKernel, HDShaderIDs._SsrLightingTextureRW, data.lightingTexture);
ctx.cmd.SetComputeTextureParam(cs, data.accumulateKernel, HDShaderIDs._SsrAccumPrev, data.ssrAccumPrev);
ctx.cmd.SetComputeTextureParam(cs, data.accumulateKernel, HDShaderIDs._SsrClearCoatMaskTexture, data.clearCoatMask);
ctx.cmd.SetComputeTextureParam(cs, data.accumulateKernel, HDShaderIDs._CameraMotionVectorsTexture, data.motionVectorsBuffer);

ConstantBuffer.Push(ctx.cmd, data.cb, cs, HDShaderIDs._ShaderVariablesScreenSpaceReflection);

ctx.cmd.DispatchCompute(cs, data.accumulateKernel, HDUtils.DivRoundUp(data.width, 8), HDUtils.DivRoundUp(data.height, 8), data.viewCount);
}
}
}
});
Expand All @@ -639,8 +649,13 @@ TextureHandle RenderSSR(RenderGraph renderGraph,
if (!hdCamera.colorPyramidHistoryIsValid)
{
hdCamera.colorPyramidHistoryIsValid = true; // For the next frame...
hdCamera.colorPyramidHistoryValidFrames = 0;
result = renderGraph.defaultResources.blackTextureXR;
}
else
{
hdCamera.colorPyramidHistoryValidFrames++;
}
}

PushFullScreenDebugTexture(renderGraph, result, transparent ? FullScreenDebugMode.TransparentScreenSpaceReflections : FullScreenDebugMode.ScreenSpaceReflections);
Expand Down