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 @@ -19,6 +19,8 @@ The property to enable in your Frame Settings is: **Lighting > Contact Shadows**

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 shadows allow for transparent and transmissive GameObjects, lit by Di
| **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
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Core2D.hlsl"

PackedVaryings vert(Attributes input)
{
Varyings output = (Varyings)0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace UnityEditor.ShaderGraph
[Serializable]
class ShaderKeyword : ShaderInput
{
public const string kVariantLimitWarning = "Graph is generating too many variants. Either delete Keywords, reduce Keyword variants or increase the Shader Variant Limit in Preferences > Shader Graph.";
public const string kVariantLimitWarning = "Graph is generating too many variants. Either delete Keywords, reduce Keyword variants or increase the Shader Variant Limit in Preferences > Shader Graph or Project Settings > Shader Graph.";

public ShaderKeyword()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using UnityEngine;
using UnityEditor.Graphing;
using UnityEditor.ShaderGraph.Internal;
using UnityEngine.Rendering.ShaderGraph;

namespace UnityEditor.ShaderGraph
{
Expand Down Expand Up @@ -103,6 +104,15 @@ public override string ToString()
[SerializeField]
List<string> m_DropdownSelectedEntries = new List<string>();

public override string documentationURL {
get {
// TODO: There should be a way for unity authored and distributed subgraphs to provide custom doc links.
if (name.Contains("SpeedTree8"))
return Documentation.GetPageLink("SpeedTree8-SubGraphAssets");
else return Documentation.GetPageLink("Sub-graph");
}
}

public string subGraphGuid
{
get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ public GraphEditorView(EditorWindow editorWindow, GraphData graph, MessageManage
{
UserViewSettingsChangeCheck(newColorIndex);
}
GUILayout.Space(6);
GUILayout.EndHorizontal();
});
Add(toolbar);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using UnityEngine.UIElements;
using UnityEditor.UIElements;
using UnityEditor.Graphing;
using UnityEditor.ShaderGraph.Drawing.Inspector;

namespace UnityEditor.ShaderGraph.Drawing
{
Expand Down Expand Up @@ -62,6 +63,7 @@ private void Draw(CustomFunctionNode node)
node.functionName = m_FunctionName.value;
node.ValidateNode();
node.Dirty(ModificationScope.Graph);
this.GetFirstAncestorOfType<InspectorView>()?.RefreshInspectables();
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@
using UnityEditor.ShaderGraph.Internal;
using UnityEditor.ShaderGraph.Serialization;
using Object = System.Object;
using UnityEngine.Rendering.ShaderGraph;
using UnityEngine.Rendering;

namespace UnityEditor.ShaderGraph
{
[ExcludeFromPreset]
[ScriptedImporter(131, Extension, -902)]
[CoreRPHelpURL("Shader-Graph-Asset", "com.unity.shadergraph")]
class ShaderGraphImporter : ScriptedImporter
{
public const string Extension = "shadergraph";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
using UnityEditor.ShaderGraph.Internal;
using UnityEditor.ShaderGraph.Serialization;
using UnityEngine.Pool;
using UnityEngine.Rendering;

namespace UnityEditor.ShaderGraph
{
[ExcludeFromPreset]
[ScriptedImporter(30, Extension, -905)]
[CoreRPHelpURL("Sub-graph", "com.unity.shadergraph")]
class ShaderSubGraphImporter : ScriptedImporter
{
public const string Extension = "shadersubgraph";
Expand Down Expand Up @@ -423,7 +425,7 @@ static void GatherDescendentsFromGraph(GUID rootAssetGuid, out bool containsCirc
{
var dependencyMap = new Dictionary<GUID, GUID[]>();
AssetCollection tempAssetCollection = new AssetCollection();
using (ListPool<GUID>.Get(out var tempList))
using (UnityEngine.Pool.ListPool<GUID>.Get(out var tempList))
{
GatherDependencyMap(rootAssetGuid, dependencyMap, tempAssetCollection);
containsCircularDependency = ContainsCircularDependency(rootAssetGuid, dependencyMap, tempList);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ PropertyRow > #container > #label > Label.modified {
-unity-font-style: bold;
}

PropertyRow > #container > #content{
PropertyRow > #container > #content {
flex-grow: 10;
flex-basis: 0;
height: auto;
min-width: 36px;
-unity-font-style: bold;
width: 100px;
justify-content: center;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ PropertySheet > #content > #header > Label{
font-size: 15px;
color: #a4a4a4;
-unity-font-style: bold;
white-space: normal;
}

PropertySheet > #content > #foldout {
Expand Down
77 changes: 46 additions & 31 deletions Packages/com.unity.shadergraph/Editor/ShaderGraphPreferences.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,26 @@

namespace UnityEditor.ShaderGraph
{
internal class LabelWidthScope : GUI.Scope
{
float m_previewLabelWidth;
internal LabelWidthScope(int labelPadding = 10, int labelWidth = 251)
{
m_previewLabelWidth = EditorGUIUtility.labelWidth;
EditorGUIUtility.labelWidth = labelWidth;
GUILayout.BeginHorizontal();
GUILayout.Space(labelPadding);
GUILayout.BeginVertical();
}

protected override void CloseScope()
{
GUILayout.EndVertical();
GUILayout.EndHorizontal();
EditorGUIUtility.labelWidth = m_previewLabelWidth;
}
}

static class ShaderGraphPreferences
{
static class Keys
Expand Down Expand Up @@ -69,42 +89,37 @@ static void OpenGUI()
if (!m_Loaded)
Load();

var previousLabelWidth = EditorGUIUtility.labelWidth;
EditorGUIUtility.labelWidth = 256;

EditorGUILayout.Space();

EditorGUI.BeginChangeCheck();

var actualLimit = ShaderGraphProjectSettings.instance.shaderVariantLimit;
var willPreviewVariantBeIgnored = ShaderGraphPreferences.previewVariantLimit > actualLimit;
using (var scope = new LabelWidthScope(10, 300))
{
var actualLimit = ShaderGraphProjectSettings.instance.shaderVariantLimit;
var willPreviewVariantBeIgnored = ShaderGraphPreferences.previewVariantLimit > actualLimit;

var variantLimitLabel = willPreviewVariantBeIgnored
? new GUIContent("Preview Variant Limit", EditorGUIUtility.IconContent("console.infoicon").image, $"The Preview Variant Limit is higher than the Shader Variant Limit in Project Settings: {actualLimit}. The Preview Variant Limit will be ignored.")
: new GUIContent("Preview Variant Limit");
var variantLimitLabel = willPreviewVariantBeIgnored
? new GUIContent("Preview Variant Limit", EditorGUIUtility.IconContent("console.infoicon").image, $"The Preview Variant Limit is higher than the Shader Variant Limit in Project Settings: {actualLimit}. The Preview Variant Limit will be ignored.")
: new GUIContent("Preview Variant Limit");

var variantLimitValue = EditorGUILayout.DelayedIntField(variantLimitLabel, previewVariantLimit);
variantLimitValue = Mathf.Max(0, variantLimitValue);
if (EditorGUI.EndChangeCheck())
{
previewVariantLimit = variantLimitValue;
}
EditorGUI.BeginChangeCheck();
var variantLimitValue = EditorGUILayout.DelayedIntField(variantLimitLabel, previewVariantLimit);
variantLimitValue = Mathf.Max(0, variantLimitValue);
if (EditorGUI.EndChangeCheck())
{
previewVariantLimit = variantLimitValue;
}

EditorGUI.BeginChangeCheck();
var autoAddRemoveBlocksValue = EditorGUILayout.Toggle("Automatically Add and Remove Block Nodes", autoAddRemoveBlocks);
if (EditorGUI.EndChangeCheck())
{
autoAddRemoveBlocks = autoAddRemoveBlocksValue;
}
EditorGUI.BeginChangeCheck();
var autoAddRemoveBlocksValue = EditorGUILayout.Toggle("Automatically Add and Remove Block Nodes", autoAddRemoveBlocks);
if (EditorGUI.EndChangeCheck())
{
autoAddRemoveBlocks = autoAddRemoveBlocksValue;
}

EditorGUI.BeginChangeCheck();
var allowDeprecatedBehaviorsValue = EditorGUILayout.Toggle("Enable Deprecated Nodes", allowDeprecatedBehaviors);
if (EditorGUI.EndChangeCheck())
{
allowDeprecatedBehaviors = allowDeprecatedBehaviorsValue;
EditorGUI.BeginChangeCheck();
var allowDeprecatedBehaviorsValue = EditorGUILayout.Toggle("Enable Deprecated Nodes", allowDeprecatedBehaviors);
if (EditorGUI.EndChangeCheck())
{
allowDeprecatedBehaviors = allowDeprecatedBehaviorsValue;
}
}

EditorGUIUtility.labelWidth = previousLabelWidth;
}

static void Load()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ MonoBehaviour:
PerPixelGammaThreshold: 0.003921569
PerPixelAlphaThreshold: 0.003921569
RMSEThreshold: 0
AverageCorrectnessThreshold: 0.00065
AverageCorrectnessThreshold: 0.0007
IncorrectPixelsThreshold: 0.0000038146973
UseHDR: 0
UseBackBuffer: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ MonoBehaviour:
ColorSpace: -1
BuildPlatform: -2
GraphicsDevice: 17
Architecture: 0
XrSdk: None
StereoModes: 0
Reason: Needs fixing in OpenGL
Expand All @@ -28,6 +29,7 @@ MonoBehaviour:
ColorSpace: -1
BuildPlatform: -2
GraphicsDevice: 17
Architecture: 0
XrSdk: None
StereoModes: 0
Reason: Needs fixing in OpenGL
Expand All @@ -37,6 +39,87 @@ MonoBehaviour:
ColorSpace: -1
BuildPlatform: 13
GraphicsDevice: 11
Architecture: 0
XrSdk: None
StereoModes: 0
Reason: Post Process needs fixing
- FilteredScene: {fileID: 0}
FilteredScenes:
- {fileID: 102900000, guid: 872553bc79db0924cb5950ce38bb55fe, type: 3}
ColorSpace: -1
BuildPlatform: 19
GraphicsDevice: 21
Architecture: 0
XrSdk:
StereoModes: 0
Reason: Shadow vulkan issue
- FilteredScene: {fileID: 0}
FilteredScenes:
- {fileID: 102900000, guid: e06c2b4e832508b4c81cf82a2e48355e, type: 3}
ColorSpace: -1
BuildPlatform: 19
GraphicsDevice: 21
Architecture: 0
XrSdk:
StereoModes: 0
Reason: Shadow vulkan issue
- FilteredScene: {fileID: 0}
FilteredScenes:
- {fileID: 102900000, guid: 966062afce8978f48b90fbe2210979b6, type: 3}
ColorSpace: -1
BuildPlatform: 19
GraphicsDevice: 21
Architecture: 0
XrSdk:
StereoModes: 0
Reason: Shadow vulkan issue
- FilteredScene: {fileID: 0}
FilteredScenes:
- {fileID: 102900000, guid: 4f7a50da47cfeca46b45fe14be17081d, type: 3}
ColorSpace: -1
BuildPlatform: 19
GraphicsDevice: 21
Architecture: 0
XrSdk:
StereoModes: 0
Reason: Shadow vulkan issue
- FilteredScene: {fileID: 0}
FilteredScenes:
- {fileID: 102900000, guid: 872553bc79db0924cb5950ce38bb55fe, type: 3}
ColorSpace: -1
BuildPlatform: 13
GraphicsDevice: 21
Architecture: 0
XrSdk:
StereoModes: 0
Reason: Shadow vulkan issue
- FilteredScene: {fileID: 0}
FilteredScenes:
- {fileID: 102900000, guid: e06c2b4e832508b4c81cf82a2e48355e, type: 3}
ColorSpace: -1
BuildPlatform: 13
GraphicsDevice: 21
Architecture: 0
XrSdk:
StereoModes: 0
Reason: Shadow vulkan issue
- FilteredScene: {fileID: 0}
FilteredScenes:
- {fileID: 102900000, guid: 966062afce8978f48b90fbe2210979b6, type: 3}
ColorSpace: -1
BuildPlatform: 13
GraphicsDevice: 21
Architecture: 0
XrSdk:
StereoModes: 0
Reason: Shadow vulkan issue
- FilteredScene: {fileID: 0}
FilteredScenes:
- {fileID: 102900000, guid: 4f7a50da47cfeca46b45fe14be17081d, type: 3}
ColorSpace: -1
BuildPlatform: 13
GraphicsDevice: 21
Architecture: 0
XrSdk:
StereoModes: 0
Reason: Shadow vulkan issue