Skip to content

Commit 96c5821

Browse files
authored
Merge pull request #8015 from Unity-Technologies/internal/master
Internal/master
2 parents 96ba978 + b883dcf commit 96c5821

File tree

375 files changed

+20328
-2281
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

375 files changed

+20328
-2281
lines changed

Packages/com.unity.render-pipelines.core/Editor/Analytics/AnalyticsUtils.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@ internal static void SendData(IAnalytic analytic)
2222
EditorAnalytics.SendAnalytic(analytic);
2323
}
2424

25-
internal static IEnumerable<FieldInfo> GetSerializableFields(this Type type, bool removeObsolete = false)
25+
/// <summary>
26+
/// Gets a list of the serializable fields of the given type
27+
/// </summary>
28+
/// <param name="type">The type to get fields that are serialized.</param>
29+
/// <param name="removeObsolete">If obsolete fields are taken into account</param>
30+
/// <returns>The collection of <see cref="FieldInfo"/> that are serialized for this type</returns>
31+
public static IEnumerable<FieldInfo> GetSerializableFields(this Type type, bool removeObsolete = false)
2632
{
2733
var members = type.GetMembers(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic);
2834

Packages/com.unity.render-pipelines.core/Editor/HeaderFoldout.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class HeaderFoldout : Foldout
1111
const string k_Class = "header-foldout";
1212

1313
private string m_DocumentationURL;
14-
private Func<GenericDropdownMenu> m_ContextMenuGenerator;
14+
private Func<GenericMenu> m_ContextMenuGenerator;
1515
private VisualElement m_HelpButton;
1616
private VisualElement m_ContextMenuButton;
1717

@@ -30,7 +30,7 @@ public string documentationURL
3030
}
3131

3232
/// <summary>Context menu to show on clic of the context button. If null, button don't show.</summary>
33-
public Func<GenericDropdownMenu> contextMenuGenerator
33+
public Func<GenericMenu> contextMenuGenerator //Use ImGUI for now
3434
{
3535
get => m_ContextMenuGenerator;
3636
set
@@ -78,7 +78,7 @@ void DelayedInit(AttachToPanelEvent evt)
7878
void ShowMenu()
7979
{
8080
var menu = m_ContextMenuGenerator.Invoke();
81-
menu.DropDown(new Rect(m_ContextMenuButton.worldBound.position + m_ContextMenuButton.worldBound.size.y * Vector2.up, Vector2.zero), this);
81+
menu.DropDown(new Rect(m_ContextMenuButton.worldBound.position + m_ContextMenuButton.worldBound.size.y * Vector2.up, Vector2.zero));
8282
}
8383
}
8484

Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.LightTransport.cs

Lines changed: 133 additions & 107 deletions
Large diffs are not rendered by default.

Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,12 +1185,6 @@ static void ApplyPostBakeOperations(NativeArray<SphericalHarmonicsL2> sh, Native
11851185
}
11861186
fetchScope.Dispose();
11871187

1188-
// Don't use Disk streaming to avoid having to wait for it when doing dilation.
1189-
ProbeReferenceVolume.instance.ForceNoDiskStreaming(true);
1190-
// Force maximum sh bands to perform baking, we need to store what sh bands was selected from the settings as we need to restore it after.
1191-
var prevSHBands = ProbeReferenceVolume.instance.shBands;
1192-
ProbeReferenceVolume.instance.ForceSHBand(ProbeVolumeSHBands.SphericalHarmonicsL2);
1193-
11941188
PrepareCellsForWriting(isBakingSceneSubset);
11951189

11961190
using var writeScope = new BakingCompleteProfiling(BakingCompleteProfiling.Stages.WriteBakedData);
@@ -1211,6 +1205,16 @@ static void ApplyPostBakeOperations(NativeArray<SphericalHarmonicsL2> sh, Native
12111205
// Reset internal structures depending on current bake.
12121206
probeRefVolume.EnsureCurrentBakingSet(m_BakingSet);
12131207

1208+
// This subsequent block needs to happen AFTER we call WriteBakingCells.
1209+
// Otherwise in cases where we change the spacing between probes, we end up loading cells with a certain layout in ForceSHBand
1210+
// And then we unload cells using the wrong layout in PerformDilation (after WriteBakingCells updates the baking set object) which leads to a broken internal state.
1211+
1212+
// Don't use Disk streaming to avoid having to wait for it when doing dilation.
1213+
ProbeReferenceVolume.instance.ForceNoDiskStreaming(true);
1214+
// Force maximum sh bands to perform baking, we need to store what sh bands was selected from the settings as we need to restore it after.
1215+
var prevSHBands = ProbeReferenceVolume.instance.shBands;
1216+
ProbeReferenceVolume.instance.ForceSHBand(ProbeVolumeSHBands.SphericalHarmonicsL2);
1217+
12141218
// TODO Discuss: Not nice to do this here, shouldn't reloading the asset also resolve cell data?
12151219
// Would still need to reload common shared data like bricks as they are separately handled by the baking set itself.
12161220
// Load common shared data (bricks + debug)

Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeBakingSetEditor.cs

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ internal class ProbeVolumeBakingSetEditor : Editor
4242
SerializedProperty m_SkyOcclusionBakingSamples;
4343
SerializedProperty m_SkyOcclusionBakingBounces;
4444
SerializedProperty m_SkyOcclusionAverageAlbedo;
45-
SerializedProperty m_SkyOcclusionBackFaceCulling;
4645
SerializedProperty m_SkyOcclusionShadingDirection;
4746

4847
ProbeVolumeBakingSet bakingSet => target as ProbeVolumeBakingSet;
@@ -51,7 +50,7 @@ static class Styles
5150
{
5251
public static readonly GUIContent scenariosTitle = new GUIContent("Lighting Scenarios");
5352
public static readonly GUIContent placementTitle = new GUIContent("Probe Placement");
54-
public static readonly GUIContent settingsTitle = new GUIContent("Probe Invalidity Settings");
53+
public static readonly GUIContent invaliditySettingsTitle = new GUIContent("Probe Invalidity Settings");
5554
public static readonly GUIContent skyOcclusionSettingsTitle = new GUIContent("Sky Occlusion Settings");
5655

5756
public static readonly GUIContent keepSamePlacement = new GUIContent("Probe Positions", "If set to Don't Recalculate, probe positions are not recalculated when baking. Allows baking multiple Scenarios that include small differences in Scene geometry.");
@@ -73,13 +72,13 @@ static class Styles
7372
public static readonly GUIContent renderersLayerMask = new GUIContent("Layer Mask", "Specify Layers to use when generating probe positions.");
7473
public static readonly GUIContent rendererFilterSettings = new GUIContent("Renderer Filter Settings");
7574

76-
public static readonly GUIContent skyOcclusion = new GUIContent("Sky Occlusion", "When occlusion is baked, probe volumes can react to sky lighting changes at runtime. This will increase the memory footprint for probe volumes.");
77-
public static readonly GUIContent skyOcclusionBakingSamples = new GUIContent("Samples", "Control the number of samples used for Sky Occlusion baking. Increasing this value may improve the quality but increases the time required for baking to complete.");
78-
public static readonly GUIContent skyOcclusionBakingBounces = new GUIContent("Bounces", "Control the number of bounces used for Sky Occlusion baking.");
79-
public static readonly GUIContent skyOcclusionAverageAlbedo = new GUIContent("Albedo Override", "Bounced lighting for Sky Occlusion does not take material properties such as color and roughness into account. Thus a single color is applied to all materials. The colors range from 0 (black) to 1 (white).");
80-
public static readonly GUIContent skyOcclusionBackFaceCulling = new GUIContent("Backface Culling", "Enable backface culling for Sky Occlusion baking.");
81-
public static readonly GUIContent skyOcclusionShadingDirection = new GUIContent("Sky Direction", "In addition to Sky Occlusion, bake the most suitable direction to sample the ambient probe at runtime. Without it, surface normals would be used as a fallback and might lead to inaccuracies when updating the probes with the sky color.");
82-
public static readonly GUIContent cpuLightmapperNotSupportedWarning = new GUIContent("The Progressive CPU Lightmapper is not supported with Sky Occlusion. Use Progressive GPU lightmapper instead in Lightmapping settings.");
75+
public static readonly GUIContent skyOcclusion = new GUIContent("Sky Occlusion", "Choose whether to generate Sky Occlusion data for probes within this Probe Volume. When enabled, Scenes can be dynamically re-lit when the sky is changed. This feature increases memory usage.");
76+
public static readonly GUIContent skyOcclusionBakingSamples = new GUIContent("Samples", "The number of samples used to calculate the influence of the sky when baking probes. Increasing this value improves the accuracy of Sky Occlusion data, but increases the time required to generate baked lighting.");
77+
public static readonly GUIContent skyOcclusionBakingBounces = new GUIContent("Bounces", "The maximum number of bounces allowed for each Sky Occlusion sample. Increasing this value particularly improves the accuracy of occlusion data in areas of the Scene with complicated routes to the sky.");
78+
public static readonly GUIContent skyOcclusionAverageAlbedo = new GUIContent("Albedo Override", "Sky Occlusion does not consider the albedo of materials in the Scene when calculating bounced light from the sky. Albedo Override determines the value used instead. Lower values darken and higher values will brighten the Scene.");
79+
public static readonly GUIContent skyOcclusionShadingDirection = new GUIContent("Sky Direction", "For each probe, additionally bake the most suitable direction to use for sampling the Scene’s Ambient Probe. When disabled, surface normals are used instead. Sky Direction improves visual quality at the expense of memory.");
80+
public static readonly GUIContent cpuLightmapperNotSupportedWarning = new GUIContent("Sky Occlusion is not supported by the current lightmapper. Ensure that Progressive GPU is selected in Lightmapper Settings.");
81+
8382

8483

8584
// Probe Settings section
@@ -102,7 +101,6 @@ void OnEnable()
102101
m_SkyOcclusionBakingSamples = serializedObject.FindProperty(nameof(ProbeVolumeBakingSet.skyOcclusionBakingSamples));
103102
m_SkyOcclusionBakingBounces = serializedObject.FindProperty(nameof(ProbeVolumeBakingSet.skyOcclusionBakingBounces));
104103
m_SkyOcclusionAverageAlbedo = serializedObject.FindProperty(nameof(ProbeVolumeBakingSet.skyOcclusionAverageAlbedo));
105-
m_SkyOcclusionBackFaceCulling = serializedObject.FindProperty(nameof(ProbeVolumeBakingSet.skyOcclusionBackFaceCulling));
106104
m_SkyOcclusionShadingDirection = serializedObject.FindProperty(nameof(ProbeVolumeBakingSet.skyOcclusionShadingDirection));
107105

108106
if (ProbeReferenceVolume.instance.supportScenarioBlending)
@@ -226,9 +224,9 @@ void ProbePlacementGUI()
226224
EditorGUILayout.Space();
227225
}
228226

229-
void ProbeSettingsGUI()
227+
void ProbeInvaliditySettingsGUI()
230228
{
231-
if (!ProbeVolumeLightingTab.Foldout(Styles.settingsTitle, ProbeVolumeLightingTab.Expandable.InvaliditySettings, true, ResetProbeSettings))
229+
if (!ProbeVolumeLightingTab.Foldout(Styles.invaliditySettingsTitle, ProbeVolumeLightingTab.Expandable.InvaliditySettings, true, ResetProbeSettings))
232230
return;
233231

234232
using (new EditorGUI.IndentLevelScope())
@@ -237,7 +235,7 @@ void ProbeSettingsGUI()
237235
EditorGUILayout.Space();
238236
}
239237

240-
void SkyOcclusionSettings()
238+
void SkyOcclusionSettingsGUI()
241239
{
242240
if (!SupportedRenderingFeatures.active.skyOcclusion)
243241
return;
@@ -247,11 +245,12 @@ void SkyOcclusionSettings()
247245
EditorGUI.indentLevel++;
248246

249247
var lightmapper = ProbeVolumeLightingTab.GetLightingSettings().lightmapper;
250-
if (lightmapper == LightingSettings.Lightmapper.ProgressiveCPU)
248+
bool cpuLightmapperSelected = lightmapper == LightingSettings.Lightmapper.ProgressiveCPU;
249+
if (cpuLightmapperSelected)
251250
{
252251
EditorGUILayout.HelpBox(Styles.cpuLightmapperNotSupportedWarning.text, MessageType.Warning);
253252
}
254-
else
253+
using (new EditorGUI.DisabledScope(cpuLightmapperSelected))
255254
{
256255
EditorGUILayout.PropertyField(m_SkyOcclusion, Styles.skyOcclusion);
257256

@@ -262,7 +261,6 @@ void SkyOcclusionSettings()
262261
EditorGUILayout.PropertyField(m_SkyOcclusionBakingBounces, Styles.skyOcclusionBakingBounces);
263262
EditorGUILayout.PropertyField(m_SkyOcclusionAverageAlbedo, Styles.skyOcclusionAverageAlbedo);
264263
EditorGUILayout.PropertyField(m_SkyOcclusionShadingDirection, Styles.skyOcclusionShadingDirection);
265-
EditorGUILayout.PropertyField(m_SkyOcclusionBackFaceCulling, Styles.skyOcclusionBackFaceCulling);
266264
EditorGUI.indentLevel--;
267265
}
268266
}
@@ -277,8 +275,8 @@ public override void OnInspectorGUI()
277275

278276
ProbePlacementGUI();
279277
LightingScenariosGUI();
280-
ProbeSettingsGUI();
281-
SkyOcclusionSettings();
278+
SkyOcclusionSettingsGUI();
279+
ProbeInvaliditySettingsGUI();
282280

283281
serializedObject.ApplyModifiedProperties();
284282
}

Packages/com.unity.render-pipelines.core/Editor/Settings/PropertyDrawers/DefaultVolumeProfileSettingsPropertyDrawer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public abstract class DefaultVolumeProfileSettingsContextMenu<TSetting, TRenderP
103103
/// </summary>
104104
protected abstract string defaultVolumeProfilePath { get; }
105105

106-
void IRenderPipelineGraphicsSettingsContextMenu<TSetting>.PopulateContextMenu(TSetting setting, PropertyDrawer drawer, ref GenericDropdownMenu menu)
106+
void IRenderPipelineGraphicsSettingsContextMenu<TSetting>.PopulateContextMenu(TSetting setting, PropertyDrawer drawer, ref GenericMenu menu)
107107
{
108108
menu.AddSeparator("");
109109

Packages/com.unity.render-pipelines.core/Editor/Volume/VolumeProfileUtils.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ public static void EnsureAllOverridesForDefaultProfile(VolumeProfile profile, Vo
259259
/// <param name="onComponentEditorsExpandedCollapsed">Callback when all editors are collapsed or expanded</param>
260260
/// <param name="canCreateNewProfile">Whether it is allowed to create a new profile</param>
261261
public static void AddVolumeProfileContextMenuItems(
262-
ref GenericDropdownMenu menu,
262+
ref GenericMenu menu,
263263
VolumeProfile volumeProfile,
264264
List<VolumeComponentEditor> componentEditors,
265265
bool overrideStateOnReset,
@@ -270,22 +270,22 @@ public static void AddVolumeProfileContextMenuItems(
270270
{
271271
if (canCreateNewProfile)
272272
{
273-
menu.AddItem(Styles.newVolumeProfile.text, false, () =>
273+
menu.AddItem(Styles.newVolumeProfile, false, () =>
274274
{
275275
VolumeProfileFactory.CreateVolumeProfileWithCallback(defaultVolumeProfilePath,
276276
onNewVolumeProfileCreated);
277277
});
278278
}
279279
else
280280
{
281-
menu.AddDisabledItem(Styles.newVolumeProfile.text, false);
281+
menu.AddDisabledItem(Styles.newVolumeProfile, false);
282282
}
283283

284284
if (volumeProfile != null)
285285
{
286286
if (canCreateNewProfile)
287287
{
288-
menu.AddItem(Styles.clone.text, false, () =>
288+
menu.AddItem(Styles.clone, false, () =>
289289
{
290290
var pathName = AssetDatabase.GenerateUniqueAssetPath(AssetDatabase.GetAssetPath(volumeProfile));
291291
var clone = VolumeProfileFactory.CreateVolumeProfileAtPath(pathName, volumeProfile);
@@ -294,17 +294,17 @@ public static void AddVolumeProfileContextMenuItems(
294294
}
295295
else
296296
{
297-
menu.AddDisabledItem(Styles.clone.text, false);
297+
menu.AddDisabledItem(Styles.clone, false);
298298
}
299299

300300
menu.AddSeparator(string.Empty);
301301

302-
menu.AddItem(Styles.collapseAll.text, false, () =>
302+
menu.AddItem(Styles.collapseAll, false, () =>
303303
{
304304
SetComponentEditorsExpanded(componentEditors, false);
305305
onComponentEditorsExpandedCollapsed?.Invoke();
306306
});
307-
menu.AddItem(Styles.expandAll.text, false, () =>
307+
menu.AddItem(Styles.expandAll, false, () =>
308308
{
309309
SetComponentEditorsExpanded(componentEditors, true);
310310
onComponentEditorsExpandedCollapsed?.Invoke();
@@ -313,28 +313,28 @@ public static void AddVolumeProfileContextMenuItems(
313313

314314
menu.AddSeparator(string.Empty);
315315

316-
menu.AddItem(Styles.showAllAdditionalProperties.text, false,
316+
menu.AddItem(Styles.showAllAdditionalProperties, false,
317317
CoreRenderPipelinePreferences.Open);
318318

319319
menu.AddSeparator(string.Empty);
320320

321-
menu.AddItem(Styles.openInRenderingDebugger.text, false, DebugDisplaySettingsVolume.OpenInRenderingDebugger);
321+
menu.AddItem(Styles.openInRenderingDebugger, false, DebugDisplaySettingsVolume.OpenInRenderingDebugger);
322322

323323
if (volumeProfile != null)
324324
{
325325
menu.AddSeparator(string.Empty);
326326

327-
menu.AddItem(Styles.copyAllSettings.text, false,
327+
menu.AddItem(Styles.copyAllSettings, false,
328328
() => VolumeComponentCopyPaste.CopySettings(volumeProfile.components));
329329

330330
if (VolumeComponentCopyPaste.CanPaste(volumeProfile.components))
331-
menu.AddItem(Styles.pasteSettings.text, false, () =>
331+
menu.AddItem(Styles.pasteSettings, false, () =>
332332
{
333333
VolumeComponentCopyPaste.PasteSettings(volumeProfile.components);
334334
VolumeManager.instance.OnVolumeProfileChanged(volumeProfile);
335335
});
336336
else
337-
menu.AddDisabledItem(Styles.pasteSettings.text, false);
337+
menu.AddDisabledItem(Styles.pasteSettings, false);
338338
}
339339
}
340340

Packages/com.unity.render-pipelines.core/Runtime/Camera/CameraHistory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ protected RTHandle AllocHistoryFrameRT(int id, int count,
155155
// Simplified for typical history textures:
156156
// Sampling is usually bilinear & clamp. Point sample can be a texture.Load() or done with inline samplers.
157157
// No shadows, no mipmaps, no aniso.
158-
m_owner.AllocBuffer(id, count, ref desc, FilterMode.Bilinear, TextureWrapMode.Clamp, false, 1, 0, name);
158+
m_owner.AllocBuffer(id, count, ref desc, FilterMode.Bilinear, TextureWrapMode.Clamp, false, 0, 0, name);
159159
return GetCurrentFrameRT(0);
160160
}
161161

0 commit comments

Comments
 (0)