用于渲染和播放动态高斯电镀序列的Unity包.
This repository contains code for compressing 3DGS PLY sequences and a Unity package for rendering and playing the compressed sequences in Unity. The Unity package depends on wuyize25/gsplat-unity, which is also included in the repository as a submodule.
Our provided install method is based on Conda package and environment management:
Create a new environment.
conda create -n compress python=3.9
conda activate compressFirst install CUDA and PyTorch, our code is evaluated on CUDA 12.1 and PyTorch 2.1.2. Then install the following dependencies:
cd CompressScripts/
pip install torch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 --index-url https://download.pytorch.org/whl/cu121
pip install weighted_distance/
pip install -r requirements.txtWe split the PLY sequence into blocks at fixed intervals. For each block, we learn RGB and SH codebooks via vector quantization and obtain indices. Using the first frame’s indices as the baseline, later frames store only sparse differences as (index, value) pairs.
Note that our method adopts only part of the compression scheme described in DualGS Paper Section 4 COMPRESSION, specifically the module for compressing RGB and SH attributes, which accounts for roughly one-third of the full algorithm.
python compress.py \
--data_path \
--output_path \
--st 0 \
--ed 99 \
--codebook_size 2**14+1 \
--len_block 20 \
--data_name Bass| Parameter | Type | Description |
|---|---|---|
| --st | int | Start frame number. |
| --ed | int | End frame number. |
| --len_block | int | Block size. A block contains how many frames. |
| --codebook_size | int | Number of entries in the codebook. Must not exceed the index dtype’s max value. |
| --data_name | str | Name of the .dgs file |
It will compress the PLY sequences into DGS format, which consists of a .dgs metadata file and a Data folder.
The unity package DynGsplat depends on wuyize25/gsplat-unity, please install and setup the Gsplat package following Gsplat/README.md. Then install the DynGsplat package (DynGsplat/package.json). DynGsplat also depends on Unity's Addressables package. If you haven't installed it before, Addressables will be installed automatically when you install DynGsplat. However, you need to complete the initial configuration for Addressables before using DynGsplat: click Window > Asset Management > Addressables > Groups, and then click "Create Addressables Settings" in the window that appears.
Copy or drag & drop the folder containing the .dgs file to any location within your Unity project's Assets folder (except for a Resources folder). This package will then automatically read the files and import the .dgs file as a Dyn Gsplat Asset and .dgsblk files as Dyn Gsplat Block Assets. The imported assets will be automatically added to an Addressables Group named "DynGsplat Assets". This group is automatically configured to be included in the build, so no extra configuration is needed for packaging.
Create a new Game Object in the scene, then add and configure the Dyn Gsplat Renderer component for it. Please note, to ensure that a Dyn Gsplat Renderer truly occupies only two blocks of memory when Streaming is enabled, you need to make sure the Bundle Mode for the DynGsplat Assets Addressables Group is set to "Pack Separately". The new version will automatically set this when creating the DynGsplat Assets Addressables Group.
| Property | Description |
|---|---|
| Asset Ref | Assign the Dyn Gsplat Asset to be played. |
| Async Loading | Toggles asynchronous loading on or off. |
| Streaming | When disabled, all frame data is loaded into memory at runtime; when enabled, it uses at most the memory size of two blocks. |
| Is Playing | Plays/Pauses the playback. |
| Gamma To Linear | Coverts color space. See Gsplat/README.md. |
This project is released under the DynGsplat-unity LICENSE. It is built upon several other open-source projects:
If you find this code useful for your research, please cite us using the following BibTeX entry.
…暂无开放 Issues,或尚未同步最近议题。