/2D-GS-Viser-Viewer

Simple Viser Viewer for 2D Gaussian Splatting for Geometrically Accurate Radiance Fields

Primary LanguagePython

Simple Viser Viewer for 2D Gaussian Splatting for Geometrically Accurate Radiance Fields

2D GS Project page | Paper | Original Github

This repo contains the unofficial viewer for the "2D Gaussian Splatting for Geometrically Accurate Radiance Fields". A significant portion of this project is built upon several existing works to provide enhanced visualization and editing capabilities for 2D Gaussian Splatting data. visualization

⭐ Features

Rendering Training
General Edit Transform

Updates History

  • 2024/06/05
    • Training / Rendering Features
      • Now supports training with viewer (large memory consumption)
      • Supports render path generation & preview camera paths
        • Create custom camera paths & view preview videos along the generated path
    • Minor code revision
      • Add 'Set to default' in the transform panel
      • Cropbox w/ multi slider
      • Edit mode visualizes only pointcloud for clarity
      • Fix negative parts truncation in normal rendering
  • 2024/06/03
    • General Features
      • Supports various render types including Normal / Depth / Depth2Normal
      • Direct comparison between different render types, e.g., normal vs depth-to-normal
      • Cropbox Region
      • Pointcloud visualization
    • Editing Features
      • Edit, delete and save point clouds (Recommended with: 'Add pointcloud')
    • Transform Features
      • Rigid Transform
  • 2024/05/31
    • Viewer release

Installation

  • Follow the original installation instructions from 2D GS, then add all files from this project to the original project directory. (i.e., 'viewer.py' is in '~/2d-gaussian-splatting/viewer.py')
  • Tested on Ubuntu 20.04.
pip install viser==0.1.32
pip install splines  
pip install lightning

⭐IMPORTANT

  • Also, you have to fix line 135 of '_message_api.py' (or '_scene_api.py') in viser (I don't know why the bug occurs)

  • Original

    def cast_vector(vector: TVector | onp.ndarray, length: int) -> TVector:
        if not isinstance(vector, tuple):
            assert cast(onp.ndarray, vector).shape == (
                length,
        ), f"Expected vector of shape {(length,)}, but got {vector.shape} instead"
    return cast(TVector, tuple(map(float, vector)))
  • Fix it as follows
    def cast_vector(vector: TVector | onp.ndarray, length: int) -> TVector:
        if isinstance(vector, tuple): return cast(TVector, vector)
        else:
            if vector.__class__.__name__ == 'RollPitchYaw':
                x = vector.roll 
                y = vector.pitch 
                z = vector.yaw
            return cast(TVector, (x, y, z))
        else:
            vector = tuple(vector)
            return cast(TVector, vector)

Usage

  • View a 2D GS ply file
python viewer.py <path to pre-trained model> <or direct path to the ply file>
### enable transform mode
python viewer.py <path to pre-trained model> <or direct path to the ply file> --enable_transform
  • Train w/ viewer
python train_w_viewer.py -s <path to datas>

Control

  • 'q/e' for up & down
  • 'w/a/s/d' for moving
  • Mouse wheel for zoom in/out

Acknowledgements

This project is built upon the following works

Realted Blog Post: Review of 2D Gaussian Splatting (Korean)