3
3
using System ;
4
4
using System . Collections . Generic ;
5
5
using System . IO ;
6
+ using System . Linq ;
6
7
using System . Text ;
7
8
using GaussianSplatting . Runtime ;
8
9
using Unity . Collections . LowLevel . Unsafe ;
@@ -21,11 +22,11 @@ public class GaussianSplatRendererEditor : UnityEditor.Editor
21
22
const string kPrefExportBake = "nesnausk.GaussianSplatting.ExportBakeTransform" ;
22
23
23
24
SerializedProperty m_PropAsset ;
24
- SerializedProperty m_PropRenderOrder ;
25
25
SerializedProperty m_PropSplatScale ;
26
26
SerializedProperty m_PropOpacityScale ;
27
27
SerializedProperty m_PropSHOrder ;
28
28
SerializedProperty m_PropSHOnly ;
29
+ SerializedProperty m_CenterEyeOnly ;
29
30
SerializedProperty m_PropSortNthFrame ;
30
31
SerializedProperty m_PropRenderMode ;
31
32
SerializedProperty m_PropPointDisplaySize ;
@@ -34,7 +35,10 @@ public class GaussianSplatRendererEditor : UnityEditor.Editor
34
35
SerializedProperty m_PropShaderComposite ;
35
36
SerializedProperty m_PropShaderDebugPoints ;
36
37
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 ;
38
42
39
43
bool m_ResourcesExpanded = false ;
40
44
int m_CameraIndex = 0 ;
@@ -61,21 +65,23 @@ public void OnEnable()
61
65
m_ExportBakeTransform = EditorPrefs . GetBool ( kPrefExportBake , false ) ;
62
66
63
67
m_PropAsset = serializedObject . FindProperty ( "m_Asset" ) ;
64
- m_PropRenderOrder = serializedObject . FindProperty ( "m_RenderOrder" ) ;
65
68
m_PropSplatScale = serializedObject . FindProperty ( "m_SplatScale" ) ;
66
69
m_PropOpacityScale = serializedObject . FindProperty ( "m_OpacityScale" ) ;
67
70
m_PropSHOrder = serializedObject . FindProperty ( "m_SHOrder" ) ;
68
71
m_PropSHOnly = serializedObject . FindProperty ( "m_SHOnly" ) ;
69
72
m_PropSortNthFrame = serializedObject . FindProperty ( "m_SortNthFrame" ) ;
73
+ m_CenterEyeOnly = serializedObject . FindProperty ( "m_CenterEyeOnly" ) ;
70
74
m_PropRenderMode = serializedObject . FindProperty ( "m_RenderMode" ) ;
71
75
m_PropPointDisplaySize = serializedObject . FindProperty ( "m_PointDisplaySize" ) ;
72
76
m_PropCutouts = serializedObject . FindProperty ( "m_Cutouts" ) ;
73
77
m_PropShaderSplats = serializedObject . FindProperty ( "m_ShaderSplats" ) ;
74
78
m_PropShaderComposite = serializedObject . FindProperty ( "m_ShaderComposite" ) ;
75
79
m_PropShaderDebugPoints = serializedObject . FindProperty ( "m_ShaderDebugPoints" ) ;
76
80
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" ) ;
79
85
s_AllEditors . Add ( this ) ;
80
86
}
81
87
@@ -105,12 +111,45 @@ public override void OnInspectorGUI()
105
111
106
112
EditorGUILayout . Space ( ) ;
107
113
GUILayout . Label ( "Render Options" , EditorStyles . boldLabel ) ;
108
- EditorGUILayout . PropertyField ( m_PropRenderOrder ) ;
109
114
EditorGUILayout . PropertyField ( m_PropSplatScale ) ;
110
115
EditorGUILayout . PropertyField ( m_PropOpacityScale ) ;
111
116
EditorGUILayout . PropertyField ( m_PropSHOrder ) ;
112
117
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
+ }
114
153
115
154
EditorGUILayout . Space ( ) ;
116
155
GUILayout . Label ( "Debugging Tweaks" , EditorStyles . boldLabel ) ;
@@ -126,7 +165,8 @@ public override void OnInspectorGUI()
126
165
EditorGUILayout . PropertyField ( m_PropShaderComposite ) ;
127
166
EditorGUILayout . PropertyField ( m_PropShaderDebugPoints ) ;
128
167
EditorGUILayout . PropertyField ( m_PropShaderDebugBoxes ) ;
129
- EditorGUILayout . PropertyField ( m_PropCSSplatUtilities ) ;
168
+ EditorGUILayout . PropertyField ( m_PropCSSplatUtilities_deviceRadixSort ) ;
169
+ EditorGUILayout . PropertyField ( m_PropCSSplatUtilities_fidelityFxSort ) ;
130
170
}
131
171
bool validAndEnabled = gs && gs . enabled && gs . gameObject . activeInHierarchy && gs . HasValidAsset ;
132
172
if ( validAndEnabled && ! gs . HasValidRenderSetup )
@@ -185,7 +225,7 @@ void MultiEditGUI()
185
225
return ;
186
226
}
187
227
188
- if ( targetGs . asset . chunkData != null )
228
+ if ( targetGs . asset . chunkDataSize > 0 )
189
229
{
190
230
EditorGUILayout . HelpBox ( $ "Can't merge into { target . name } (needs to use Very High quality preset)", MessageType . Warning ) ;
191
231
return ;
@@ -269,7 +309,7 @@ void EditGUI(GaussianSplatRenderer gs)
269
309
ToolManager . SetActiveContext < GameObjectToolContext > ( ) ;
270
310
}
271
311
272
- if ( isToolActive && gs . asset . chunkData != null )
312
+ if ( isToolActive && gs . asset . chunkDataSize > 0 )
273
313
{
274
314
EditorGUILayout . HelpBox ( "Splat move/rotate/scale tools need Very High splat quality preset" , MessageType . Warning ) ;
275
315
}
@@ -398,13 +438,13 @@ static unsafe void ExportPlyFile(GaussianSplatRenderer gs, bool bakeTransform)
398
438
if ( string . IsNullOrWhiteSpace ( path ) )
399
439
return ;
400
440
401
- int kSplatSize = UnsafeUtility . SizeOf < Utils . InputSplatData > ( ) ;
441
+ int kSplatSize = UnsafeUtility . SizeOf < GaussianSplatAssetCreator . InputSplatData > ( ) ;
402
442
using var gpuData = new GraphicsBuffer ( GraphicsBuffer . Target . Structured , gs . splatCount , kSplatSize ) ;
403
443
404
444
if ( ! gs . EditExportData ( gpuData , bakeTransform ) )
405
445
return ;
406
446
407
- Utils . InputSplatData [ ] data = new Utils . InputSplatData [ gpuData . count ] ;
447
+ GaussianSplatAssetCreator . InputSplatData [ ] data = new GaussianSplatAssetCreator . InputSplatData [ gpuData . count ] ;
408
448
gpuData . GetData ( data ) ;
409
449
410
450
var gpuDeleted = gs . GpuEditDeleted ;
0 commit comments