Skip to content
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

Internal/2023.1/staging #7963

Merged
merged 28 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
70c8295
[Backport 2023.1][Terrain] Detail Mesh Motion Vector Workaround
volkan-unity Aug 31, 2023
5b62e09
[URP[[2023.1] Fixing rendering layers not updated when opening a proj…
ellioman Aug 31, 2023
580506d
[2023.1]Taa VeryHigh Fallback to Clamp on 32-bit target.
eh-unity Aug 31, 2023
b9f6e6f
[URP][2023.1] Fixing a NullReferenceException when trying to add a Re…
ellioman Sep 6, 2023
b850b71
[2023.1][URP] Soft shadow quality keywords
jonuuukas Sep 6, 2023
5fdd5d6
[URP][2023.1] Backport UUM-46851 Implicit Truncation shader warning
skip-petty Sep 6, 2023
4a9d494
Stop popping the Wizard windows when the Global Settings are invalid.
YohannVaastUnity Sep 6, 2023
c2066e3
[Backport 2023.1] [HDRP] Bunch of fixes for HDRP (Version 20)
sebastienlagarde Sep 6, 2023
a42bbe3
[content automatically redacted] touching PlatformDependent folder
RobJessop Sep 6, 2023
44cf132
[Port] [2023.1] Fixed potential crash when rendering fog volumes
svc-reach-platform-support Sep 7, 2023
c5d713b
[VFX/HDRP] Fix picking pass (to 2023.1)
PaulDemeulenaere Sep 8, 2023
846fd4e
[2023.1] ComplexLit and Unlit GBuffer fill
eh-unity Sep 8, 2023
11b49e7
[URP][2023.1] Fixing an issue with reflection probe updates in Forwar…
ellioman Sep 11, 2023
856352b
[Backport 2023.1][HDRP] Bunch of fixes for HDRP (Version 21)
sebastienlagarde Sep 11, 2023
97e64ba
2023.1/documentation staging
RobJessop Sep 11, 2023
ca02f4c
[Port] [2023.1] [Water] Fix crash on OSX local builds due to buffer f…
svc-reach-platform-support Sep 11, 2023
20c6c83
[2023.1] Fix what's new page images not link properly
sebastienlagarde Sep 11, 2023
b4a3040
[Backport 23.1][UUM-40770] Swap buffer for Renderer2D
kennytann Sep 12, 2023
284bafb
[Backport 2023.1] Fix Lightprobe Group Warning UI
LagueKristin Sep 12, 2023
df6f504
[Backport] Fixed reflection probe atlas size in performance tests.
JulienIgnace-Unity Sep 12, 2023
8e287cd
[2023.1] [HDRP] Various fixes
adrien-de-tocqueville Sep 14, 2023
02b4586
[Backport][2023.1] Fix ArgumentOutOfRangeException from StaticLightin…
svc-reach-platform-support Sep 14, 2023
d20928f
Fixed issue with overlapping composite shadowcaster2ds [2023.1]
unity-cchu Sep 19, 2023
d8a28f3
Errors in the console of the standalone Profiler
YohannVaastUnity Sep 20, 2023
cb42e9e
[Backport][2023.1][VFX] Removed custom object field so that search wi…
julienamsellem Sep 22, 2023
7e8e1f9
2023.1: [RTHandles] Adding missing Stencil Format param
knatraj-rythmos Sep 22, 2023
f0f3cbf
[URP][2023.1] Fixing an editor issue when selecting a camera using st…
ellioman Sep 22, 2023
6a15292
[23.1] Backport Replace find missing docs by validate packages
theopnv Sep 25, 2023
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 @@ -907,12 +907,10 @@ static void OnAdditionalProbesBakeCompleted()
s_CustomDilationThresh[(cell.index, i)] = thresh;
}

intensityScale = touchupVolume.intensityScale;

if (touchupVolume.mode == ProbeTouchupVolume.Mode.IntensityScale)
intensityScale = touchupVolume.intensityScale;
if (intensityScale != 1.0f)
{
cell.touchupVolumeInteraction[i] = 2.0f + intensityScale;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEditor;
using UnityEditor.Rendering;
using UnityEngine.Rendering;
using UnityEditorInternal;
using System;

using RuntimeSRPPreferences = UnityEngine.Rendering.CoreRenderPipelinePreferences;

namespace UnityEditor.Rendering
Expand Down Expand Up @@ -33,7 +34,11 @@ internal static class Styles
internal static readonly GUIContent s_VolumeHeader = EditorGUIUtility.TrTextContent("Influence Volume");
internal static readonly GUIContent s_TouchupHeader = EditorGUIUtility.TrTextContent("Probe Volume Overrides");

internal static readonly GUIContent s_Mode = new GUIContent("Mode", "Choose which type of adjustment to apply to probes covered by this volume.");
internal static readonly GUIContent s_DilationThreshold = new GUIContent("Dilation Validity Threshold", "Override the Dilation Validity Threshold for probes covered by this Probe Adjustment Volume. Higher values increase the chance of probes being considered invalid.");
internal static readonly GUIContent s_UpdateValidity = new GUIContent("Update Probe Validity", "Invalidate probes covered by this Probe Adjustment Volume.");
internal static readonly GUIContent s_VODirection = new GUIContent("Direction", "Rotate the axis along which probes will be pushed when applying Virtual Offset.");
internal static readonly GUIContent s_VODistance = new GUIContent("Distance", "Determines how far probes are pushed in the direction of the Virtual Offset.");

internal static readonly EditMode.SceneViewEditMode VirtualOffsetEditMode = (EditMode.SceneViewEditMode)110;

Expand All @@ -50,6 +55,15 @@ internal static class Styles
};
}

static internal bool Button(GUIContent content)
{
GUILayout.BeginHorizontal();
EditorGUILayout.Space(15 * EditorGUI.indentLevel, false);
bool value = GUILayout.Button(content, EditorStyles.miniButton);
GUILayout.EndHorizontal();
return value;
}

static class ProbeTouchupVolumeUI
{
public static readonly CED.IDrawer Inspector = null;
Expand Down Expand Up @@ -93,14 +107,41 @@ public static void DrawVolumeContent(SerializedProbeTouchupVolume serialized, Ed

}

static T[] RemoveAt<T>(T[] values, int index)
{
var list = new List<T>(values);
list.RemoveAt(index);
return list.ToArray();
}
static GUIContent[] CastArray(string[] values)
{
var result = new GUIContent[values.Length];
for (int i = 0; i < values.Length; i++)
result[i] = new GUIContent(ObjectNames.NicifyVariableName(values[i]));
return result;
}

public static void DrawTouchupContent(SerializedProbeTouchupVolume serialized, Editor owner)
{
ProbeTouchupVolume ptv = (serialized.serializedObject.targetObject as ProbeTouchupVolume);

var bakingSet = ProbeReferenceVolume.instance.sceneData.GetBakingSetForScene(ptv.gameObject.scene);
bool useVirtualOffset = bakingSet != null ? bakingSet.settings.virtualOffsetSettings.useVirtualOffset : false;

EditorGUILayout.PropertyField(serialized.mode);
var hiddenMode = (int)ProbeTouchupVolume.Mode.IntensityScale;
var availableValues = (int[])Enum.GetValues(typeof(ProbeTouchupVolume.Mode));
var availableModes = CastArray(Enum.GetNames(typeof(ProbeTouchupVolume.Mode)));
if (!k_AdditionalPropertiesState[AdditionalProperties.Touchup] && serialized.mode.intValue != hiddenMode)
{
int idx = Array.IndexOf(availableValues, hiddenMode);
availableValues = RemoveAt(availableValues, idx);
availableModes = RemoveAt(availableModes, idx);
}

EditorGUI.BeginChangeCheck();
int newValue = EditorGUILayout.IntPopup(Styles.s_Mode, serialized.mode.intValue, availableModes, availableValues);
if (EditorGUI.EndChangeCheck())
serialized.mode.intValue = newValue;

if (serialized.mode.intValue == (int)ProbeTouchupVolume.Mode.OverrideValidityThreshold)
{
Expand All @@ -111,7 +152,7 @@ public static void DrawTouchupContent(SerializedProbeTouchupVolume serialized, E
EditorGUI.BeginDisabledGroup(!useVirtualOffset);
EditorGUILayout.BeginHorizontal();

EditorGUILayout.PropertyField(serialized.virtualOffsetRotation);
EditorGUILayout.PropertyField(serialized.virtualOffsetRotation, Styles.s_VODirection);

var editMode = Styles.VirtualOffsetEditMode;
EditorGUI.BeginChangeCheck();
Expand All @@ -123,12 +164,15 @@ public static void DrawTouchupContent(SerializedProbeTouchupVolume serialized, E
}
EditorGUILayout.EndHorizontal();

EditorGUILayout.PropertyField(serialized.virtualOffsetDistance);
EditorGUILayout.PropertyField(serialized.virtualOffsetDistance, Styles.s_VODistance);
EditorGUI.EndDisabledGroup();

if (!useVirtualOffset)
{
EditorGUILayout.HelpBox("Apply Virtual Offset can be used only if Virtual Offset is enabled for the Baking Set.", MessageType.Warning);
CoreEditorUtils.DrawFixMeBox("Apply Virtual Offset can be used only if Virtual Offset is enabled for the Baking Set.", MessageType.Warning, "Open", () =>
{
ProbeVolumeLightingTab.OpenBakingSet(bakingSet);
});
}
}
else if (serialized.mode.intValue == (int)ProbeTouchupVolume.Mode.OverrideVirtualOffsetSettings)
Expand All @@ -146,11 +190,16 @@ public static void DrawTouchupContent(SerializedProbeTouchupVolume serialized, E
}
else if (serialized.mode.intValue == (int)ProbeTouchupVolume.Mode.InvalidateProbes)
{
if (GUILayout.Button(EditorGUIUtility.TrTextContent("Update Probe Validity", "Update the validity of probes falling within probe adjustment volumes."), EditorStyles.miniButton))
if (Button(Styles.s_UpdateValidity))
{
ProbeGIBaking.RecomputeValidityAfterBake();
}
}
else if (serialized.mode.intValue == (int)ProbeTouchupVolume.Mode.IntensityScale)
{
EditorGUILayout.HelpBox("Overriding the intensity of probes can break the physical plausibility of lighting. This may result in unwanted visual inconsistencies.", MessageType.Info, wide: true);
EditorGUILayout.PropertyField(serialized.intensityScale);
}
}

internal static Bounds GetBounds(SerializedProbeTouchupVolume serialized, Editor owner)
Expand All @@ -165,11 +214,6 @@ internal static Bounds GetBounds(SerializedProbeTouchupVolume serialized, Editor

public static void DrawTouchupAdditionalContent(SerializedProbeTouchupVolume serialized, Editor owner)
{
if (serialized.mode.intValue == (int)ProbeTouchupVolume.Mode.InvalidateProbes)
{
EditorGUILayout.HelpBox("Changing the intensity of probe data is a delicate operation that can lead to inconsistencies in the lighting, hence the feature is to be used sparingly.", MessageType.Info, wide: true);
EditorGUILayout.PropertyField(serialized.intensityScale);
}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ static class Styles

public static readonly GUIContent dilationSettingsTitle = EditorGUIUtility.TrTextContent("Probe Dilation Settings");
public static readonly GUIContent virtualOffsetSettingsTitle = EditorGUIUtility.TrTextContent("Virtual Offset Settings");

public static GUIStyle voButtonStyle = new GUIStyle(EditorStyles.miniButton);
}

// PropertyDrawer are not made to use GUILayout, so it will try to reserve a rect before calling OnGUI
Expand Down Expand Up @@ -72,14 +70,11 @@ void DrawDilationSettings(SerializedProperty dilationSettings)

if (Unsupported.IsDeveloperMode())
{
GUILayout.BeginHorizontal();
EditorGUILayout.Space(15 * EditorGUI.indentLevel, false);
if (GUILayout.Button(EditorGUIUtility.TrTextContent("Refresh Dilation"), EditorStyles.miniButton))
if (ProbeTouchupVolumeEditor.Button(EditorGUIUtility.TrTextContent("Refresh Dilation")))
{
ProbeGIBaking.RevertDilation();
ProbeGIBaking.PerformDilation();
}
GUILayout.EndHorizontal();
}
}
}
Expand All @@ -103,13 +98,10 @@ void DrawVirtualOffsetSettings(SerializedProperty virtualOffsetSettings)
EditorGUILayout.PropertyField(virtualOffsetMaxHitsPerRay, Styles.virtualOffsetMaxHitsPerRay);
EditorGUILayout.PropertyField(virtualOffsetCollisionMask, Styles.virtualOffsetCollisionMask);

GUILayout.BeginHorizontal();
EditorGUILayout.Space(15 * EditorGUI.indentLevel, false);
if (GUILayout.Button(EditorGUIUtility.TrTextContent("Refresh Virtual Offset Debug", "Re-run the virtual offset simulation; it will be applied only for debug visualization sake and not affect baked data."), Styles.voButtonStyle))
if (ProbeTouchupVolumeEditor.Button(EditorGUIUtility.TrTextContent("Refresh Virtual Offset Debug", "Re-run the virtual offset simulation; it will be applied only for debug visualization sake and not affect baked data.")))
{
ProbeGIBaking.RecomputeVOForDebugOnly();
}
GUILayout.EndHorizontal();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,12 @@ public override void OnHeaderSettingsGUI()

var rect = GUILayoutUtility.GetRect(iconSize.x, iconSize.y);
if (EditorGUI.DropdownButton(rect, Styles.settingsIcon, FocusType.Passive, EditorStyles.iconButton))
EditorUtility.DisplayCustomMenu(rect, new[] { EditorGUIUtility.TrTextContent("Open Debug Window") }, -1, OpenProbeVolumeDebugPanel, null);
EditorUtility.DisplayCustomMenu(rect, new[] { EditorGUIUtility.TrTextContent("Open Rendering Debugger") }, -1, OpenProbeVolumeDebugPanel, null);

//var style = new GUIStyle(EditorStyles.iconButton);
//style.padding = new RectOffset(1, 1, 1, 1);
//if (GUI.Button(rect, Styles.debugIcon, style))
// OpenProbeVolumeDebugPanel(null, null, 0);
}

void OpenProbeVolumeDebugPanel(object userData, string[] options, int selected)
Expand Down Expand Up @@ -880,7 +885,7 @@ internal static bool AllSetScenesAreLoaded(ProbeVolumeBakingSet set)
internal static void OpenBakingSet(ProbeVolumeBakingSet bakingSet)
{
var lightingWindow = Type.GetType("UnityEditor.LightingWindow,UnityEditor");
EditorWindow.GetWindow(lightingWindow, utility: false, title: null, focus: false);
EditorWindow.GetWindow(lightingWindow, utility: false, title: null, focus: true);
if (instance == null)
return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public enum Shape
};

/// <summary>The shape of the adjustment volume</summary>
[Tooltip("Select the shape used for this Probe Adjustment Volume.")]
public Shape shape = Shape.Box;

/// <summary>
Expand All @@ -46,16 +47,17 @@ public enum Mode
ApplyVirtualOffset,
/// <summary>Override the virtual offset settings for the probes within the adjustment volume.</summary>
OverrideVirtualOffsetSettings,
/// <summary>Scale probe intensity.</summary>
IntensityScale = 99, // make sure this appears last
};

/// <summary>Choose what to do with probes falling inside this volume</summary>
[Tooltip("Choose what to do with probes falling inside this volume.")]
public Mode mode = Mode.InvalidateProbes;

/// <summary>
/// A scale to apply to probes falling within the invalidation volume. It is really important to use this with caution as it can lead to inconsistent lighting.
/// </summary>
[Range(0.0001f, 2.0f), Tooltip("A scale to be applied to all probes that fall within this Probe Adjustment Volume.")]
[Range(0.0001f, 2.0f), Tooltip("A multiplier applied to the intensity of probes covered by this Probe Adjustment Volume.")]
public float intensityScale = 1.0f;

/// <summary>
Expand All @@ -65,11 +67,10 @@ public enum Mode
public float overriddenDilationThreshold = 0.75f;

/// <summary>The rotation angles for the virtual offset direction.</summary>
[Tooltip("The rotation angles for the virtual offset direction.")]
public Vector3 virtualOffsetRotation = Vector3.zero;

/// <summary>Determines how far probes are pushed along the specified virtual offset direction.</summary>
[Min(0.0f), Tooltip("Determines how far probes are pushed along the specified virtual offset direction.")]
[Min(0.0f)]
public float virtualOffsetDistance = 1.0f;

/// <summary>Determines how far Unity pushes a probe out of geometry after a ray hit.</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1487,8 +1487,10 @@ int GetLatestProducerIndex(int passIndex, in CompiledResourceInfo info)
int result = -1;
foreach (var producer in info.producers)
{
var producerPassInfo = m_CompiledPassInfos[producer];
// producers are by construction in increasing order.
if (producer < passIndex)
// We also need to make sure we don't return a pass that was culled (can happen at this point because of renderer list culling).
if (producer < passIndex && !(producerPassInfo.culled || producerPassInfo.culledByRendererList))
result = producer;
else
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,8 @@ public RTHandle Alloc(
if (isShadowMap || depthBufferBits != DepthBits.None)
{
RenderTextureFormat format = isShadowMap ? RenderTextureFormat.Shadowmap : RenderTextureFormat.Depth;
GraphicsFormat stencilFormat = !isShadowMap && SystemInfo.IsFormatSupported(GraphicsFormat.R8_UInt, FormatUsage.StencilSampling) ? GraphicsFormat.R8_UInt : GraphicsFormat.None;

rt = new RenderTexture(width, height, (int)depthBufferBits, format, RenderTextureReadWrite.Linear)
{
hideFlags = HideFlags.HideAndDontSave,
Expand All @@ -534,6 +536,7 @@ public RTHandle Alloc(
autoGenerateMips = autoGenerateMips,
anisoLevel = anisoLevel,
mipMapBias = mipMapBias,
stencilFormat = stencilFormat,
antiAliasing = (int)msaaSamples,
bindTextureMS = bindTextureMS,
useDynamicScale = m_HardwareDynamicResRequested && useDynamicScale,
Expand Down Expand Up @@ -795,7 +798,7 @@ string name
if (isShadowMap || depthBufferBits != DepthBits.None)
{
RenderTextureFormat format = isShadowMap ? RenderTextureFormat.Shadowmap : RenderTextureFormat.Depth;
GraphicsFormat stencilFormat = isShadowMap ? GraphicsFormat.None : GraphicsFormat.R8_UInt;
GraphicsFormat stencilFormat = !isShadowMap && SystemInfo.IsFormatSupported(GraphicsFormat.R8_UInt, FormatUsage.StencilSampling) ? GraphicsFormat.R8_UInt : GraphicsFormat.None;
rt = new RenderTexture(width, height, (int)depthBufferBits, format, RenderTextureReadWrite.Linear)
{
hideFlags = HideFlags.HideAndDontSave,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,17 +440,25 @@ public void GraphicsPassWriteWaitOnAsyncPipe()
builder.SetRenderFunc((RenderGraphTestPassData data, RenderGraphContext context) => { });
}

// This pass should sync with the "Async_TestPass0"
using (var builder = m_RenderGraph.AddRenderPass<RenderGraphTestPassData>("TestPass1", out var passData))
{
builder.WriteTexture(texture0);
texture0 = builder.WriteTexture(texture0);
builder.SetRenderFunc((RenderGraphTestPassData data, RenderGraphContext context) => { });
}

// Read result and output to backbuffer to avoid culling passes.
using (var builder = m_RenderGraph.AddRenderPass<RenderGraphTestPassData>("TestPass2", out var passData))
{
builder.ReadTexture(texture0);
builder.WriteTexture(m_RenderGraph.ImportBackbuffer(0)); // Needed for the passes to not be culled
builder.SetRenderFunc((RenderGraphTestPassData data, RenderGraphContext context) => { });
}

m_RenderGraph.CompileRenderGraph();

var compiledPasses = m_RenderGraph.GetCompiledPassInfos();
Assert.AreEqual(2, compiledPasses.size);
Assert.AreEqual(3, compiledPasses.size);
Assert.AreEqual(0, compiledPasses[1].syncToPassIndex);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,43 +301,26 @@ The following is an example of a custom editor for the GrayScale effect:

```C#
using UnityEditor.Rendering;

using UnityEngine;

using UnityEngine.Rendering.HighDefinition;

using UnityEditor;

[VolumeComponentEditor(typeof(GrayScale))]

[CustomEditor(typeof(GrayScale))]
sealed class GrayScaleEditor : VolumeComponentEditor

{

SerializedDataParameter m_Intensity;

public override bool hasAdvancedMode => false;

public override void OnEnable()

{

base.OnEnable();

var o = new PropertyFetcher<GrayScale>(serializedObject);

m_Intensity = Unpack(o.Find(x => x.intensity));

}

public override void OnInspectorGUI()

{

PropertyField(m_Intensity);

}

}
```

Expand Down
Loading