Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
19a8055
Debug culling render feature
eh-unity Oct 19, 2020
615edb8
Very basic UI for toggling debug features.
eh-unity Oct 20, 2020
159958d
Add support for shadow cascade debug and spotlights.
eh-unity Oct 20, 2020
b16ce6b
Merge branch 'master' into universal/debug-cull-features
eh-unity Oct 20, 2020
a7f9504
Added main camera culling debug viewer.
eh-unity Oct 20, 2020
ca3041c
Merge branch 'master' into universal/debug-cull-features
eh-unity Nov 10, 2020
f784053
Fix indexing bug when no direct lights.
eh-unity Nov 10, 2020
61b7bbe
Merge branch 'master' into universal/debug-cull-features
eh-unity Nov 20, 2020
ba8be04
Refactor
eh-unity Nov 20, 2020
f1b1156
Merge branch 'master' into universal/debug-cull-features
eh-unity Jan 14, 2021
8bbd148
Basic frustum debug support for point light shadows.
eh-unity Jan 14, 2021
318f9f0
Merge branch 'master' of github.com:Unity-Technologies/Graphics into …
nigeljw-unity Feb 2, 2021
a50048a
Merge branch 'master' of github.com:Unity-Technologies/Graphics into …
nigeljw-unity Mar 9, 2021
e66520f
Merge branch 'master' of github.com:Unity-Technologies/Graphics into …
nigeljw-unity Apr 21, 2021
2ec5e04
Added minimal enclosing sphere chicken bit and also iteration .
nigeljw-unity May 4, 2021
839062b
Added user control for number of iterations
nigeljw-unity May 6, 2021
69219b9
Merge branch 'master' of github.com:Unity-Technologies/Graphics into …
nigeljw-unity May 7, 2021
0cbf27d
Merge branch 'master' into universal/debug-cull-features
eh-unity May 7, 2021
35fc302
Merge branch 'master' of github.com:Unity-Technologies/Graphics into …
nigeljw-unity May 7, 2021
330c828
Merge branch 'universal/debug-cull-features' of github.com:Unity-Tech…
nigeljw-unity May 7, 2021
8706e52
Merge branch 'master' of github.com:Unity-Technologies/Graphics into …
nigeljw-unity May 7, 2021
9659fbc
Merge branch 'universal/debug-cull-features' of github.com:Unity-Tech…
nigeljw-unity May 7, 2021
d0d3910
Merge branch 'universal/debug-cull-features' of github.com:Unity-Tech…
nigeljw-unity May 7, 2021
96dd1f0
Merge branch 'master' of github.com:Unity-Technologies/Graphics into …
nigeljw-unity May 11, 2021
13a67d3
Merge branch 'master' of github.com:Unity-Technologies/Graphics into …
nigeljw-unity Jun 1, 2021
29b7339
Merge branch 'master' of github.com:Unity-Technologies/Graphics into …
nigeljw-unity Jun 9, 2021
a8ef4ee
Reverted changes to debug culling feature
nigeljw-unity Jun 15, 2021
6386692
Remove debug files
nigeljw-unity Jun 15, 2021
5472010
Removed debug cull files
nigeljw-unity Jun 15, 2021
61da606
Removed code specific to debug
nigeljw-unity Jun 15, 2021
eb008f9
Merge branch 'master' of github.com:Unity-Technologies/Graphics into …
nigeljw-unity Jun 15, 2021
62c34bb
removed more old code
nigeljw-unity Jun 15, 2021
3619666
Removed old includes
nigeljw-unity Jun 15, 2021
3939d95
Merge branch 'master' of github.com:Unity-Technologies/Graphics into …
nigeljw-unity Aug 19, 2021
51979d6
Fixed merge conflight and renamed to conservative enclosing sphere
nigeljw-unity Aug 19, 2021
3ac5008
Enable for new projects
nigeljw-unity Aug 19, 2021
e762373
Merge branch 'master' of github.com:Unity-Technologies/Graphics into …
nigeljw-unity Sep 15, 2021
3ef8d83
Addressed UX design feedback
nigeljw-unity Sep 16, 2021
1143462
Removed orphan UI element
nigeljw-unity Sep 16, 2021
941171c
Removed orphan prop
nigeljw-unity Sep 16, 2021
5201d3f
Updated tooltip from feedback from docs team and added changelog
nigeljw-unity Sep 17, 2021
fc17721
Merge branch 'master' of github.com:Unity-Technologies/Graphics into …
nigeljw-unity Sep 17, 2021
9629cf5
Added the Conservative Enclosing Sphere description to URP Asset page.
oleks-k Sep 17, 2021
653b014
Merge branch 'universal/tight_enclosing_sphere' of github.com:Unity-T…
oleks-k Sep 17, 2021
3399711
Added a note about performance.
oleks-k Sep 17, 2021
142ed2e
Merge branch 'master' into universal/tight_enclosing_sphere
nigeljw-unity Sep 17, 2021
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.universal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed lit detail correctly upgraded from standard shader. [1323725](https://issuetracker.unity3d.com/issues/urp-detail-map-tiling-is-tied-to-base-texture-tiling)
- URP asset can now use multi-edit. [case 1364966](https://issuetracker.unity3d.com/issues/urp-universalrenderpipelineasset-does-not-support-multi-edit)
- Fixed an issue in where the current open scene didn't load after running the converters. [case 1365101]
- Added "Conservative Enclosing Sphere" setting to fix shadow frustum culling issue where shadows are erroneously culled in corners of cascades [case 1153151](https://issuetracker.unity3d.com/issues/lwrp-shadows-are-being-culled-incorrectly-in-the-corner-of-the-camera-viewport-when-the-far-clip-plane-is-small)

## [12.0.0] - 2021-01-11
### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ The **Shadows** section has the following properties.
| **Depth Bias** | Use this setting to reduce [shadow acne](https://docs.unity3d.com/Manual/ShadowPerformance.html). |
| **Normal Bias** | Use this setting to reduce [shadow acne](https://docs.unity3d.com/Manual/ShadowPerformance.html). |
| __Soft Shadows__ | Select this check box to enable extra processing of the shadow maps to give them a smoother look.<br/>When enabled, Unity uses the following shadow map filtering method:<br/>Desktop platforms: 5x5 tent filter, mobile platforms: 4 tap filter.<br/>**Performance impact**: high.<br/>When this option is disabled, Unity samples the shadow map once with the default hardware filtering. |


| **Conservative Enclosing Sphere** | Enable this option to improve shadow frustum culling and prevent Unity from excessively culling shadows in the corners of the shadow cascades.<br/>Disable this option only for compatibility purposes of existing projects created in previous Unity versions.<br/>If you enable this option in an existing project, you might need to adjust the shadows cascade distances because the shadow culling enclosing spheres change their size and position.<br/>**Performance impact**: enabling this option is likely to improve performance, because the option minimizes the overlap of shadow cascades, which reduces the number of redundant static shadow casters. |

### Post-processing

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ internal class SerializedUniversalRenderPipelineAsset
public SerializedProperty shadowCascadeBorderProp { get; }
public SerializedProperty shadowDepthBiasProp { get; }
public SerializedProperty shadowNormalBiasProp { get; }

public SerializedProperty softShadowsSupportedProp { get; }
public SerializedProperty conservativeEnclosingSphereProp { get; }

public SerializedProperty srpBatcher { get; }
public SerializedProperty supportsDynamicBatching { get; }
Expand Down Expand Up @@ -111,6 +111,7 @@ public SerializedUniversalRenderPipelineAsset(SerializedObject serializedObject)
shadowDepthBiasProp = serializedObject.FindProperty("m_ShadowDepthBias");
shadowNormalBiasProp = serializedObject.FindProperty("m_ShadowNormalBias");
softShadowsSupportedProp = serializedObject.FindProperty("m_SoftShadowsSupported");
conservativeEnclosingSphereProp = serializedObject.FindProperty("m_ConservativeEnclosingSphere");

srpBatcher = serializedObject.FindProperty("m_UseSRPBatcher");
supportsDynamicBatching = serializedObject.FindProperty("m_SupportsDynamicBatching");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ enum ExpandableAdditional
Rendering = 1 << 1,
Lighting = 1 << 2,
PostProcessing = 1 << 3,
Shadows = 1 << 4,
}

internal static void RegisterEditor(UniversalRenderPipelineAssetEditor editor)
Expand Down Expand Up @@ -103,7 +104,7 @@ static bool ValidateRendererGraphicsAPIs(UniversalRenderPipelineAsset pipelineAs
CED.AdditionalPropertiesFoldoutGroup(Styles.renderingSettingsText, Expandable.Rendering, k_ExpandedState, ExpandableAdditional.Rendering, k_AdditionalPropertiesState, DrawRendering, DrawRenderingAdditional),
CED.FoldoutGroup(Styles.qualitySettingsText, Expandable.Quality, k_ExpandedState, CED.Group(DrawQuality)),
CED.AdditionalPropertiesFoldoutGroup(Styles.lightingSettingsText, Expandable.Lighting, k_ExpandedState, ExpandableAdditional.Lighting, k_AdditionalPropertiesState, DrawLighting, DrawLightingAdditional),
CED.FoldoutGroup(Styles.shadowSettingsText, Expandable.Shadows, k_ExpandedState, CED.Group(DrawShadows)),
CED.AdditionalPropertiesFoldoutGroup(Styles.shadowSettingsText, Expandable.Shadows, k_ExpandedState, ExpandableAdditional.Shadows, k_AdditionalPropertiesState, DrawShadows, DrawShadowsAdditional),
CED.AdditionalPropertiesFoldoutGroup(Styles.postProcessingSettingsText, Expandable.PostProcessing, k_ExpandedState, ExpandableAdditional.PostProcessing, k_AdditionalPropertiesState, DrawPostProcessing, DrawPostProcessingAdditional)
#if ADAPTIVE_PERFORMANCE_2_0_0_OR_NEWER
, CED.FoldoutGroup(Styles.adaptivePerformanceText, Expandable.AdaptivePerformance, k_ExpandedState, CED.Group(DrawAdvanced)),
Expand Down Expand Up @@ -293,9 +294,15 @@ static void DrawShadows(SerializedUniversalRenderPipelineAsset serialized, Edito
serialized.shadowDepthBiasProp.floatValue = EditorGUILayout.Slider(Styles.shadowDepthBias, serialized.shadowDepthBiasProp.floatValue, 0.0f, UniversalRenderPipeline.maxShadowBias);
serialized.shadowNormalBiasProp.floatValue = EditorGUILayout.Slider(Styles.shadowNormalBias, serialized.shadowNormalBiasProp.floatValue, 0.0f, UniversalRenderPipeline.maxShadowBias);
EditorGUILayout.PropertyField(serialized.softShadowsSupportedProp, Styles.supportsSoftShadows);

EditorGUI.indentLevel--;
}

static void DrawShadowsAdditional(SerializedUniversalRenderPipelineAsset serialized, Editor ownerEditor)
{
EditorGUILayout.PropertyField(serialized.conservativeEnclosingSphereProp, Styles.conservativeEnclosingSphere);
}

static void DrawCascadeSliders(SerializedUniversalRenderPipelineAsset serialized, int splitCount, bool useMetric, float baseMetric)
{
Vector4 shadowCascadeSplit = Vector4.one;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public static class Styles
public static GUIContent shadowDepthBias = EditorGUIUtility.TrTextContent("Depth Bias", "Controls the distance at which the shadows will be pushed away from the light. Useful for avoiding false self-shadowing artifacts.");
public static GUIContent shadowNormalBias = EditorGUIUtility.TrTextContent("Normal Bias", "Controls distance at which the shadow casting surfaces will be shrunk along the surface normal. Useful for avoiding false self-shadowing artifacts.");
public static GUIContent supportsSoftShadows = EditorGUIUtility.TrTextContent("Soft Shadows", "If enabled pipeline will perform shadow filtering. Otherwise all lights that cast shadows will fallback to perform a single shadow sample.");
public static GUIContent conservativeEnclosingSphere = EditorGUIUtility.TrTextContent("Conservative Enclosing Sphere", "Enable this option to improve shadow frustum culling and prevent Unity from excessively culling shadows in the corners of the shadow cascades. Disable this option only for compatibility purposes of existing projects created in previous Unity versions.");

// Post-processing
public static GUIContent colorGradingMode = EditorGUIUtility.TrTextContent("Grading Mode", "Defines how color grading will be applied. Operators will react differently depending on the mode.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ public partial class UniversalRenderPipelineAsset : RenderPipelineAsset, ISerial
[SerializeField] float m_ShadowDepthBias = 1.0f;
[SerializeField] float m_ShadowNormalBias = 1.0f;
[SerializeField] bool m_SoftShadowsSupported = false;
[SerializeField] bool m_ConservativeEnclosingSphere = false;
[SerializeField] int m_NumIterationsEnclosingSphere = 64;
Copy link
Contributor

Choose a reason for hiding this comment

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

How is this determined. Are there some sort of error bounds or empirical testing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just some manual empirical testing, and this gets the accuracy down to the 0.001.


// Light Cookie Settings
[SerializeField] LightCookieResolution m_AdditionalLightsCookieResolution = LightCookieResolution._2048;
Expand Down Expand Up @@ -260,6 +262,9 @@ public static UniversalRenderPipelineAsset Create(ScriptableRendererData rendere
// Initialize default Renderer
instance.m_EditorResourcesAsset = instance.editorResources;

// Only enable for new URP assets by default
instance.m_ConservativeEnclosingSphere = true;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Verasl @phi-lira @eh-unity This is how I am enabling it only for new projects. Let me know if this is the right approach.


return instance;
}

Expand Down Expand Up @@ -913,6 +918,18 @@ public bool useAdaptivePerformance
set { m_UseAdaptivePerformance = value; }
}

public bool conservativeEnclosingSphere
{
get { return m_ConservativeEnclosingSphere; }
set { m_ConservativeEnclosingSphere = value; }
}

public int numItertionsEnclosingSphere
Copy link
Contributor

Choose a reason for hiding this comment

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

A bit late to the party but there's a small spelling mistake here:

numItertionsEnclosingSphere -> numIterationsEnclosingSphere

{
get { return m_NumIterationsEnclosingSphere; }
set { m_NumIterationsEnclosingSphere = value; }
}

public override Material defaultMaterial
{
get { return GetMaterial(DefaultMaterialType.Standard); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ public static float maxRenderScale
get => 2.0f;
}

public static int maxNumIterationsEnclosingSphere
{
get => 1000;
}

// Amount of Lights that can be shaded per object (in the for loop in the shader)
public static int maxPerObjectLights
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,10 @@ public override void SetupCullingParameters(ref ScriptableCullingParameters cull
cullingParameters.maximumVisibleLights = UniversalRenderPipeline.maxVisibleAdditionalLights + 1;
}
cullingParameters.shadowDistance = cameraData.maxShadowDistance;

cullingParameters.conservativeEnclosingSphere = UniversalRenderPipeline.asset.conservativeEnclosingSphere;

cullingParameters.numIterationsEnclosingSphere = UniversalRenderPipeline.asset.numItertionsEnclosingSphere;
}

/// <inheritdoc />
Expand Down