From 3e1bda0266ed16f99c39c94a60097d6f4dbb58ef Mon Sep 17 00:00:00 2001 From: FrancescoC-Unity Date: Fri, 3 Sep 2021 18:11:48 +0200 Subject: [PATCH 1/5] New UI --- .../Lighting/ProbeVolume/ProbePlacement.cs | 6 +-- .../ProbeVolume/ProbeSubdivisionContext.cs | 2 +- .../ProbeVolume/ProbeVolumeUI.Drawer.cs | 54 +++++++++++++------ .../ProbeVolume/SerializedProbeVolume.cs | 9 ++-- .../ProbeVolume/ProbeReferenceVolume.cs | 11 ++-- .../Lighting/ProbeVolume/ProbeVolume.cs | 27 +++++++--- .../ProbeVolume/ProbeVolumeSceneData.cs | 3 +- 7 files changed, 78 insertions(+), 34 deletions(-) diff --git a/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbePlacement.cs b/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbePlacement.cs index a2e0dc1f8b6..45e82fea778 100644 --- a/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbePlacement.cs +++ b/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbePlacement.cs @@ -377,7 +377,7 @@ static void SubdivideSubCell(ProbeReferenceVolume.Volume cellVolume, ProbeSubdiv VoxelizeProbeVolumeData(cmd, cellAABB, probeVolumes, ctx); // Find the maximum subdivision level we can have in this cell (avoid extra work if not needed) - int startSubdivisionLevel = ctx.maxSubdivisionLevelInSubCell - GetMaxSubdivision(ctx, probeVolumes.Max(p => p.component.maxSubdivisionMultiplier)); + int startSubdivisionLevel = ctx.maxSubdivisionLevelInSubCell - GetMaxSubdivision(ctx, probeVolumes.Max(p => p.component.GetMaxSubdivMultiplier())); for (int subdivisionLevel = startSubdivisionLevel; subdivisionLevel <= ctx.maxSubdivisionLevelInSubCell; subdivisionLevel++) { // Add the bricks from the probe volume min subdivision level: @@ -596,8 +596,8 @@ static void VoxelizeProbeVolumeData(CommandBuffer cmd, Bounds cellAABB, // Prepare list of GPU probe volumes foreach (var kp in probeVolumes) { - int minSubdiv = GetMaxSubdivision(ctx, kp.component.minSubdivisionMultiplier); - int maxSubdiv = GetMaxSubdivision(ctx, kp.component.maxSubdivisionMultiplier); + int minSubdiv = GetMaxSubdivision(ctx, kp.component.GetMinSubdivMultiplier()); + int maxSubdiv = GetMaxSubdivision(ctx, kp.component.GetMaxSubdivMultiplier()); // Constrain the probe volume AABB inside the cell var pvAABB = kp.volume.CalculateAABB(); diff --git a/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeSubdivisionContext.cs b/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeSubdivisionContext.cs index a281f7dd9c8..cba47d6c04d 100644 --- a/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeSubdivisionContext.cs +++ b/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeSubdivisionContext.cs @@ -145,7 +145,7 @@ public void Initialize(ProbeReferenceVolumeProfile profile, Vector3 refVolOrigin if (!pv.isActiveAndEnabled) continue; - ProbeReferenceVolume.Volume volume = new ProbeReferenceVolume.Volume(Matrix4x4.TRS(pv.transform.position, pv.transform.rotation, pv.GetExtents()), pv.maxSubdivisionMultiplier, pv.minSubdivisionMultiplier); + ProbeReferenceVolume.Volume volume = new ProbeReferenceVolume.Volume(Matrix4x4.TRS(pv.transform.position, pv.transform.rotation, pv.GetExtents()), pv.GetMaxSubdivMultiplier(), pv.GetMinSubdivMultiplier()); probeVolumes.Add((pv, volume)); } diff --git a/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeUI.Drawer.cs b/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeUI.Drawer.cs index 3e9a4d915b2..3a789611569 100644 --- a/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeUI.Drawer.cs +++ b/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeUI.Drawer.cs @@ -138,23 +138,47 @@ static void Drawer_VolumeContent(SerializedProbeVolume serialized, Editor owner) EditorGUILayout.PropertyField(serialized.size, Styles.s_Size); var rect = EditorGUILayout.GetControlRect(true); - EditorGUI.BeginProperty(rect, Styles.s_MinMaxSubdivSlider, serialized.minSubdivisionMultiplier); - EditorGUI.BeginProperty(rect, Styles.s_MinMaxSubdivSlider, serialized.maxSubdivisionMultiplier); // Round min and max subdiv - float maxSubdiv = ProbeReferenceVolume.instance.GetMaxSubdivision(1) - 1; - float min = Mathf.Round(serialized.minSubdivisionMultiplier.floatValue * maxSubdiv) / maxSubdiv; - float max = Mathf.Round(serialized.maxSubdivisionMultiplier.floatValue * maxSubdiv) / maxSubdiv; - - EditorGUILayout.MinMaxSlider(Styles.s_MinMaxSubdivSlider, ref min, ref max, 0, 1); - serialized.minSubdivisionMultiplier.floatValue = Mathf.Max(0.00f, min); - serialized.maxSubdivisionMultiplier.floatValue = Mathf.Max(0.01f, max); - EditorGUI.EndProperty(); - EditorGUI.EndProperty(); - - int minSubdivInVolume = ProbeReferenceVolume.instance.GetMaxSubdivision(1 - serialized.minSubdivisionMultiplier.floatValue); - int maxSubdivInVolume = ProbeReferenceVolume.instance.GetMaxSubdivision(1 - serialized.maxSubdivisionMultiplier.floatValue); - EditorGUILayout.HelpBox($"The distance between probes will fluctuate between : {ProbeReferenceVolume.instance.GetDistanceBetweenProbes(maxSubdivInVolume)}m and {ProbeReferenceVolume.instance.GetDistanceBetweenProbes(minSubdivInVolume)}m", MessageType.Info); + int maxSubdiv = ProbeReferenceVolume.instance.GetMaxSubdivision() - 1; + if (maxSubdiv < 0) + { + // it's likely we don't have a profile loaded yet. + if (ProbeReferenceVolume.instance.sceneData != null) + { + ProbeVolume pv = (serialized.serializedObject.targetObject as ProbeVolume); + + var profile = ProbeReferenceVolume.instance.sceneData.GetProfileForScene(pv.gameObject.scene); + + if (profile != null) + { + ProbeReferenceVolume.instance.SetMinBrickAndMaxSubdiv(profile.minBrickSize, profile.maxSubdivision); + maxSubdiv = ProbeReferenceVolume.instance.GetMaxSubdivision() - 1; + } + else + { + maxSubdiv = 0; + } + } + } + + EditorGUILayout.LabelField("Subdivision Overrides", EditorStyles.boldLabel); + EditorGUI.indentLevel++; + int value = serialized.highestSubdivisionLevelOverride.intValue; + + // We were initialized, but we cannot know the highest subdiv statically, so we need to resort to this. + if (serialized.highestSubdivisionLevelOverride.intValue < 0) + serialized.highestSubdivisionLevelOverride.intValue = maxSubdiv; + + serialized.highestSubdivisionLevelOverride.intValue = EditorGUILayout.IntSlider("Highest Subdivision Level", serialized.highestSubdivisionLevelOverride.intValue, 0, maxSubdiv); + serialized.lowestSubdivisionLevelOverride.intValue = EditorGUILayout.IntSlider("Lowest Subdivision Level", serialized.lowestSubdivisionLevelOverride.intValue, 0, maxSubdiv); + serialized.lowestSubdivisionLevelOverride.intValue = Mathf.Min(serialized.lowestSubdivisionLevelOverride.intValue, serialized.highestSubdivisionLevelOverride.intValue); + int minSubdivInVolume = ProbeReferenceVolume.instance.GetMaxSubdivision(1.0f - ((float)serialized.highestSubdivisionLevelOverride.intValue / maxSubdiv)); + int maxSubdivInVolume = ProbeReferenceVolume.instance.GetMaxSubdivision(1 - ((float)serialized.lowestSubdivisionLevelOverride.intValue / maxSubdiv)); + EditorGUI.indentLevel--; + + EditorGUILayout.HelpBox($"The distance between probes will fluctuate between : {ProbeReferenceVolume.instance.GetDistanceBetweenProbes(minSubdivInVolume)}m and {ProbeReferenceVolume.instance.GetDistanceBetweenProbes(maxSubdivInVolume)}m", MessageType.Info); + if (EditorGUI.EndChangeCheck()) { Vector3 tmpClamp = serialized.size.vector3Value; diff --git a/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/SerializedProbeVolume.cs b/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/SerializedProbeVolume.cs index 10542a25482..e10e428751f 100644 --- a/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/SerializedProbeVolume.cs +++ b/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/SerializedProbeVolume.cs @@ -6,8 +6,8 @@ internal class SerializedProbeVolume internal SerializedProperty globalVolume; internal SerializedProperty size; - internal SerializedProperty maxSubdivisionMultiplier; - internal SerializedProperty minSubdivisionMultiplier; + internal SerializedProperty highestSubdivisionLevelOverride; + internal SerializedProperty lowestSubdivisionLevelOverride; internal SerializedProperty objectLayerMask; internal SerializedProperty geometryDistanceOffset; @@ -19,10 +19,11 @@ internal SerializedProbeVolume(SerializedObject obj) globalVolume = serializedObject.FindProperty("globalVolume"); size = serializedObject.FindProperty("size"); - maxSubdivisionMultiplier = serializedObject.FindProperty("maxSubdivisionMultiplier"); - minSubdivisionMultiplier = serializedObject.FindProperty("minSubdivisionMultiplier"); objectLayerMask = serializedObject.FindProperty("objectLayerMask"); geometryDistanceOffset = serializedObject.FindProperty("geometryDistanceOffset"); + highestSubdivisionLevelOverride = serializedObject.FindProperty("highestSubdivLevelOverride"); + lowestSubdivisionLevelOverride = serializedObject.FindProperty("lowestSubdivLevelOverride"); + } internal void Apply() diff --git a/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeReferenceVolume.cs b/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeReferenceVolume.cs index 438e8464429..655cb426f34 100644 --- a/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeReferenceVolume.cs +++ b/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeReferenceVolume.cs @@ -806,6 +806,13 @@ void PerformPendingIndexChangeAndInit() } } + internal void SetMinBrickAndMaxSubdiv(float minBrickSize, int maxSubdiv) + { + SetTRS(Vector3.zero, Quaternion.identity, minBrickSize); + SetMaxSubdivision(maxSubdiv); + + } + void LoadAsset(ProbeVolumeAsset asset) { if (asset.Version != (int)ProbeVolumeAsset.AssetVersion.Current) @@ -817,9 +824,7 @@ void LoadAsset(ProbeVolumeAsset asset) var path = asset.GetSerializedFullPath(); // Load info coming originally from profile - SetTRS(Vector3.zero, Quaternion.identity, asset.minBrickSize); - SetMaxSubdivision(asset.maxSubdivision); - + SetMinBrickAndMaxSubdiv(asset.minBrickSize, asset.maxSubdivision); for (int i = 0; i < asset.cells.Count; ++i) { diff --git a/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolume.cs b/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolume.cs index 74378765a81..9c265834e1d 100644 --- a/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolume.cs +++ b/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolume.cs @@ -21,15 +21,17 @@ public class ProbeVolume : MonoBehaviour { public bool globalVolume = false; public Vector3 size = new Vector3(10, 10, 10); - [HideInInspector] - public float maxSubdivisionMultiplier = 1; - [HideInInspector] - public float minSubdivisionMultiplier = 0; [HideInInspector, Range(0f, 2f)] public float geometryDistanceOffset = 0.2f; public LayerMask objectLayerMask = -1; + + [HideInInspector] + public int lowestSubdivLevelOverride = 0; + [HideInInspector] + public int highestSubdivLevelOverride = -1; + [SerializeField] internal bool mightNeedRebaking = false; [SerializeField] internal Matrix4x4 cachedTransform; @@ -112,8 +114,8 @@ public override int GetHashCode() unchecked { hash = hash * 23 + size.GetHashCode(); - hash = hash * 23 + maxSubdivisionMultiplier.GetHashCode(); - hash = hash * 23 + minSubdivisionMultiplier.GetHashCode(); + hash = hash * 23 + highestSubdivLevelOverride.GetHashCode(); + hash = hash * 23 + lowestSubdivLevelOverride.GetHashCode(); hash = hash * 23 + geometryDistanceOffset.GetHashCode(); hash = hash * 23 + objectLayerMask.GetHashCode(); } @@ -123,6 +125,18 @@ public override int GetHashCode() #endif + internal float GetMinSubdivMultiplier() + { + float maxSubdiv = ProbeReferenceVolume.instance.GetMaxSubdivision() - 1; + return Mathf.Max(0.0f, lowestSubdivLevelOverride / maxSubdiv); + } + + internal float GetMaxSubdivMultiplier() + { + float maxSubdiv = ProbeReferenceVolume.instance.GetMaxSubdivision() - 1; + return Mathf.Max(0.0f, highestSubdivLevelOverride / maxSubdiv); + } + // Momentarily moving the gizmo rendering for bricks and cells to Probe Volume itself, // only the first probe volume in the scene will render them. The reason is that we dont have any // other non-hidden component related to APV. @@ -185,6 +199,7 @@ void OnDrawGizmos() if (!ProbeReferenceVolume.instance.isInitialized || !IsResponsibleToDrawGizmo() || ProbeReferenceVolume.instance.sceneData == null) return; + var profile = ProbeReferenceVolume.instance.sceneData.GetProfileForScene(gameObject.scene); if (profile == null) return; diff --git a/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeSceneData.cs b/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeSceneData.cs index 05b483511d2..c4d47d41e19 100644 --- a/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeSceneData.cs +++ b/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeSceneData.cs @@ -230,8 +230,7 @@ internal void UpdateSceneBounds(Scene scene) { var profile = GetProfileForScene(scene); Debug.Assert(profile != null); - ProbeReferenceVolume.instance.SetTRS(Vector3.zero, Quaternion.identity, profile.minBrickSize); - ProbeReferenceVolume.instance.SetMaxSubdivision(profile.maxSubdivision); + ProbeReferenceVolume.instance.SetMinBrickAndMaxSubdiv(profile.minBrickSize, profile.maxSubdivision); } var volumes = UnityEngine.GameObject.FindObjectsOfType(); From b530206d2aeaad6acecabf0497f9e16c38afeb67 Mon Sep 17 00:00:00 2001 From: FrancescoC-Unity Date: Fri, 3 Sep 2021 18:14:42 +0200 Subject: [PATCH 2/5] Move comment --- .../Editor/Lighting/ProbeVolume/ProbeVolumeUI.Drawer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeUI.Drawer.cs b/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeUI.Drawer.cs index 3a789611569..0b04fd8e0e6 100644 --- a/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeUI.Drawer.cs +++ b/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeUI.Drawer.cs @@ -141,9 +141,9 @@ static void Drawer_VolumeContent(SerializedProbeVolume serialized, Editor owner) // Round min and max subdiv int maxSubdiv = ProbeReferenceVolume.instance.GetMaxSubdivision() - 1; + // it's likely we don't have a profile loaded yet. if (maxSubdiv < 0) { - // it's likely we don't have a profile loaded yet. if (ProbeReferenceVolume.instance.sceneData != null) { ProbeVolume pv = (serialized.serializedObject.targetObject as ProbeVolume); From c68e971bf71af7f91a2cd7a28df6a4725f47533f Mon Sep 17 00:00:00 2001 From: FrancescoC-Unity Date: Fri, 3 Sep 2021 18:15:52 +0200 Subject: [PATCH 3/5] Couple of annoying whitelines --- .../Runtime/Lighting/ProbeVolume/ProbeReferenceVolume.cs | 1 - .../Runtime/Lighting/ProbeVolume/ProbeVolume.cs | 1 - 2 files changed, 2 deletions(-) diff --git a/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeReferenceVolume.cs b/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeReferenceVolume.cs index 655cb426f34..b6c8c6bb5f6 100644 --- a/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeReferenceVolume.cs +++ b/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeReferenceVolume.cs @@ -810,7 +810,6 @@ internal void SetMinBrickAndMaxSubdiv(float minBrickSize, int maxSubdiv) { SetTRS(Vector3.zero, Quaternion.identity, minBrickSize); SetMaxSubdivision(maxSubdiv); - } void LoadAsset(ProbeVolumeAsset asset) diff --git a/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolume.cs b/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolume.cs index 9c265834e1d..1ca7aa8dfa9 100644 --- a/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolume.cs +++ b/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolume.cs @@ -199,7 +199,6 @@ void OnDrawGizmos() if (!ProbeReferenceVolume.instance.isInitialized || !IsResponsibleToDrawGizmo() || ProbeReferenceVolume.instance.sceneData == null) return; - var profile = ProbeReferenceVolume.instance.sceneData.GetProfileForScene(gameObject.scene); if (profile == null) return; From 061a8aaf840c2be0058dc19ec9d0d3d8b77c067d Mon Sep 17 00:00:00 2001 From: FrancescoC-Unity Date: Tue, 7 Sep 2021 16:34:21 +0200 Subject: [PATCH 4/5] Review fix --- .../Editor/Lighting/ProbeVolume/ProbeVolumeUI.Drawer.cs | 9 +++++++-- .../Editor/Lighting/ProbeVolume/ProbeVolumeUI.Skin.cs | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeUI.Drawer.cs b/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeUI.Drawer.cs index 0b04fd8e0e6..3ac516f93ce 100644 --- a/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeUI.Drawer.cs +++ b/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeUI.Drawer.cs @@ -138,6 +138,8 @@ static void Drawer_VolumeContent(SerializedProbeVolume serialized, Editor owner) EditorGUILayout.PropertyField(serialized.size, Styles.s_Size); var rect = EditorGUILayout.GetControlRect(true); + EditorGUI.BeginProperty(rect, Styles.s_HighestSubdivLevel, serialized.highestSubdivisionLevelOverride); + EditorGUI.BeginProperty(rect, Styles.s_LowestSubdivLevel, serialized.lowestSubdivisionLevelOverride); // Round min and max subdiv int maxSubdiv = ProbeReferenceVolume.instance.GetMaxSubdivision() - 1; @@ -170,9 +172,12 @@ static void Drawer_VolumeContent(SerializedProbeVolume serialized, Editor owner) if (serialized.highestSubdivisionLevelOverride.intValue < 0) serialized.highestSubdivisionLevelOverride.intValue = maxSubdiv; - serialized.highestSubdivisionLevelOverride.intValue = EditorGUILayout.IntSlider("Highest Subdivision Level", serialized.highestSubdivisionLevelOverride.intValue, 0, maxSubdiv); - serialized.lowestSubdivisionLevelOverride.intValue = EditorGUILayout.IntSlider("Lowest Subdivision Level", serialized.lowestSubdivisionLevelOverride.intValue, 0, maxSubdiv); + serialized.highestSubdivisionLevelOverride.intValue = EditorGUILayout.IntSlider(Styles.s_HighestSubdivLevel, serialized.highestSubdivisionLevelOverride.intValue, 0, maxSubdiv); + serialized.lowestSubdivisionLevelOverride.intValue = EditorGUILayout.IntSlider(Styles.s_LowestSubdivLevel, serialized.lowestSubdivisionLevelOverride.intValue, 0, maxSubdiv); serialized.lowestSubdivisionLevelOverride.intValue = Mathf.Min(serialized.lowestSubdivisionLevelOverride.intValue, serialized.highestSubdivisionLevelOverride.intValue); + EditorGUI.EndProperty(); + EditorGUI.EndProperty(); + int minSubdivInVolume = ProbeReferenceVolume.instance.GetMaxSubdivision(1.0f - ((float)serialized.highestSubdivisionLevelOverride.intValue / maxSubdiv)); int maxSubdivInVolume = ProbeReferenceVolume.instance.GetMaxSubdivision(1 - ((float)serialized.lowestSubdivisionLevelOverride.intValue / maxSubdiv)); EditorGUI.indentLevel--; diff --git a/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeUI.Skin.cs b/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeUI.Skin.cs index d9cb2a1a36c..959f003e597 100644 --- a/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeUI.Skin.cs +++ b/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeUI.Skin.cs @@ -8,7 +8,8 @@ internal static class Styles { internal static readonly GUIContent s_Size = new GUIContent("Size", "Modify the size of this Probe Volume. This is independent of the Transform's Scale."); internal static readonly GUIContent s_GlobalVolume = new GUIContent("Global", "If the volume is marked as global, it will be fit to the scene content every time the scene is saved or the baking starts."); - internal static readonly GUIContent s_MinMaxSubdivSlider = new GUIContent("Subdivision Controller", "Control how much the probe baking system will subdivide in this volume.\nBoth min and max values are used to compute the allowed subdivision levels inside this volume. e.g. a Min subdivision of 2 will ensure that there is at least 2 levels of subdivision everywhere in the volume."); + internal static readonly GUIContent s_HighestSubdivLevel = new GUIContent("Highest Subdivision Level", "Overrides the highest subdivision level used by the system. This determines how finely a probe volume is subdivided, lower values means larger minimum distance between probes."); + internal static readonly GUIContent s_LowestSubdivLevel = new GUIContent("Lowest Subdivision Level", "Overrides the lowest subdivision level used by the system. This determines how coarsely a probe volume is allowed to be subdivided, higher values means smaller maximum distance between probes."); internal static readonly GUIContent s_ObjectLayerMask = new GUIContent("Object Layer Mask", "Control which layers will be used to select the meshes for the probe placement algorithm."); internal static readonly GUIContent s_GeometryDistanceOffset = new GUIContent("Geometry Distance Offset", "Affects the minimum distance at which the subdivision system will place probes near the geometry."); internal static readonly string s_ProbeVolumeChangedMessage = "The probe volume has changed since last baking or the data was never baked.\nPlease bake lighting in the lighting panel to update the lighting data."; From 378eabf0509a49ac0231f1c8e13e8b538c2aa205 Mon Sep 17 00:00:00 2001 From: FrancescoC-Unity Date: Tue, 7 Sep 2021 19:43:03 +0200 Subject: [PATCH 5/5] Fix subdiv info boxes. --- .../Editor/Lighting/ProbeVolume/ProbeVolumeUI.Drawer.cs | 6 +++--- .../Lighting/ProbeVolume/ProbeReferenceVolumeProfile.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeUI.Drawer.cs b/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeUI.Drawer.cs index 3ac516f93ce..70c72739a62 100644 --- a/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeUI.Drawer.cs +++ b/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeUI.Drawer.cs @@ -178,11 +178,11 @@ static void Drawer_VolumeContent(SerializedProbeVolume serialized, Editor owner) EditorGUI.EndProperty(); EditorGUI.EndProperty(); - int minSubdivInVolume = ProbeReferenceVolume.instance.GetMaxSubdivision(1.0f - ((float)serialized.highestSubdivisionLevelOverride.intValue / maxSubdiv)); - int maxSubdivInVolume = ProbeReferenceVolume.instance.GetMaxSubdivision(1 - ((float)serialized.lowestSubdivisionLevelOverride.intValue / maxSubdiv)); + int minSubdivInVolume = serialized.lowestSubdivisionLevelOverride.intValue; + int maxSubdivInVolume = serialized.highestSubdivisionLevelOverride.intValue; EditorGUI.indentLevel--; - EditorGUILayout.HelpBox($"The distance between probes will fluctuate between : {ProbeReferenceVolume.instance.GetDistanceBetweenProbes(minSubdivInVolume)}m and {ProbeReferenceVolume.instance.GetDistanceBetweenProbes(maxSubdivInVolume)}m", MessageType.Info); + EditorGUILayout.HelpBox($"The distance between probes will fluctuate between : {ProbeReferenceVolume.instance.GetDistanceBetweenProbes(maxSubdiv - maxSubdivInVolume)}m and {ProbeReferenceVolume.instance.GetDistanceBetweenProbes(maxSubdiv - minSubdivInVolume)}m", MessageType.Info); if (EditorGUI.EndChangeCheck()) { diff --git a/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeReferenceVolumeProfile.cs b/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeReferenceVolumeProfile.cs index 6ec8e6a0ef7..a27bf0fd87f 100644 --- a/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeReferenceVolumeProfile.cs +++ b/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeReferenceVolumeProfile.cs @@ -108,7 +108,7 @@ public override void OnInspectorGUI() EditorGUILayout.HelpBox(Styles.simplificationLevelsHighWarning, MessageType.Warning); } EditorGUILayout.PropertyField(m_MinDistanceBetweenProbes, Styles.minDistanceBetweenProbes); - EditorGUILayout.HelpBox($"The distance between probes will fluctuate between : {profile.minDistanceBetweenProbes}m and {profile.cellSizeInMeters}m", MessageType.Info); + EditorGUILayout.HelpBox($"The distance between probes will fluctuate between : {profile.minDistanceBetweenProbes}m and {profile.cellSizeInMeters / 3.0f}m", MessageType.Info); if (EditorGUI.EndChangeCheck()) serializedObject.ApplyModifiedProperties();