Skip to content

Commit 1f83260

Browse files
committed
Downgrade to 2022.3
1 parent a44f692 commit 1f83260

33 files changed

+3053
-763
lines changed

Editor/GaussianSplatAssetCreator.cs

Lines changed: 379 additions & 81 deletions
Large diffs are not rendered by default.

Editor/GaussianSplatAssetEditor.cs

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ static void SingleAssetGUI(GaussianSplatAsset gs)
4646
EditorGUILayout.IntField("Version", gs.formatVersion);
4747
GUI.backgroundColor = prevBackColor;
4848

49-
long sizePos = gs.posData != null ? gs.posData.dataSize : 0;
50-
long sizeOther = gs.otherData != null ? gs.otherData.dataSize : 0;
51-
long sizeCol = gs.colorData != null ? gs.colorData.dataSize : 0;
52-
long sizeSH = GaussianSplatAsset.CalcSHDataSize(gs.splatCount, gs.shFormat);
53-
long sizeChunk = gs.chunkData != null ? gs.chunkData.dataSize : 0;
49+
long sizePos = gs.posDataSize;
50+
long sizeOther = gs.otherDataSize;
51+
long sizeCol = gs.colorDataSize;
52+
long sizeSH = gs.shDataSize;
53+
long sizeChunk = gs.chunkDataSize;
5454

5555
EditorGUILayout.TextField("Memory", EditorUtility.FormatBytes(sizePos + sizeOther + sizeSH + sizeCol + sizeChunk));
5656
EditorGUI.indentLevel++;
@@ -65,6 +65,19 @@ static void SingleAssetGUI(GaussianSplatAsset gs)
6565
EditorGUILayout.Vector3Field("Bounds Min", gs.boundsMin);
6666
EditorGUILayout.Vector3Field("Bounds Max", gs.boundsMax);
6767

68+
EditorGUILayout.Space();
69+
GUILayout.Label("Layers", EditorStyles.boldLabel);
70+
foreach (var kv in gs.layerInfo)
71+
{
72+
EditorGUILayout.BeginHorizontal();
73+
GUILayout.Label("Layer");
74+
EditorGUILayout.FloatField(kv.Key);
75+
GUILayout.Label("Splat Count");
76+
EditorGUILayout.FloatField(kv.Value);
77+
EditorGUILayout.EndHorizontal();
78+
}
79+
80+
EditorGUILayout.Space();
6881
EditorGUILayout.TextField("Data Hash", gs.dataHash.ToString());
6982
}
7083
}

Editor/GaussianSplatRendererEditor.cs

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System;
44
using System.Collections.Generic;
55
using System.IO;
6+
using System.Linq;
67
using System.Text;
78
using GaussianSplatting.Runtime;
89
using Unity.Collections.LowLevel.Unsafe;
@@ -21,11 +22,11 @@ public class GaussianSplatRendererEditor : UnityEditor.Editor
2122
const string kPrefExportBake = "nesnausk.GaussianSplatting.ExportBakeTransform";
2223

2324
SerializedProperty m_PropAsset;
24-
SerializedProperty m_PropRenderOrder;
2525
SerializedProperty m_PropSplatScale;
2626
SerializedProperty m_PropOpacityScale;
2727
SerializedProperty m_PropSHOrder;
2828
SerializedProperty m_PropSHOnly;
29+
SerializedProperty m_CenterEyeOnly;
2930
SerializedProperty m_PropSortNthFrame;
3031
SerializedProperty m_PropRenderMode;
3132
SerializedProperty m_PropPointDisplaySize;
@@ -34,7 +35,10 @@ public class GaussianSplatRendererEditor : UnityEditor.Editor
3435
SerializedProperty m_PropShaderComposite;
3536
SerializedProperty m_PropShaderDebugPoints;
3637
SerializedProperty m_PropShaderDebugBoxes;
37-
SerializedProperty m_PropCSSplatUtilities;
38+
SerializedProperty m_PropCSSplatUtilities_deviceRadixSort;
39+
SerializedProperty m_PropCSSplatUtilities_fidelityFxSort;
40+
SerializedProperty m_gpuSortType;
41+
SerializedProperty m_PropOptimizeForQuest;
3842

3943
bool m_ResourcesExpanded = false;
4044
int m_CameraIndex = 0;
@@ -61,21 +65,23 @@ public void OnEnable()
6165
m_ExportBakeTransform = EditorPrefs.GetBool(kPrefExportBake, false);
6266

6367
m_PropAsset = serializedObject.FindProperty("m_Asset");
64-
m_PropRenderOrder = serializedObject.FindProperty("m_RenderOrder");
6568
m_PropSplatScale = serializedObject.FindProperty("m_SplatScale");
6669
m_PropOpacityScale = serializedObject.FindProperty("m_OpacityScale");
6770
m_PropSHOrder = serializedObject.FindProperty("m_SHOrder");
6871
m_PropSHOnly = serializedObject.FindProperty("m_SHOnly");
6972
m_PropSortNthFrame = serializedObject.FindProperty("m_SortNthFrame");
73+
m_CenterEyeOnly = serializedObject.FindProperty("m_CenterEyeOnly");
7074
m_PropRenderMode = serializedObject.FindProperty("m_RenderMode");
7175
m_PropPointDisplaySize = serializedObject.FindProperty("m_PointDisplaySize");
7276
m_PropCutouts = serializedObject.FindProperty("m_Cutouts");
7377
m_PropShaderSplats = serializedObject.FindProperty("m_ShaderSplats");
7478
m_PropShaderComposite = serializedObject.FindProperty("m_ShaderComposite");
7579
m_PropShaderDebugPoints = serializedObject.FindProperty("m_ShaderDebugPoints");
7680
m_PropShaderDebugBoxes = serializedObject.FindProperty("m_ShaderDebugBoxes");
77-
m_PropCSSplatUtilities = serializedObject.FindProperty("m_CSSplatUtilities");
78-
81+
m_PropCSSplatUtilities_deviceRadixSort = serializedObject.FindProperty("m_CSSplatUtilities_deviceRadixSort");
82+
m_PropCSSplatUtilities_fidelityFxSort = serializedObject.FindProperty("m_CSSplatUtilities_fidelityFX");
83+
m_gpuSortType = serializedObject.FindProperty("m_gpuSortType");
84+
m_PropOptimizeForQuest = serializedObject.FindProperty("m_OptimizeForQuest");
7985
s_AllEditors.Add(this);
8086
}
8187

@@ -105,12 +111,45 @@ public override void OnInspectorGUI()
105111

106112
EditorGUILayout.Space();
107113
GUILayout.Label("Render Options", EditorStyles.boldLabel);
108-
EditorGUILayout.PropertyField(m_PropRenderOrder);
109114
EditorGUILayout.PropertyField(m_PropSplatScale);
110115
EditorGUILayout.PropertyField(m_PropOpacityScale);
111116
EditorGUILayout.PropertyField(m_PropSHOrder);
112117
EditorGUILayout.PropertyField(m_PropSHOnly);
113-
EditorGUILayout.PropertyField(m_PropSortNthFrame);
118+
EditorGUILayout.PropertyField(m_gpuSortType);
119+
if (gs.m_gpuSortType != GpuSorting.SortType.None)
120+
{
121+
EditorGUILayout.PropertyField(m_PropSortNthFrame);
122+
EditorGUILayout.PropertyField(m_CenterEyeOnly);
123+
}
124+
EditorGUILayout.PropertyField(m_PropOptimizeForQuest);
125+
126+
if (gs.HasValidAsset)
127+
{
128+
EditorGUILayout.Space();
129+
GUILayout.Label("Layer Options", EditorStyles.boldLabel);
130+
for (int i = 0; i < gs.asset.layerInfo.Count; i++)
131+
{
132+
if (gs.asset.layerInfo.Count > gs.m_LayerActivationState.Count)
133+
{
134+
var toAdd = Enumerable.Repeat(default(int2), gs.asset.layerInfo.Count - gs.m_LayerActivationState.Count);
135+
gs.m_LayerActivationState.AddRange(toAdd);
136+
137+
// On initial resize, activate first layer
138+
gs.m_LayerActivationState[0] = new int2(0, 1);
139+
gs.UpdateRessources();
140+
}
141+
142+
var layer = gs.m_LayerActivationState.ElementAtOrDefault(i);
143+
var layerActive = layer.y > 0;
144+
var check = EditorGUILayout.Toggle($"Show layer {i}", layerActive);
145+
if (check != layerActive)
146+
{
147+
gs.m_LayerActivationState[i] = new int2(i, check ? 1 : 0);
148+
gs.UpdateRessources();
149+
EditorUtility.SetDirty(gs);
150+
}
151+
}
152+
}
114153

115154
EditorGUILayout.Space();
116155
GUILayout.Label("Debugging Tweaks", EditorStyles.boldLabel);
@@ -126,7 +165,8 @@ public override void OnInspectorGUI()
126165
EditorGUILayout.PropertyField(m_PropShaderComposite);
127166
EditorGUILayout.PropertyField(m_PropShaderDebugPoints);
128167
EditorGUILayout.PropertyField(m_PropShaderDebugBoxes);
129-
EditorGUILayout.PropertyField(m_PropCSSplatUtilities);
168+
EditorGUILayout.PropertyField(m_PropCSSplatUtilities_deviceRadixSort);
169+
EditorGUILayout.PropertyField(m_PropCSSplatUtilities_fidelityFxSort);
130170
}
131171
bool validAndEnabled = gs && gs.enabled && gs.gameObject.activeInHierarchy && gs.HasValidAsset;
132172
if (validAndEnabled && !gs.HasValidRenderSetup)
@@ -185,7 +225,7 @@ void MultiEditGUI()
185225
return;
186226
}
187227

188-
if (targetGs.asset.chunkData != null)
228+
if (targetGs.asset.chunkDataSize > 0)
189229
{
190230
EditorGUILayout.HelpBox($"Can't merge into {target.name} (needs to use Very High quality preset)", MessageType.Warning);
191231
return;
@@ -269,7 +309,7 @@ void EditGUI(GaussianSplatRenderer gs)
269309
ToolManager.SetActiveContext<GameObjectToolContext>();
270310
}
271311

272-
if (isToolActive && gs.asset.chunkData != null)
312+
if (isToolActive && gs.asset.chunkDataSize > 0)
273313
{
274314
EditorGUILayout.HelpBox("Splat move/rotate/scale tools need Very High splat quality preset", MessageType.Warning);
275315
}
@@ -398,13 +438,13 @@ static unsafe void ExportPlyFile(GaussianSplatRenderer gs, bool bakeTransform)
398438
if (string.IsNullOrWhiteSpace(path))
399439
return;
400440

401-
int kSplatSize = UnsafeUtility.SizeOf<Utils.InputSplatData>();
441+
int kSplatSize = UnsafeUtility.SizeOf<GaussianSplatAssetCreator.InputSplatData>();
402442
using var gpuData = new GraphicsBuffer(GraphicsBuffer.Target.Structured, gs.splatCount, kSplatSize);
403443

404444
if (!gs.EditExportData(gpuData, bakeTransform))
405445
return;
406446

407-
Utils.InputSplatData[] data = new Utils.InputSplatData[gpuData.count];
447+
GaussianSplatAssetCreator.InputSplatData[] data = new GaussianSplatAssetCreator.InputSplatData[gpuData.count];
408448
gpuData.GetData(data);
409449

410450
var gpuDeleted = gs.GpuEditDeleted;

Editor/GaussianTool.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ protected bool CanBeEdited()
2121
var gs = GetRenderer();
2222
if (!gs)
2323
return false;
24-
return gs.asset.chunkData == null; // need to be lossless / non-chunked for editing
24+
return gs.asset.chunkDataSize == 0; // need to be lossless / non-chunked for editing
2525
}
2626

2727
protected bool HasSelection()

0 commit comments

Comments
 (0)