Skip to content

Latest commit

 

History

History
80 lines (54 loc) · 4.02 KB

File metadata and controls

80 lines (54 loc) · 4.02 KB

Unity_GS_Avatar_cleaning_tool

A collection of Unity C# scripts for filtering, modifying, and capturing Gaussian Splat avatars in Unity.


Repository Structure

Unity_GS_Avatar_cleaning_tool/
├── Gaussian_Artifact_Detection_Code/
│   ├── Gaussian_Avatar_Features_Exploratory_Data_Analysis.ipynb
│   └── gaussian_avatar_features_good_bad.json
├── Scripts/
│   ├── GaussianAvatar360Capture_Fixed.cs
│   ├── OpacityPatcher.cs
│   ├── male4_gaussians_world.ply
│   ├── male3_gaussians_world.ply
│   ├── f4_gaussians_world.ply
│   ├── f3_gaussians_world.ply
│   └── Editor/
│       └── GaussianCubeFinder.cs
└── README.md

Where to Place These Scripts in Unity

The folder structure shown below mirrors the layout inside Unity. Place each script as follows:

Script Unity Path
GaussianCubeFinder.cs Assets/Scripts/Editor/GaussianCubeFinder.cs
GaussianAvatar360Capture_Fixed.cs Assets/Scripts/GaussianAvatar360Capture_Fixed.cs
OpacityPatcher.cs Assets/Scripts/OpacityPatcher.cs

Script Descriptions

GaussianCubeFinder.cs

Location: Assets/Scripts/Editor/

A Unity Editor window (open via Tools > Find Gaussians In Cube) that identifies which Gaussian splats fall inside a user-placed cube in the scene. It reads world-space positions from a .ply file, checks each of the 28,072 splat positions against the cube's bounds, and saves the resulting indices to a .txt file. These indices are fed directly into OpacityPatcher.cs.

The following .ply files (located in Assets/Scripts/) each contain the baked world-space positions of all Gaussian splats for their respective avatar, and must be present for the cube to detect which Gaussians to set the opacity to 0 to:

File Avatar
male4_gaussians_world.ply Adult male avatar, variant 4
male3_gaussians_world.ply Adult male avatar, variant 3
f4_gaussians_world.ply Adult female avatar, variant 4
f3_gaussians_world.ply Adult female avatar, variant 3

OpacityPatcher.cs

Location: Assets/Scripts/

A MonoBehaviour that zeroes out the opacity of specific Gaussian splats (identified by GaussianCubeFinder.cs). The script reads raw binary bytes directly from the m4_col asset, zeroes the alpha bytes for each target splat index using Morton-encoded pixel mapping, then builds and swaps in a new Texture2D on the GaussianSplatRenderer.


GaussianAvatar360Capture_Fixed.cs

Location: Assets/Scripts/

A MonoBehaviour attached to the gaussianSplatsAvatar GameObject that automates 360° image capture of the avatar in T-pose. It performs two vertical orbital passes — one around the full body and one around the right hand — in 1° increments, saving 720 total PNG frames. The camera distance is auto-calculated from a configurable frame fill percentage and FOV (Field of View — the width of the camera's visible angle, measured in degrees) using the formula distance = height / (2 * tan(FOV / 2)).


Artifact Detection Notebook

Gaussian_Avatar_Features_Exploratory_Data_Analysis.ipynb

Location: Gaussian_Artifact_Detection_Code/

A Python notebook that performs exploratory data analysis and machine learning on Gaussian splat features to identify artifact splats across the following avatars: m4, m3, f4, f3. It loads per-splat properties (position, color, rotation, scale, opacity) from the JSON file gaussian_avatar_features_good_bad.json, derives additional color features, and runs dimensionality reduction (t-SNE), feature importance ranking (Random Forest, permutation importance), and classifier comparisons (RF, XGBoost, SVM, ANN, KNN) to evaluate how well good and bad splats can be separated.

Note: This notebook requires gaussian_avatar_features_good_bad.json (included in the same folder) to run. This JSON file contains the labeled good and bad Gaussian splat data for all four avatars (m4, m3, f4, f3).