Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@ public class MySettingsPropertyDrawer : PropertyDrawer

To add items to the **More** (⋮) menu of a settings group, follow these steps:

1. Create a class that implements the [`IRenderPipelineGraphicsSettingsContextMenu`](https://docs.unity3d.com/6000.1/Documentation/ScriptReference/Rendering.IRenderPipelineGraphicsSettingsContextMenu.html) interface.
1. Create a class that implements the [`IRenderPipelineGraphicsSettingsContextMenu2<T>`](https://docs.unity3d.com/6000.1/Documentation/ScriptReference/Rendering.IRenderPipelineGraphicsSettingsContextMenu2_1.html) interface.
2. Implement the `PopulateContextMenu` method.
3. To add an item, use the `AddItem` API.

For example:

```c#
public class MySettingsContextMenu : IRenderPipelineGraphicsSettingsContextMenu<MySettings>
public class MySettingsContextMenu : IRenderPipelineGraphicsSettingsContextMenu2<MySettings>
{
void IRenderPipelineGraphicsSettingsContextMenu<MySettings>.PopulateContextMenu(MySettings setting, PropertyDrawer _, ref GenericMenu menu)
void IRenderPipelineGraphicsSettingsContextMenu2<MySettings>.PopulateContextMenu(MySettings setting, SerializedProperty _, ref GenericMenu menu)
{
menu.AddItem(new GUIContent("My custom menu item"), false, () => { Debug.Log("Menu item was selected."); });
}
Expand All @@ -74,4 +74,5 @@ public class MySettingsContextMenu : IRenderPipelineGraphicsSettingsContextMenu<
## Additional resources

- [PropertyDrawer](xref:UnityEditor.PropertyDrawer)
- [IRenderPipelineGraphicsSettingsContextMenu](https://docs.unity3d.com/6000.1/Documentation/ScriptReference/Rendering.IRenderPipelineGraphicsSettingsContextMenu.html)
- [IRenderPipelineGraphicsSettingsContextMenu2](https://docs.unity3d.com/6000.2/Documentation/ScriptReference/Rendering.IRenderPipelineGraphicsSettingsContextMenu2.html)
- [IRenderPipelineGraphicsSettingsContextMenu2<T>](https://docs.unity3d.com/6000.2/Documentation/ScriptReference/Rendering.IRenderPipelineGraphicsSettingsContextMenu2_1.html)
22 changes: 22 additions & 0 deletions Packages/com.unity.render-pipelines.core/Editor/Deprecated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.UIElements;

namespace UnityEditor.Rendering
{
Expand Down Expand Up @@ -159,7 +160,28 @@ public DefaultVolumeProfileEditor(Editor baseEditor, VolumeProfile profile)
}
}

public abstract partial class DefaultVolumeProfileSettingsPropertyDrawer
{
/// <summary>
/// Context menu implementation for Default Volume Profile.
/// </summary>
/// <typeparam name="TSetting">Default Volume Profile Settings type</typeparam>
/// <typeparam name="TRenderPipeline">Render Pipeline type</typeparam>
[Obsolete("Use DefaultVolumeProfileSettingsPropertyDrawer<T>.DefaultVolumeProfileSettingsContextMenu2<TSetting, TRenderPipeline> instead #from(6000.0)")]
public abstract class DefaultVolumeProfileSettingsContextMenu<TSetting, TRenderPipeline> : IRenderPipelineGraphicsSettingsContextMenu<TSetting>
where TSetting : class, IDefaultVolumeProfileSettings
where TRenderPipeline : RenderPipeline
{
/// <summary>
/// Path where new Default Volume Profile will be created.
/// </summary>
[Obsolete("Not used anymore. #from(6000.0)")]
protected abstract string defaultVolumeProfilePath { get; }

[Obsolete("Not used anymore. #from(6000.0)")]
void IRenderPipelineGraphicsSettingsContextMenu<TSetting>.PopulateContextMenu(TSetting setting, PropertyDrawer property, ref GenericMenu menu){ }
}
}

/// <summary>
/// Builtin Drawer for Maskfield Debug Items.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace UnityEditor.Rendering
/// <summary>
/// Base implementation for drawing Default Volume Profile UI in Graphics Settings.
/// </summary>
public abstract class DefaultVolumeProfileSettingsPropertyDrawer : PropertyDrawer
public abstract partial class DefaultVolumeProfileSettingsPropertyDrawer : PropertyDrawer
{
// UUM-77758: Due to how PropertyDrawers are created and cached, there is no way to retrieve them reliably
// later. We know that only one DefaultVolumeProfile exists at any given time, so we can access it through
Expand Down Expand Up @@ -118,7 +118,7 @@ protected void DestroyDefaultVolumeProfileEditor()
/// </summary>
/// <typeparam name="TSetting">Default Volume Profile Settings type</typeparam>
/// <typeparam name="TRenderPipeline">Render Pipeline type</typeparam>
public abstract class DefaultVolumeProfileSettingsContextMenu<TSetting, TRenderPipeline> : IRenderPipelineGraphicsSettingsContextMenu<TSetting>
public abstract class DefaultVolumeProfileSettingsContextMenu2<TSetting, TRenderPipeline> : IRenderPipelineGraphicsSettingsContextMenu2<TSetting>
where TSetting : class, IDefaultVolumeProfileSettings
where TRenderPipeline : RenderPipeline
{
Expand All @@ -127,7 +127,7 @@ public abstract class DefaultVolumeProfileSettingsContextMenu<TSetting, TRenderP
/// </summary>
protected abstract string defaultVolumeProfilePath { get; }

void IRenderPipelineGraphicsSettingsContextMenu<TSetting>.PopulateContextMenu(TSetting setting, PropertyDrawer _, ref GenericMenu menu)
void IRenderPipelineGraphicsSettingsContextMenu2<TSetting>.PopulateContextMenu(TSetting setting, SerializedProperty _, ref GenericMenu menu)
{
bool canCreateNewAsset = RenderPipelineManager.currentPipeline is TRenderPipeline;
VolumeProfileUtils.AddVolumeProfileContextMenuItems(ref menu,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,23 @@ public sealed partial class VolumeManager
.OrderBy(i => i.Item1)
.ToList();
}

Type[] m_BaseComponentTypeArray;

/// <summary>
/// The current list of all available types that derive from <see cref="VolumeComponent"/>.
/// </summary>
public Type[] baseComponentTypeArray { get; internal set; } // internal only for tests
public Type[] baseComponentTypeArray
{
get
{
if (isInitialized)
return m_BaseComponentTypeArray;

throw new InvalidOperationException($"{nameof(VolumeManager)}.{nameof(instance)}.{nameof(baseComponentTypeArray)} cannot be called before the {nameof(VolumeManager)} is initialized. (See {nameof(VolumeManager)}.{nameof(instance)}.{nameof(isInitialized)} and {nameof(RenderPipelineManager)} for creation callback).");
}
internal set => m_BaseComponentTypeArray = value; // internal only for tests
}

/// <summary>
/// Global default profile that provides default values for volume components. VolumeManager applies
Expand Down Expand Up @@ -221,13 +233,19 @@ public void Initialize(VolumeProfile globalDefaultVolumeProfile = null, VolumePr
Debug.Assert(m_CreatedVolumeStacks.Count == 0);

LoadBaseTypes(GraphicsSettings.currentRenderPipelineAssetType);
InitializeInternal(globalDefaultVolumeProfile, qualityDefaultVolumeProfile);
}

//This is called by test where the basetypes are tuned for the purpose of the test.
internal void InitializeInternal(VolumeProfile globalDefaultVolumeProfile = null, VolumeProfile qualityDefaultVolumeProfile = null)
{
InitializeVolumeComponents();

globalDefaultProfile = globalDefaultVolumeProfile;
qualityDefaultProfile = qualityDefaultVolumeProfile;
EvaluateVolumeDefaultState();

m_DefaultStack = CreateStack();
m_DefaultStack = CreateStackInternal();
stack = m_DefaultStack;

isInitialized = true;
Expand Down Expand Up @@ -326,9 +344,17 @@ public void OnVolumeComponentChanged(VolumeComponent component)
/// <seealso cref="VolumeStack"/>
/// <seealso cref="Update(VolumeStack,Transform,LayerMask)"/>
public VolumeStack CreateStack()
{
if (!isInitialized)
throw new InvalidOperationException($"{nameof(VolumeManager)}.{nameof(instance)}.{nameof(CreateStack)}() cannot be called before the {nameof(VolumeManager)} is initialized. (See {nameof(VolumeManager)}.{nameof(instance)}.{nameof(isInitialized)} and {nameof(RenderPipelineManager)} for creation callback).");

return CreateStackInternal();
}

VolumeStack CreateStackInternal()
{
var stack = new VolumeStack();
stack.Reload(baseComponentTypeArray);
stack.Reload(m_BaseComponentTypeArray);
m_CreatedVolumeStacks.Add(stack);
return stack;
}
Expand Down Expand Up @@ -400,15 +426,18 @@ internal void LoadBaseTypes(Type pipelineAssetType)
list.Add(t);
}

baseComponentTypeArray = list.ToArray();
m_BaseComponentTypeArray = list.ToArray();
}
}

internal void InitializeVolumeComponents()
{
if (m_BaseComponentTypeArray == null || m_BaseComponentTypeArray.Length == 0)
return;

// Call custom static Init method if present
var flags = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
foreach (var type in baseComponentTypeArray)
foreach (var type in m_BaseComponentTypeArray)
{
var initMethod = type.GetMethod("Init", flags);
if (initMethod != null)
Expand All @@ -419,9 +448,9 @@ internal void InitializeVolumeComponents()
}

// Evaluate static default values for VolumeComponents, which is the baseline to reset the values to at the start of Update.
internal void EvaluateVolumeDefaultState()
void EvaluateVolumeDefaultState()
{
if (baseComponentTypeArray == null || baseComponentTypeArray.Length == 0)
if (m_BaseComponentTypeArray == null || m_BaseComponentTypeArray.Length == 0)
return;

using var profilerScope = k_ProfilerMarkerEvaluateVolumeDefaultState.Auto();
Expand All @@ -432,7 +461,7 @@ internal void EvaluateVolumeDefaultState()

// First, default-construct all VolumeComponents
List<VolumeComponent> componentsDefaultStateList = new();
foreach (var type in baseComponentTypeArray)
foreach (var type in m_BaseComponentTypeArray)
{
componentsDefaultStateList.Add((VolumeComponent) ScriptableObject.CreateInstance(type));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ Enable the following properties:

You can enable Contact Shadows on a per Light basis for Directional, Point, and Spot Lights. Tick the **Enable** checkbox under the **Contact Shadows** drop-down in the **Shadows** section of each Light to indicate that HDRP should calculate Contact Shadows for that Light.

If you use both contact shadows and [realtime shadows](realtime-shadows.md), there might be a visible seam between the two types of shadow. To avoid this issue, set shadow maps to use a high resolution. For more information, refer to [Control shadow resolution and quality](Shadows-in-HDRP.md).

**Note**: A Light casts Contact Shadows for every Mesh Renderer that uses a Material that writes to the depth buffer. This is regardless of whether you enable or disable the **Cast Shadows** property on the Mesh Renderer. This means that you can disable **Cast Shadows** on small GameObjects/props and still have them cast Contact Shadows. This is good if you do not want HDRP to render these GameObjects in shadow maps. If you do not want this behavior, use Shader Graph to author a Material that does not write to the depth buffer.

[!include[](snippets/volume-override-api.md)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Ray-traced Directional Light shadows without colored shadows
| **Sample Count** | Controls the number of rays that HDRP uses per pixel, per frame. Higher values produce more accurate shadows. Increasing this value increases execution time linearly. |
| **Color Shadow** | Allows transparent and transmissive GameObjects to cast colored shadows. A Material can only cast colored shadows when its [**Refraction Model**](Surface-Type.md#transparency-inputs) is set to **Thin**, **Box** or **Sphere**. |
| **Denoise** | Enables the spatio-temporal filter that HDRP uses to remove noise from the ray-traced shadows; making them smoother. |
| - **Denoiser Radius** | Controls the radius of the spatio-temporal filter. |
| - **Denoiser Radius** | Increases or decreases the blurriness between ray traced shadows, by controlling the radius of the spatio-temporal filter. |

<a name="PointLight"></a>

Expand Down
Loading