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

Editing: merge, move splats, bake transform when exporting #51

Merged
merged 27 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
3d96c00
Validator against both SBIR and our own results
aras-p Oct 18, 2023
1a03ecd
Make Very High quality preset not use any chunking at all
aras-p Oct 18, 2023
7b8c256
Split off GaussianSplatsTool into separate file
aras-p Oct 19, 2023
2d174fb
Change gaussian edit tool to tool context
aras-p Oct 19, 2023
6e51203
Beginnings of move tool
aras-p Oct 19, 2023
99b1f21
Move tool handles handle orientation, renaming variables for clarity
aras-p Oct 19, 2023
bb811cb
Beginnings of scale tool
aras-p Oct 19, 2023
431a514
Scale tool handles global vs local orientation modes
aras-p Oct 20, 2023
ee38ced
Add initial SH rotation code
aras-p Oct 20, 2023
d036594
SH rotation matrix column vs row major fix
aras-p Oct 20, 2023
626e710
Fix regular (debug points, debug boxes) shaders not working
aras-p Oct 20, 2023
b0b1a82
Add option to "bake" GS transform when exporting PLY file
aras-p Oct 20, 2023
0fbc310
Scale splats by transfrom local scale when exporting
aras-p Oct 20, 2023
018b5ff
Beginnings of rotate tool (not working properly yet)
aras-p Oct 20, 2023
9c4389e
Fix cutouts not working properly with bake transform lol
aras-p Oct 21, 2023
68c405b
Towards having ability for splat count in renderer to not be the same…
aras-p Oct 21, 2023
ec79cdc
Towards rotate tool, but not working fine just yet
aras-p Oct 25, 2023
88ee1df
Basic multi-select inspector for GS assets
aras-p Oct 25, 2023
f632550
Towards ability to merge splats (SH is not correct yet)
aras-p Nov 9, 2023
41e2b87
Add option to render only the SH contribution upon gray color
aras-p Nov 9, 2023
6907cce
Fix SH rotation to finally be proper :fingers-crossed:
aras-p Nov 9, 2023
e98549a
Merge branch 'main' into more-edit-tools
aras-p Nov 9, 2023
6160df7
Always display splat count, merge marks as edited, Reset button
aras-p Nov 9, 2023
b35b60d
Carry over "which splats are deleted" info when merging splats
aras-p Nov 9, 2023
e9bb447
Clearer label for bake transform
aras-p Nov 9, 2023
2f87543
Disable scale tool for now
aras-p Nov 9, 2023
6047c10
Cleanup
aras-p Nov 9, 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
35 changes: 35 additions & 0 deletions package/Editor/GaussianMoveTool.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// SPDX-License-Identifier: MIT

using GaussianSplatting.Runtime;
using UnityEditor;
using UnityEditor.EditorTools;
using UnityEngine;

namespace GaussianSplatting.Editor
{
[EditorTool("Gaussian Move Tool", typeof(GaussianSplatRenderer), typeof(GaussianToolContext))]
class GaussianMoveTool : GaussianTool
{
public override void OnToolGUI(EditorWindow window)
{
var gs = GetRenderer();
if (!gs || !CanBeEdited() || !HasSelection())
return;
var tr = gs.transform;

EditorGUI.BeginChangeCheck();
var selCenterLocal = GetSelectionCenterLocal();
var selCenterWorld = tr.TransformPoint(selCenterLocal);
var newPosWorld = Handles.DoPositionHandle(selCenterWorld, Tools.handleRotation);
if (EditorGUI.EndChangeCheck())
{
var newPosLocal = tr.InverseTransformPoint(newPosWorld);
var wasModified = gs.editModified;
gs.EditTranslateSelection(newPosLocal - selCenterLocal);
if (!wasModified)
GaussianSplatRendererEditor.RepaintAll();
Event.current.Use();
}
}
}
}
11 changes: 11 additions & 0 deletions package/Editor/GaussianMoveTool.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

70 changes: 70 additions & 0 deletions package/Editor/GaussianRotateTool.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// SPDX-License-Identifier: MIT

using GaussianSplatting.Runtime;
using UnityEditor;
using UnityEditor.EditorTools;
using UnityEngine;

namespace GaussianSplatting.Editor
{
/* not working correctly yet
[EditorTool("Gaussian Rotate Tool", typeof(GaussianSplatRenderer), typeof(GaussianToolContext))]
class GaussianRotateTool : GaussianTool
{
Quaternion m_CurrentRotation = Quaternion.identity;
Vector3 m_FrozenSelCenterLocal = Vector3.zero;
bool m_FreezePivot = false;

public override void OnActivated()
{
m_FreezePivot = false;
}

public override void OnToolGUI(EditorWindow window)
{
var gs = GetRenderer();
if (!gs || !CanBeEdited() || !HasSelection())
return;
var tr = gs.transform;
var evt = Event.current;

var selCenterLocal = GetSelectionCenterLocal();
if (evt.type == EventType.MouseDown)
{
gs.EditStorePosMouseDown();
gs.EditStoreOtherMouseDown();
m_FrozenSelCenterLocal = selCenterLocal;
m_FreezePivot = true;
}
if (evt.type == EventType.MouseUp)
{
m_CurrentRotation = Quaternion.identity;
m_FreezePivot = false;
}

if (m_FreezePivot)
selCenterLocal = m_FrozenSelCenterLocal;

EditorGUI.BeginChangeCheck();
var selCenterWorld = tr.TransformPoint(selCenterLocal);
var newRotation = Handles.DoRotationHandle(m_CurrentRotation, selCenterWorld);
if (EditorGUI.EndChangeCheck())
{
Matrix4x4 localToWorld = gs.transform.localToWorldMatrix;
Matrix4x4 worldToLocal = gs.transform.worldToLocalMatrix;
var wasModified = gs.editModified;
var rotToApply = newRotation;
gs.EditRotateSelection(selCenterLocal, localToWorld, worldToLocal, rotToApply);
m_CurrentRotation = newRotation;
if (!wasModified)
GaussianSplatRendererEditor.RepaintAll();

if(GUIUtility.hotControl == 0)
{
m_CurrentRotation = Tools.handleRotation;
}
}
}
}
*/
}
3 changes: 3 additions & 0 deletions package/Editor/GaussianRotateTool.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 68 additions & 0 deletions package/Editor/GaussianScaleTool.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// SPDX-License-Identifier: MIT

using GaussianSplatting.Runtime;
using UnityEditor;
using UnityEditor.EditorTools;
using UnityEngine;

namespace GaussianSplatting.Editor
{
/* // not working correctly yet when the GS itself has scale
[EditorTool("Gaussian Scale Tool", typeof(GaussianSplatRenderer), typeof(GaussianToolContext))]
class GaussianScaleTool : GaussianTool
{
Vector3 m_CurrentScale = Vector3.one;
Vector3 m_FrozenSelCenterLocal = Vector3.zero;
bool m_FreezePivot = false;

public override void OnActivated()
{
m_FreezePivot = false;
}

public override void OnToolGUI(EditorWindow window)
{
var gs = GetRenderer();
if (!gs || !CanBeEdited() || !HasSelection())
return;
var tr = gs.transform;
var evt = Event.current;

var selCenterLocal = GetSelectionCenterLocal();
if (evt.type == EventType.MouseDown)
{
gs.EditStorePosMouseDown();
m_FrozenSelCenterLocal = selCenterLocal;
m_FreezePivot = true;
}
if (evt.type == EventType.MouseUp)
{
m_CurrentScale = Vector3.one;
m_FreezePivot = false;
}

if (m_FreezePivot)
selCenterLocal = m_FrozenSelCenterLocal;

EditorGUI.BeginChangeCheck();
var selCenterWorld = tr.TransformPoint(selCenterLocal);
m_CurrentScale = Handles.DoScaleHandle(m_CurrentScale, selCenterWorld, Tools.handleRotation, HandleUtility.GetHandleSize(selCenterWorld));
if (EditorGUI.EndChangeCheck())
{
Matrix4x4 localToWorld = Matrix4x4.identity;
Matrix4x4 worldToLocal = Matrix4x4.identity;
if (Tools.pivotRotation == PivotRotation.Global)
{
localToWorld = gs.transform.localToWorldMatrix;
worldToLocal = gs.transform.worldToLocalMatrix;
}
var wasModified = gs.editModified;
gs.EditScaleSelection(selCenterLocal, localToWorld, worldToLocal, m_CurrentScale);
if (!wasModified)
GaussianSplatRendererEditor.RepaintAll();
evt.Use();
}
}
}
*/
}
3 changes: 3 additions & 0 deletions package/Editor/GaussianScaleTool.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading