mirror of
https://github.com/graphdeco-inria/gaussian-splatting
synced 2025-05-17 18:05:25 +00:00
Implementation of 3dgs-mcmc
This commit is contained in:
parent
472689c0dc
commit
2079e84c7a
7
.gitmodules
vendored
7
.gitmodules
vendored
@ -1,9 +1,10 @@
|
||||
[submodule "submodules/simple-knn"]
|
||||
path = submodules/simple-knn
|
||||
url = https://gitlab.inria.fr/bkerbl/simple-knn.git
|
||||
[submodule "submodules/diff-gaussian-rasterization"]
|
||||
path = submodules/diff-gaussian-rasterization
|
||||
url = https://github.com/graphdeco-inria/diff-gaussian-rasterization
|
||||
[submodule "SIBR_viewers"]
|
||||
path = SIBR_viewers
|
||||
url = https://gitlab.inria.fr/sibr/sibr_core.git
|
||||
[submodule "submodules/diff-gaussian-rasterization"]
|
||||
path = submodules/diff-gaussian-rasterization
|
||||
url = git@github.com:shakibakh/diff-gaussian-rasterization.git
|
||||
branch = gs-mcmc
|
||||
|
519
README.md
519
README.md
@ -1,522 +1,35 @@
|
||||
# 3D Gaussian Splatting for Real-Time Radiance Field Rendering
|
||||
Bernhard Kerbl*, Georgios Kopanas*, Thomas Leimkühler, George Drettakis (* indicates equal contribution)<br>
|
||||
| [Webpage](https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/) | [Full Paper](https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/3d_gaussian_splatting_high.pdf) | [Video](https://youtu.be/T_kXY43VZnk) | [Other GRAPHDECO Publications](http://www-sop.inria.fr/reves/publis/gdindex.php) | [FUNGRAPH project page](https://fungraph.inria.fr) |<br>
|
||||
| [T&T+DB COLMAP (650MB)](https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/datasets/input/tandt_db.zip) | [Pre-trained Models (14 GB)](https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/datasets/pretrained/models.zip) | [Viewers for Windows (60MB)](https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/binaries/viewers.zip) | [Evaluation Images (7 GB)](https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/evaluation/images.zip) |<br>
|
||||

|
||||
# 3D Gaussian Splatting as Markov Chain Monte Carlo
|
||||
|
||||
This repository contains the official authors implementation associated with the paper "3D Gaussian Splatting for Real-Time Radiance Field Rendering", which can be found [here](https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/). We further provide the reference images used to create the error metrics reported in the paper, as well as recently created, pre-trained models.
|
||||
|
||||
<a href="https://www.inria.fr/"><img height="100" src="assets/logo_inria.png"> </a>
|
||||
<a href="https://univ-cotedazur.eu/"><img height="100" src="assets/logo_uca.png"> </a>
|
||||
<a href="https://www.mpi-inf.mpg.de"><img height="100" src="assets/logo_mpi.png"> </a>
|
||||
<a href="https://team.inria.fr/graphdeco/"> <img style="width:100%;" src="assets/logo_graphdeco.png"></a>
|
||||
|
||||
Abstract: *Radiance Field methods have recently revolutionized novel-view synthesis of scenes captured with multiple photos or videos. However, achieving high visual quality still requires neural networks that are costly to train and render, while recent faster methods inevitably trade off speed for quality. For unbounded and complete scenes (rather than isolated objects) and 1080p resolution rendering, no current method can achieve real-time display rates. We introduce three key elements that allow us to achieve state-of-the-art visual quality while maintaining competitive training times and importantly allow high-quality real-time (≥ 30 fps) novel-view synthesis at 1080p resolution. First, starting from sparse points produced during camera calibration, we represent the scene with 3D Gaussians that preserve desirable properties of continuous volumetric radiance fields for scene optimization while avoiding unnecessary computation in empty space; Second, we perform interleaved optimization/density control of the 3D Gaussians, notably optimizing anisotropic covariance to achieve an accurate representation of the scene; Third, we develop a fast visibility-aware rendering algorithm that supports anisotropic splatting and both accelerates training and allows realtime rendering. We demonstrate state-of-the-art visual quality and real-time rendering on several established datasets.*
|
||||
|
||||
<section class="section" id="BibTeX">
|
||||
<div class="container is-max-desktop content">
|
||||
<h2 class="title">BibTeX</h2>
|
||||
<pre><code>@Article{kerbl3Dgaussians,
|
||||
author = {Kerbl, Bernhard and Kopanas, Georgios and Leimk{\"u}hler, Thomas and Drettakis, George},
|
||||
title = {3D Gaussian Splatting for Real-Time Radiance Field Rendering},
|
||||
journal = {ACM Transactions on Graphics},
|
||||
number = {4},
|
||||
volume = {42},
|
||||
month = {July},
|
||||
year = {2023},
|
||||
url = {https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/}
|
||||
<pre><code>@article{kheradmand20243d,
|
||||
title={3D Gaussian Splatting as Markov Chain Monte Carlo},
|
||||
author={Kheradmand, Shakiba and Rebain, Daniel and Sharma, Gopal and Sun, Weiwei and Tseng, Jeff and Isack, Hossam and Kar, Abhishek and Tagliasacchi, Andrea and Yi, Kwang Moo},
|
||||
journal={arXiv preprint arXiv:2404.09591},
|
||||
year={2024}
|
||||
}</code></pre>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
## Funding and Acknowledgments
|
||||
|
||||
This research was funded by the ERC Advanced grant FUNGRAPH No 788065. The authors are grateful to Adobe for generous donations, the OPAL infrastructure from Université Côte d’Azur and for the HPC resources from GENCI–IDRIS (Grant 2022-AD011013409). The authors thank the anonymous reviewers for their valuable feedback, P. Hedman and A. Tewari for proofreading earlier drafts also T. Müller, A. Yu and S. Fridovich-Keil for helping with the comparisons.
|
||||
## How to install
|
||||
|
||||
## Step-by-step Tutorial
|
||||
|
||||
Jonathan Stephens made a fantastic step-by-step tutorial for setting up Gaussian Splatting on your machine, along with instructions for creating usable datasets from videos. If the instructions below are too dry for you, go ahead and check it out [here](https://www.youtube.com/watch?v=UXtuigy_wYc).
|
||||
|
||||
## Colab
|
||||
|
||||
User [camenduru](https://github.com/camenduru) was kind enough to provide a Colab template that uses this repo's source (status: August 2023!) for quick and easy access to the method. Please check it out [here](https://github.com/camenduru/gaussian-splatting-colab).
|
||||
|
||||
## Cloning the Repository
|
||||
|
||||
The repository contains submodules, thus please check it out with
|
||||
```shell
|
||||
# SSH
|
||||
git clone git@github.com:graphdeco-inria/gaussian-splatting.git --recursive
|
||||
Please refer to [Original 3DGS code base](https://github.com/graphdeco-inria/gaussian-splatting) for installation instructions. Make sure to reinstall diff-gaussian-rasterization with the following command on an available 3DGS environment as this library has been modified:
|
||||
```
|
||||
or
|
||||
```shell
|
||||
# HTTPS
|
||||
git clone https://github.com/graphdeco-inria/gaussian-splatting --recursive
|
||||
pip install submodules/diff-gaussian-rasterization
|
||||
```
|
||||
|
||||
## Overview
|
||||
## How to run
|
||||
Running code is similar to the [Original 3DGS code base](https://github.com/graphdeco-inria/gaussian-splatting) with the following differences:
|
||||
- You need to specify the maximum number of Gaussians that will be used. This is performed using --cap_max argument. The results in the paper uses the final number of Gaussians reached by the original 3DGS run for each shape.
|
||||
- You need to specify the scale regularizer coefficient. This is performed using --scale_reg argument. For all the experiments in the paper, we use 0.01.
|
||||
- You need to specify the opacity regularizer coefficient. This is performed using --opacity_reg argument. For Deep Blending dataset, we use 0.001. For all other experiments in the paper, we use 0.01.
|
||||
- You need to specify the noise learning rate. This is performed using --noise_lr argument. For all the experiments in the paper, we use 5e5.
|
||||
- You need to specify the initialization type. This is performed using --init_type argument. Options are random (to initialize randomly) or sfm (to initialize using a pointcloud).
|
||||
|
||||
The codebase has 4 main components:
|
||||
- A PyTorch-based optimizer to produce a 3D Gaussian model from SfM inputs
|
||||
- A network viewer that allows to connect to and visualize the optimization process
|
||||
- An OpenGL-based real-time viewer to render trained models in real-time.
|
||||
- A script to help you turn your own images into optimization-ready SfM data sets
|
||||
|
||||
The components have different requirements w.r.t. both hardware and software. They have been tested on Windows 10 and Ubuntu Linux 22.04. Instructions for setting up and running each of them are found in the sections below.
|
||||
|
||||
## New features [Please check regularly!]
|
||||
|
||||
We will be adding several new features soon. In the meantime Orange has kindly added [OpenXR support](#openXR-support) for VR viewing. Please come back soon, we will be adding other features, building among others on recent 3DGS followup papers.
|
||||
|
||||
## Optimizer
|
||||
|
||||
The optimizer uses PyTorch and CUDA extensions in a Python environment to produce trained models.
|
||||
|
||||
### Hardware Requirements
|
||||
|
||||
- CUDA-ready GPU with Compute Capability 7.0+
|
||||
- 24 GB VRAM (to train to paper evaluation quality)
|
||||
- Please see FAQ for smaller VRAM configurations
|
||||
|
||||
### Software Requirements
|
||||
- Conda (recommended for easy setup)
|
||||
- C++ Compiler for PyTorch extensions (we used Visual Studio 2019 for Windows)
|
||||
- CUDA SDK 11 for PyTorch extensions, install *after* Visual Studio (we used 11.8, **known issues with 11.6**)
|
||||
- C++ Compiler and CUDA SDK must be compatible
|
||||
|
||||
### Setup
|
||||
|
||||
#### Local Setup
|
||||
|
||||
Our default, provided install method is based on Conda package and environment management:
|
||||
```shell
|
||||
SET DISTUTILS_USE_SDK=1 # Windows only
|
||||
conda env create --file environment.yml
|
||||
conda activate gaussian_splatting
|
||||
```
|
||||
Please note that this process assumes that you have CUDA SDK **11** installed, not **12**. For modifications, see below.
|
||||
|
||||
Tip: Downloading packages and creating a new environment with Conda can require a significant amount of disk space. By default, Conda will use the main system hard drive. You can avoid this by specifying a different package download location and an environment on a different drive:
|
||||
|
||||
```shell
|
||||
conda config --add pkgs_dirs <Drive>/<pkg_path>
|
||||
conda env create --file environment.yml --prefix <Drive>/<env_path>/gaussian_splatting
|
||||
conda activate <Drive>/<env_path>/gaussian_splatting
|
||||
```
|
||||
|
||||
#### Modifications
|
||||
|
||||
If you can afford the disk space, we recommend using our environment files for setting up a training environment identical to ours. If you want to make modifications, please note that major version changes might affect the results of our method. However, our (limited) experiments suggest that the codebase works just fine inside a more up-to-date environment (Python 3.8, PyTorch 2.0.0, CUDA 12). Make sure to create an environment where PyTorch and its CUDA runtime version match and the installed CUDA SDK has no major version difference with PyTorch's CUDA version.
|
||||
|
||||
#### Known Issues
|
||||
|
||||
Some users experience problems building the submodules on Windows (```cl.exe: File not found``` or similar). Please consider the workaround for this problem from the FAQ.
|
||||
|
||||
### Running
|
||||
|
||||
To run the optimizer, simply use
|
||||
|
||||
```shell
|
||||
python train.py -s <path to COLMAP or NeRF Synthetic dataset>
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary><span style="font-weight: bold;">Command Line Arguments for train.py</span></summary>
|
||||
|
||||
#### --source_path / -s
|
||||
Path to the source directory containing a COLMAP or Synthetic NeRF data set.
|
||||
#### --model_path / -m
|
||||
Path where the trained model should be stored (```output/<random>``` by default).
|
||||
#### --images / -i
|
||||
Alternative subdirectory for COLMAP images (```images``` by default).
|
||||
#### --eval
|
||||
Add this flag to use a MipNeRF360-style training/test split for evaluation.
|
||||
#### --resolution / -r
|
||||
Specifies resolution of the loaded images before training. If provided ```1, 2, 4``` or ```8```, uses original, 1/2, 1/4 or 1/8 resolution, respectively. For all other values, rescales the width to the given number while maintaining image aspect. **If not set and input image width exceeds 1.6K pixels, inputs are automatically rescaled to this target.**
|
||||
#### --data_device
|
||||
Specifies where to put the source image data, ```cuda``` by default, recommended to use ```cpu``` if training on large/high-resolution dataset, will reduce VRAM consumption, but slightly slow down training. Thanks to [HrsPythonix](https://github.com/HrsPythonix).
|
||||
#### --white_background / -w
|
||||
Add this flag to use white background instead of black (default), e.g., for evaluation of NeRF Synthetic dataset.
|
||||
#### --sh_degree
|
||||
Order of spherical harmonics to be used (no larger than 3). ```3``` by default.
|
||||
#### --convert_SHs_python
|
||||
Flag to make pipeline compute forward and backward of SHs with PyTorch instead of ours.
|
||||
#### --convert_cov3D_python
|
||||
Flag to make pipeline compute forward and backward of the 3D covariance with PyTorch instead of ours.
|
||||
#### --debug
|
||||
Enables debug mode if you experience erros. If the rasterizer fails, a ```dump``` file is created that you may forward to us in an issue so we can take a look.
|
||||
#### --debug_from
|
||||
Debugging is **slow**. You may specify an iteration (starting from 0) after which the above debugging becomes active.
|
||||
#### --iterations
|
||||
Number of total iterations to train for, ```30_000``` by default.
|
||||
#### --ip
|
||||
IP to start GUI server on, ```127.0.0.1``` by default.
|
||||
#### --port
|
||||
Port to use for GUI server, ```6009``` by default.
|
||||
#### --test_iterations
|
||||
Space-separated iterations at which the training script computes L1 and PSNR over test set, ```7000 30000``` by default.
|
||||
#### --save_iterations
|
||||
Space-separated iterations at which the training script saves the Gaussian model, ```7000 30000 <iterations>``` by default.
|
||||
#### --checkpoint_iterations
|
||||
Space-separated iterations at which to store a checkpoint for continuing later, saved in the model directory.
|
||||
#### --start_checkpoint
|
||||
Path to a saved checkpoint to continue training from.
|
||||
#### --quiet
|
||||
Flag to omit any text written to standard out pipe.
|
||||
#### --feature_lr
|
||||
Spherical harmonics features learning rate, ```0.0025``` by default.
|
||||
#### --opacity_lr
|
||||
Opacity learning rate, ```0.05``` by default.
|
||||
#### --scaling_lr
|
||||
Scaling learning rate, ```0.005``` by default.
|
||||
#### --rotation_lr
|
||||
Rotation learning rate, ```0.001``` by default.
|
||||
#### --position_lr_max_steps
|
||||
Number of steps (from 0) where position learning rate goes from ```initial``` to ```final```. ```30_000``` by default.
|
||||
#### --position_lr_init
|
||||
Initial 3D position learning rate, ```0.00016``` by default.
|
||||
#### --position_lr_final
|
||||
Final 3D position learning rate, ```0.0000016``` by default.
|
||||
#### --position_lr_delay_mult
|
||||
Position learning rate multiplier (cf. Plenoxels), ```0.01``` by default.
|
||||
#### --densify_from_iter
|
||||
Iteration where densification starts, ```500``` by default.
|
||||
#### --densify_until_iter
|
||||
Iteration where densification stops, ```15_000``` by default.
|
||||
#### --densify_grad_threshold
|
||||
Limit that decides if points should be densified based on 2D position gradient, ```0.0002``` by default.
|
||||
#### --densification_interval
|
||||
How frequently to densify, ```100``` (every 100 iterations) by default.
|
||||
#### --opacity_reset_interval
|
||||
How frequently to reset opacity, ```3_000``` by default.
|
||||
#### --lambda_dssim
|
||||
Influence of SSIM on total loss from 0 to 1, ```0.2``` by default.
|
||||
#### --percent_dense
|
||||
Percentage of scene extent (0--1) a point must exceed to be forcibly densified, ```0.01``` by default.
|
||||
|
||||
</details>
|
||||
<br>
|
||||
|
||||
Note that similar to MipNeRF360, we target images at resolutions in the 1-1.6K pixel range. For convenience, arbitrary-size inputs can be passed and will be automatically resized if their width exceeds 1600 pixels. We recommend to keep this behavior, but you may force training to use your higher-resolution images by setting ```-r 1```.
|
||||
|
||||
The MipNeRF360 scenes are hosted by the paper authors [here](https://jonbarron.info/mipnerf360/). You can find our SfM data sets for Tanks&Temples and Deep Blending [here](https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/datasets/input/tandt_db.zip). If you do not provide an output model directory (```-m```), trained models are written to folders with randomized unique names inside the ```output``` directory. At this point, the trained models may be viewed with the real-time viewer (see further below).
|
||||
|
||||
### Evaluation
|
||||
By default, the trained models use all available images in the dataset. To train them while withholding a test set for evaluation, use the ```--eval``` flag. This way, you can render training/test sets and produce error metrics as follows:
|
||||
```shell
|
||||
python train.py -s <path to COLMAP or NeRF Synthetic dataset> --eval # Train with train/test split
|
||||
python render.py -m <path to trained model> # Generate renderings
|
||||
python metrics.py -m <path to trained model> # Compute error metrics on renderings
|
||||
```
|
||||
|
||||
If you want to evaluate our [pre-trained models](https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/datasets/pretrained/models.zip), you will have to download the corresponding source data sets and indicate their location to ```render.py``` with an additional ```--source_path/-s``` flag. Note: The pre-trained models were created with the release codebase. This code base has been cleaned up and includes bugfixes, hence the metrics you get from evaluating them will differ from those in the paper.
|
||||
```shell
|
||||
python render.py -m <path to pre-trained model> -s <path to COLMAP dataset>
|
||||
python metrics.py -m <path to pre-trained model>
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary><span style="font-weight: bold;">Command Line Arguments for render.py</span></summary>
|
||||
|
||||
#### --model_path / -m
|
||||
Path to the trained model directory you want to create renderings for.
|
||||
#### --skip_train
|
||||
Flag to skip rendering the training set.
|
||||
#### --skip_test
|
||||
Flag to skip rendering the test set.
|
||||
#### --quiet
|
||||
Flag to omit any text written to standard out pipe.
|
||||
|
||||
**The below parameters will be read automatically from the model path, based on what was used for training. However, you may override them by providing them explicitly on the command line.**
|
||||
|
||||
#### --source_path / -s
|
||||
Path to the source directory containing a COLMAP or Synthetic NeRF data set.
|
||||
#### --images / -i
|
||||
Alternative subdirectory for COLMAP images (```images``` by default).
|
||||
#### --eval
|
||||
Add this flag to use a MipNeRF360-style training/test split for evaluation.
|
||||
#### --resolution / -r
|
||||
Changes the resolution of the loaded images before training. If provided ```1, 2, 4``` or ```8```, uses original, 1/2, 1/4 or 1/8 resolution, respectively. For all other values, rescales the width to the given number while maintaining image aspect. ```1``` by default.
|
||||
#### --white_background / -w
|
||||
Add this flag to use white background instead of black (default), e.g., for evaluation of NeRF Synthetic dataset.
|
||||
#### --convert_SHs_python
|
||||
Flag to make pipeline render with computed SHs from PyTorch instead of ours.
|
||||
#### --convert_cov3D_python
|
||||
Flag to make pipeline render with computed 3D covariance from PyTorch instead of ours.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><span style="font-weight: bold;">Command Line Arguments for metrics.py</span></summary>
|
||||
|
||||
#### --model_paths / -m
|
||||
Space-separated list of model paths for which metrics should be computed.
|
||||
</details>
|
||||
<br>
|
||||
|
||||
We further provide the ```full_eval.py``` script. This script specifies the routine used in our evaluation and demonstrates the use of some additional parameters, e.g., ```--images (-i)``` to define alternative image directories within COLMAP data sets. If you have downloaded and extracted all the training data, you can run it like this:
|
||||
```shell
|
||||
python full_eval.py -m360 <mipnerf360 folder> -tat <tanks and temples folder> -db <deep blending folder>
|
||||
```
|
||||
In the current version, this process takes about 7h on our reference machine containing an A6000. If you want to do the full evaluation on our pre-trained models, you can specify their download location and skip training.
|
||||
```shell
|
||||
python full_eval.py -o <directory with pretrained models> --skip_training -m360 <mipnerf360 folder> -tat <tanks and temples folder> -db <deep blending folder>
|
||||
```
|
||||
|
||||
If you want to compute the metrics on our paper's [evaluation images](https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/evaluation/images.zip), you can also skip rendering. In this case it is not necessary to provide the source datasets. You can compute metrics for multiple image sets at a time.
|
||||
```shell
|
||||
python full_eval.py -m <directory with evaluation images>/garden ... --skip_training --skip_rendering
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary><span style="font-weight: bold;">Command Line Arguments for full_eval.py</span></summary>
|
||||
|
||||
#### --skip_training
|
||||
Flag to skip training stage.
|
||||
#### --skip_rendering
|
||||
Flag to skip rendering stage.
|
||||
#### --skip_metrics
|
||||
Flag to skip metrics calculation stage.
|
||||
#### --output_path
|
||||
Directory to put renderings and results in, ```./eval``` by default, set to pre-trained model location if evaluating them.
|
||||
#### --mipnerf360 / -m360
|
||||
Path to MipNeRF360 source datasets, required if training or rendering.
|
||||
#### --tanksandtemples / -tat
|
||||
Path to Tanks&Temples source datasets, required if training or rendering.
|
||||
#### --deepblending / -db
|
||||
Path to Deep Blending source datasets, required if training or rendering.
|
||||
</details>
|
||||
<br>
|
||||
|
||||
## Interactive Viewers
|
||||
We provide two interactive viewers for our method: remote and real-time. Our viewing solutions are based on the [SIBR](https://sibr.gitlabpages.inria.fr/) framework, developed by the GRAPHDECO group for several novel-view synthesis projects.
|
||||
|
||||
### Hardware Requirements
|
||||
- OpenGL 4.5-ready GPU and drivers (or latest MESA software)
|
||||
- 4 GB VRAM recommended
|
||||
- CUDA-ready GPU with Compute Capability 7.0+ (only for Real-Time Viewer)
|
||||
|
||||
### Software Requirements
|
||||
- Visual Studio or g++, **not Clang** (we used Visual Studio 2019 for Windows)
|
||||
- CUDA SDK 11, install *after* Visual Studio (we used 11.8)
|
||||
- CMake (recent version, we used 3.24)
|
||||
- 7zip (only on Windows)
|
||||
|
||||
### Pre-built Windows Binaries
|
||||
We provide pre-built binaries for Windows [here](https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/binaries/viewers.zip). We recommend using them on Windows for an efficient setup, since the building of SIBR involves several external dependencies that must be downloaded and compiled on-the-fly.
|
||||
|
||||
### Installation from Source
|
||||
If you cloned with submodules (e.g., using ```--recursive```), the source code for the viewers is found in ```SIBR_viewers```. The network viewer runs within the SIBR framework for Image-based Rendering applications.
|
||||
|
||||
#### Windows
|
||||
CMake should take care of your dependencies.
|
||||
```shell
|
||||
cd SIBR_viewers
|
||||
cmake -Bbuild .
|
||||
cmake --build build --target install --config RelWithDebInfo
|
||||
```
|
||||
You may specify a different configuration, e.g. ```Debug``` if you need more control during development.
|
||||
|
||||
#### Ubuntu 22.04
|
||||
You will need to install a few dependencies before running the project setup.
|
||||
```shell
|
||||
# Dependencies
|
||||
sudo apt install -y libglew-dev libassimp-dev libboost-all-dev libgtk-3-dev libopencv-dev libglfw3-dev libavdevice-dev libavcodec-dev libeigen3-dev libxxf86vm-dev libembree-dev
|
||||
# Project setup
|
||||
cd SIBR_viewers
|
||||
cmake -Bbuild . -DCMAKE_BUILD_TYPE=Release # add -G Ninja to build faster
|
||||
cmake --build build -j24 --target install
|
||||
```
|
||||
|
||||
#### Ubuntu 20.04
|
||||
Backwards compatibility with Focal Fossa is not fully tested, but building SIBR with CMake should still work after invoking
|
||||
```shell
|
||||
git checkout fossa_compatibility
|
||||
```
|
||||
|
||||
### Navigation in SIBR Viewers
|
||||
The SIBR interface provides several methods of navigating the scene. By default, you will be started with an FPS navigator, which you can control with ```W, A, S, D, Q, E``` for camera translation and ```I, K, J, L, U, O``` for rotation. Alternatively, you may want to use a Trackball-style navigator (select from the floating menu). You can also snap to a camera from the data set with the ```Snap to``` button or find the closest camera with ```Snap to closest```. The floating menues also allow you to change the navigation speed. You can use the ```Scaling Modifier``` to control the size of the displayed Gaussians, or show the initial point cloud.
|
||||
|
||||
### Running the Network Viewer
|
||||
|
||||
|
||||
|
||||
https://github.com/graphdeco-inria/gaussian-splatting/assets/40643808/90a2e4d3-cf2e-4633-b35f-bfe284e28ff7
|
||||
|
||||
|
||||
|
||||
After extracting or installing the viewers, you may run the compiled ```SIBR_remoteGaussian_app[_config]``` app in ```<SIBR install dir>/bin```, e.g.:
|
||||
```shell
|
||||
./<SIBR install dir>/bin/SIBR_remoteGaussian_app
|
||||
```
|
||||
The network viewer allows you to connect to a running training process on the same or a different machine. If you are training on the same machine and OS, no command line parameters should be required: the optimizer communicates the location of the training data to the network viewer. By default, optimizer and network viewer will try to establish a connection on **localhost** on port **6009**. You can change this behavior by providing matching ```--ip``` and ```--port``` parameters to both the optimizer and the network viewer. If for some reason the path used by the optimizer to find the training data is not reachable by the network viewer (e.g., due to them running on different (virtual) machines), you may specify an override location to the viewer by using ```-s <source path>```.
|
||||
|
||||
<details>
|
||||
<summary><span style="font-weight: bold;">Primary Command Line Arguments for Network Viewer</span></summary>
|
||||
|
||||
#### --path / -s
|
||||
Argument to override model's path to source dataset.
|
||||
#### --ip
|
||||
IP to use for connection to a running training script.
|
||||
#### --port
|
||||
Port to use for connection to a running training script.
|
||||
#### --rendering-size
|
||||
Takes two space separated numbers to define the resolution at which network rendering occurs, ```1200``` width by default.
|
||||
Note that to enforce an aspect that differs from the input images, you need ```--force-aspect-ratio``` too.
|
||||
#### --load_images
|
||||
Flag to load source dataset images to be displayed in the top view for each camera.
|
||||
</details>
|
||||
<br>
|
||||
|
||||
### Running the Real-Time Viewer
|
||||
|
||||
|
||||
|
||||
|
||||
https://github.com/graphdeco-inria/gaussian-splatting/assets/40643808/0940547f-1d82-4c2f-a616-44eabbf0f816
|
||||
|
||||
|
||||
|
||||
|
||||
After extracting or installing the viewers, you may run the compiled ```SIBR_gaussianViewer_app[_config]``` app in ```<SIBR install dir>/bin```, e.g.:
|
||||
```shell
|
||||
./<SIBR install dir>/bin/SIBR_gaussianViewer_app -m <path to trained model>
|
||||
```
|
||||
|
||||
It should suffice to provide the ```-m``` parameter pointing to a trained model directory. Alternatively, you can specify an override location for training input data using ```-s```. To use a specific resolution other than the auto-chosen one, specify ```--rendering-size <width> <height>```. Combine it with ```--force-aspect-ratio``` if you want the exact resolution and don't mind image distortion.
|
||||
|
||||
**To unlock the full frame rate, please disable V-Sync on your machine and also in the application (Menu → Display). In a multi-GPU system (e.g., laptop) your OpenGL/Display GPU should be the same as your CUDA GPU (e.g., by setting the application's GPU preference on Windows, see below) for maximum performance.**
|
||||
|
||||

|
||||
|
||||
In addition to the initial point cloud and the splats, you also have the option to visualize the Gaussians by rendering them as ellipsoids from the floating menu.
|
||||
SIBR has many other functionalities, please see the [documentation](https://sibr.gitlabpages.inria.fr/) for more details on the viewer, navigation options etc. There is also a Top View (available from the menu) that shows the placement of the input cameras and the original SfM point cloud; please note that Top View slows rendering when enabled. The real-time viewer also uses slightly more aggressive, fast culling, which can be toggled in the floating menu. If you ever encounter an issue that can be solved by turning fast culling off, please let us know.
|
||||
|
||||
<details>
|
||||
<summary><span style="font-weight: bold;">Primary Command Line Arguments for Real-Time Viewer</span></summary>
|
||||
|
||||
#### --model-path / -m
|
||||
Path to trained model.
|
||||
#### --iteration
|
||||
Specifies which of state to load if multiple are available. Defaults to latest available iteration.
|
||||
#### --path / -s
|
||||
Argument to override model's path to source dataset.
|
||||
#### --rendering-size
|
||||
Takes two space separated numbers to define the resolution at which real-time rendering occurs, ```1200``` width by default. Note that to enforce an aspect that differs from the input images, you need ```--force-aspect-ratio``` too.
|
||||
#### --load_images
|
||||
Flag to load source dataset images to be displayed in the top view for each camera.
|
||||
#### --device
|
||||
Index of CUDA device to use for rasterization if multiple are available, ```0``` by default.
|
||||
#### --no_interop
|
||||
Disables CUDA/GL interop forcibly. Use on systems that may not behave according to spec (e.g., WSL2 with MESA GL 4.5 software rendering).
|
||||
</details>
|
||||
<br>
|
||||
|
||||
## Processing your own Scenes
|
||||
|
||||
Our COLMAP loaders expect the following dataset structure in the source path location:
|
||||
|
||||
```
|
||||
<location>
|
||||
|---images
|
||||
| |---<image 0>
|
||||
| |---<image 1>
|
||||
| |---...
|
||||
|---sparse
|
||||
|---0
|
||||
|---cameras.bin
|
||||
|---images.bin
|
||||
|---points3D.bin
|
||||
```
|
||||
|
||||
For rasterization, the camera models must be either a SIMPLE_PINHOLE or PINHOLE camera. We provide a converter script ```convert.py```, to extract undistorted images and SfM information from input images. Optionally, you can use ImageMagick to resize the undistorted images. This rescaling is similar to MipNeRF360, i.e., it creates images with 1/2, 1/4 and 1/8 the original resolution in corresponding folders. To use them, please first install a recent version of COLMAP (ideally CUDA-powered) and ImageMagick. Put the images you want to use in a directory ```<location>/input```.
|
||||
```
|
||||
<location>
|
||||
|---input
|
||||
|---<image 0>
|
||||
|---<image 1>
|
||||
|---...
|
||||
```
|
||||
If you have COLMAP and ImageMagick on your system path, you can simply run
|
||||
```shell
|
||||
python convert.py -s <location> [--resize] #If not resizing, ImageMagick is not needed
|
||||
```
|
||||
Alternatively, you can use the optional parameters ```--colmap_executable``` and ```--magick_executable``` to point to the respective paths. Please note that on Windows, the executable should point to the COLMAP ```.bat``` file that takes care of setting the execution environment. Once done, ```<location>``` will contain the expected COLMAP data set structure with undistorted, resized input images, in addition to your original images and some temporary (distorted) data in the directory ```distorted```.
|
||||
|
||||
If you have your own COLMAP dataset without undistortion (e.g., using ```OPENCV``` camera), you can try to just run the last part of the script: Put the images in ```input``` and the COLMAP info in a subdirectory ```distorted```:
|
||||
```
|
||||
<location>
|
||||
|---input
|
||||
| |---<image 0>
|
||||
| |---<image 1>
|
||||
| |---...
|
||||
|---distorted
|
||||
|---database.db
|
||||
|---sparse
|
||||
|---0
|
||||
|---...
|
||||
```
|
||||
Then run
|
||||
```shell
|
||||
python convert.py -s <location> --skip_matching [--resize] #If not resizing, ImageMagick is not needed
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary><span style="font-weight: bold;">Command Line Arguments for convert.py</span></summary>
|
||||
|
||||
#### --no_gpu
|
||||
Flag to avoid using GPU in COLMAP.
|
||||
#### --skip_matching
|
||||
Flag to indicate that COLMAP info is available for images.
|
||||
#### --source_path / -s
|
||||
Location of the inputs.
|
||||
#### --camera
|
||||
Which camera model to use for the early matching steps, ```OPENCV``` by default.
|
||||
#### --resize
|
||||
Flag for creating resized versions of input images.
|
||||
#### --colmap_executable
|
||||
Path to the COLMAP executable (```.bat``` on Windows).
|
||||
#### --magick_executable
|
||||
Path to the ImageMagick executable.
|
||||
</details>
|
||||
<br>
|
||||
|
||||
### OpenXR support
|
||||
|
||||
OpenXR is supported in the branch gaussian_code_release_openxr
|
||||
Within that branch, you can find documentation for VR support [here](https://gitlab.inria.fr/sibr/sibr_core/-/tree/gaussian_code_release_openxr?ref_type=heads).
|
||||
|
||||
## FAQ
|
||||
- *Where do I get data sets, e.g., those referenced in ```full_eval.py```?* The MipNeRF360 data set is provided by the authors of the original paper on the project site. Note that two of the data sets cannot be openly shared and require you to consult the authors directly. For Tanks&Temples and Deep Blending, please use the download links provided at the top of the page. Alternatively, you may access the cloned data (status: August 2023!) from [HuggingFace](https://huggingface.co/camenduru/gaussian-splatting)
|
||||
|
||||
|
||||
- *How can I use this for a much larger dataset, like a city district?* The current method was not designed for these, but given enough memory, it should work out. However, the approach can struggle in multi-scale detail scenes (extreme close-ups, mixed with far-away shots). This is usually the case in, e.g., driving data sets (cars close up, buildings far away). For such scenes, you can lower the ```--position_lr_init```, ```--position_lr_final``` and ```--scaling_lr``` (x0.3, x0.1, ...). The more extensive the scene, the lower these values should be. Below, we use default learning rates (left) and ```--position_lr_init 0.000016 --scaling_lr 0.001"``` (right).
|
||||
|
||||
|  <!-- --> | <!-- -->  |
|
||||
| --- | --- |
|
||||
|
||||
- *I'm on Windows and I can't manage to build the submodules, what do I do?* Consider following the steps in the excellent video tutorial [here](https://www.youtube.com/watch?v=UXtuigy_wYc), hopefully they should help. The order in which the steps are done is important! Alternatively, consider using the linked Colab template.
|
||||
|
||||
- *It still doesn't work. It says something about ```cl.exe```. What do I do?* User Henry Pearce found a workaround. You can you try adding the visual studio path to your environment variables (your version number might differ);
|
||||
```C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64```
|
||||
Then make sure you start a new conda prompt and cd to your repo location and try this;
|
||||
```
|
||||
conda activate gaussian_splatting
|
||||
cd <dir_to_repo>/gaussian-splatting
|
||||
pip install submodules\diff-gaussian-rasterization
|
||||
pip install submodules\simple-knn
|
||||
```
|
||||
|
||||
- *I'm on macOS/Puppy Linux/Greenhat and I can't manage to build, what do I do?* Sorry, we can't provide support for platforms outside of the ones we list in this README. Consider using the linked Colab template.
|
||||
|
||||
- *I don't have 24 GB of VRAM for training, what do I do?* The VRAM consumption is determined by the number of points that are being optimized, which increases over time. If you only want to train to 7k iterations, you will need significantly less. To do the full training routine and avoid running out of memory, you can increase the ```--densify_grad_threshold```, ```--densification_interval``` or reduce the value of ```--densify_until_iter```. Note however that this will affect the quality of the result. Also try setting ```--test_iterations``` to ```-1``` to avoid memory spikes during testing. If ```--densify_grad_threshold``` is very high, no densification should occur and training should complete if the scene itself loads successfully.
|
||||
|
||||
- *24 GB of VRAM for reference quality training is still a lot! Can't we do it with less?* Yes, most likely. By our calculations it should be possible with **way** less memory (~8GB). If we can find the time we will try to achieve this. If some PyTorch veteran out there wants to tackle this, we look forward to your pull request!
|
||||
|
||||
|
||||
- *How can I use the differentiable Gaussian rasterizer for my own project?* Easy, it is included in this repo as a submodule ```diff-gaussian-rasterization```. Feel free to check out and install the package. It's not really documented, but using it from the Python side is very straightforward (cf. ```gaussian_renderer/__init__.py```).
|
||||
|
||||
- *Wait, but ```<insert feature>``` isn't optimized and could be much better?* There are several parts we didn't even have time to think about improving (yet). The performance you get with this prototype is probably a rather slow baseline for what is physically possible.
|
||||
|
||||
- *Something is broken, how did this happen?* We tried hard to provide a solid and comprehensible basis to make use of the paper's method. We have refactored the code quite a bit, but we have limited capacity to test all possible usage scenarios. Thus, if part of the website, the code or the performance is lacking, please create an issue. If we find the time, we will do our best to address it.
|
||||
|
@ -53,7 +53,9 @@ class ModelParams(ParamGroup):
|
||||
self._resolution = -1
|
||||
self._white_background = False
|
||||
self.data_device = "cuda"
|
||||
self.eval = False
|
||||
self.eval = True
|
||||
self.cap_max = -1
|
||||
self.init_type = "random"
|
||||
super().__init__(parser, "Loading Parameters", sentinel)
|
||||
|
||||
def extract(self, args):
|
||||
@ -84,9 +86,12 @@ class OptimizationParams(ParamGroup):
|
||||
self.densification_interval = 100
|
||||
self.opacity_reset_interval = 3000
|
||||
self.densify_from_iter = 500
|
||||
self.densify_until_iter = 15_000
|
||||
self.densify_until_iter = 25_000
|
||||
self.densify_grad_threshold = 0.0002
|
||||
self.random_background = False
|
||||
self.noise_lr = 5e5
|
||||
self.scale_reg = 0.01
|
||||
self.opacity_reg = 0.01
|
||||
super().__init__(parser, "Optimization Parameters")
|
||||
|
||||
def get_combined_args(parser : ArgumentParser):
|
||||
|
BIN
docs/.DS_Store
vendored
Normal file
BIN
docs/.DS_Store
vendored
Normal file
Binary file not shown.
287
docs/index.html
Normal file
287
docs/index.html
Normal file
@ -0,0 +1,287 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<link rel="stylesheet" href="./resources/css/bulma.min.css" />
|
||||
<link rel="stylesheet" href="./resources/css/slide.css" />
|
||||
<link rel="stylesheet" href="./resources/css/bulma-carousel.min.css" />
|
||||
<link rel="stylesheet" href="./resources/css/bulma-slider.min.css" />
|
||||
<link rel="stylesheet" href="./resources/css/fontawesome.all.min.css" />
|
||||
<link rel="stylesheet" href="./resources/css/carasoul.css" />
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/gh/jpswalsh/academicons@1/css/academicons.min.css"
|
||||
/>
|
||||
<link rel="stylesheet" href="./resources/css/index.css" />
|
||||
<link rel="icon" href="./resources/images/favicon.svg" />
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"
|
||||
/>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
href="./resources/css/style.css"
|
||||
media="screen"
|
||||
/>
|
||||
<link rel="stylesheet" href="resources/css/dics.original.css" />
|
||||
|
||||
<title>3D Gaussian Splatting as Markov Chain Monte Carlo</title>
|
||||
<meta
|
||||
property="og:title"
|
||||
content="3D Gaussian Splatting as Markov Chain Monte Carlo"
|
||||
/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
|
||||
<style>
|
||||
body {
|
||||
text-align: center;
|
||||
background-color: #f0f0f0; /* Optional: Set a background color for better visibility */
|
||||
}
|
||||
.larger-arrow {
|
||||
font-size: 2em; /* Adjust the font size as needed */
|
||||
letter-spacing: 4em; /* Adjust the letter spacing as needed */
|
||||
display: inline-block; /* Ensures text-align works */
|
||||
}
|
||||
.tbl_video {
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
</style>
|
||||
<script src="resources/js/video_comparison.js"></script>
|
||||
<script src="resources/js/dics.original.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="title">
|
||||
3D Gaussian Splatting as Markov Chain Monte Carlo
|
||||
</div>
|
||||
|
||||
<div class="container is-max-desktop">
|
||||
<div class="columns is-centered">
|
||||
<div class="column has-text-centered">
|
||||
<div class="is-size-5 publication-authors">
|
||||
<span class="author-block">
|
||||
<a href="https://shakibakh.github.io/">Shakiba Kheradmand</a
|
||||
><sup>1</sup>,</span
|
||||
>
|
||||
<span class="author-block">
|
||||
<a href="http://drebain.com/"> Daniel Rebain</a
|
||||
><sup>1</sup>,</span
|
||||
>
|
||||
<span class="author-block">
|
||||
<a href="https://hippogriff.github.io/"> Gopal Sharma</a
|
||||
><sup>1</sup>,</span
|
||||
>
|
||||
<span class="author-block">
|
||||
<a href="http://www.hossamisack.com/">Hossam Isack</a
|
||||
><sup>2</sup>,
|
||||
</span>
|
||||
<span class="author-block">
|
||||
<a href="https://abhishekkar.info/">Abhishek Kar</a><sup>2</sup>
|
||||
</span>
|
||||
<br />
|
||||
<span class="author-block">
|
||||
<a href="https://taiya.github.io/">Andrea Tagliasacchi</a
|
||||
><sup>3, 4, 5</sup>
|
||||
</span>
|
||||
<span class="author-block">
|
||||
<a href="https://www.cs.ubc.ca/~kmyi/">Kwang Moo Yi</a
|
||||
><sup>1</sup>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="is-size-5 publication-authors">
|
||||
<span class="author-block"
|
||||
><sup>1</sup>University of British Columbia</span
|
||||
>
|
||||
<span class="author-block"><sup>2</sup>Google Research</span>
|
||||
<span class="author-block"><sup>3</sup>Google DeepMind</span>
|
||||
<br />
|
||||
<span class="author-block"
|
||||
><sup>4</sup>Simon Fraser University</span
|
||||
>
|
||||
<span class="author-block"
|
||||
><sup>5</sup>University of Toronto</span
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="column has-text-centered">
|
||||
<div class="publication-links">
|
||||
<!-- Paper Link. -->
|
||||
<span class="link-block">
|
||||
<!-- <a href="https://arxiv.org/abs/2404.09591" class="external-link button is-normal is-rounded is-dark"> -->
|
||||
<a
|
||||
href="paper.pdf"
|
||||
class="external-link button is-normal is-rounded is-dark"
|
||||
>
|
||||
<span class="icon">
|
||||
<i class="fa fa-file-o"></i>
|
||||
</span>
|
||||
<span>Paper</span>
|
||||
</a>
|
||||
</span>
|
||||
<!-- Code Link. -->
|
||||
<span class="link-block">
|
||||
<a
|
||||
href="https://github.com/ubc-vision/3dgs-mcmc"
|
||||
class="external-link button is-normal is-rounded is-dark"
|
||||
>
|
||||
<span class="icon">
|
||||
<svg
|
||||
class="svg-inline--fa fa-github fa-w-16"
|
||||
aria-hidden="true"
|
||||
focusable="false"
|
||||
data-prefix="fab"
|
||||
data-icon="github"
|
||||
role="img"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 496 512"
|
||||
data-fa-i2svg=""
|
||||
>
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"
|
||||
></path></svg
|
||||
><!-- <i class="fab fa-github"></i> Font Awesome fontawesome.com -->
|
||||
</span>
|
||||
<span>Code</span>
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="parent-video-compare-container">
|
||||
<hr />
|
||||
</div>
|
||||
|
||||
<div class="parent-video-compare-container">
|
||||
<div class="video-compare-container" id="materialsDiv">
|
||||
<video
|
||||
class="video"
|
||||
id="materials"
|
||||
loop
|
||||
playsinline
|
||||
autoplay
|
||||
muted
|
||||
src="./resources/training_rand_compare/bicycle_both-rand.mp4"
|
||||
onplay="resizeAndPlay(this)"
|
||||
></video>
|
||||
<canvas height="0" class="videoMerge" id="materialsMerge"></canvas>
|
||||
</div>
|
||||
<br>
|
||||
<p class="justified">
|
||||
Novel view reconstructions for <strong>(right) our method</strong>
|
||||
and <strong>(left) conventional</strong> 3D Gaussian Splatting with
|
||||
random initializations. Our method, even with random initialization,
|
||||
faithfully reconstructs the scene (e.g.. buildings at the back and
|
||||
the ground texture) providing much higher quality renderings.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="parent-video-compare-container">
|
||||
<hr />
|
||||
</div>
|
||||
|
||||
<h1>Abstract</h1>
|
||||
<div class="parent-video-compare-container">
|
||||
<p class="justified">
|
||||
While 3D Gaussian Splatting has recently become popular for neural
|
||||
rendering, current methods rely on carefully engineered cloning and
|
||||
splitting strategies for placing Gaussians, which can lead to
|
||||
poor-quality renderings, and reliance on a good initialization. In
|
||||
this work, we rethink the set of 3D Gaussians as a random sample
|
||||
drawn from an underlying probability distribution describing the
|
||||
physical representation of the scene---in other words, Markov Chain
|
||||
Monte Carlo (MCMC) samples. Under this view, we show that the 3D
|
||||
Gaussian updates can be converted as Stochastic Gradient Langevin
|
||||
Dynamics (SGLD) update by simply introducing noise. We then rewrite
|
||||
the densification and pruning strategies in 3D Gaussian Splatting as
|
||||
simply a deterministic state transition of MCMC samples, removing
|
||||
these heuristics from the framework. To do so, we revise the
|
||||
`cloning' of Gaussians into a relocalization scheme that
|
||||
approximately preserves sample probability. To encourage efficient
|
||||
use of Gaussians, we introduce a regularizer that promotes the
|
||||
removal of unused Gaussians. On various standard evaluation scenes,
|
||||
we show that our method provides improved rendering quality, easy
|
||||
control over the number of Gaussians, and robustness to
|
||||
initialization.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="parent-video-compare-container">
|
||||
<hr />
|
||||
</div>
|
||||
|
||||
<h1>More Results</h1>
|
||||
|
||||
<div class="parent-video-compare-container">
|
||||
<table class="tbl_video" style="width:100%;"">
|
||||
<tr>
|
||||
<td colspan="4" style="background-color: #d1c4ce; font-size: 20px">
|
||||
'10' sequence from OMMO dataset
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="50%" style="font-size: 18px">3DGS-Random</td>
|
||||
<td width="50%" style="font-size: 18px">3DGS</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<video
|
||||
class="kitti360"
|
||||
id="00"
|
||||
width="95%"
|
||||
preload="auto"
|
||||
playsinline
|
||||
webkit-playsinline
|
||||
loop
|
||||
autoplay
|
||||
muted
|
||||
>
|
||||
<source src="resources/10/10.mp4" type="video/mp4" />
|
||||
</video>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="50%" style="font-size: 18px">Ours-Random</td>
|
||||
<td width="50%" style="font-size: 18px">Ours</td>
|
||||
</tr>
|
||||
|
||||
<table class="tbl_video" style="width:100%;"">
|
||||
<tr>
|
||||
<td colspan="4" style="background-color: #d1c4ce; font-size: 20px">
|
||||
'Stump' sequence from the MipNeRF360 dataset (pay attention to the
|
||||
details between the leaves)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="50%" style="font-size: 18px">3DGS-Random</td>
|
||||
<td width="50%" style="font-size: 18px">3DGS</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<video
|
||||
class="kitti360"
|
||||
id="00"
|
||||
width="95%"
|
||||
preload="auto"
|
||||
playsinline
|
||||
webkit-playsinline
|
||||
loop
|
||||
autoplay
|
||||
muted
|
||||
>
|
||||
<source src="resources/stump/stump.mp4" type="video/mp4" />
|
||||
</video>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="50%" style="font-size: 18px">Ours-Random</td>
|
||||
<td width="50%" style="font-size: 18px">Ours</td>
|
||||
</tr>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
BIN
docs/paper.pdf
Normal file
BIN
docs/paper.pdf
Normal file
Binary file not shown.
BIN
docs/resources/10/10.mp4
Normal file
BIN
docs/resources/10/10.mp4
Normal file
Binary file not shown.
1
docs/resources/css/bulma-carousel.min.css
vendored
Normal file
1
docs/resources/css/bulma-carousel.min.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
@-webkit-keyframes spinAround{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes spinAround{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.slider{position:relative;width:100%}.slider-container{display:flex;flex-wrap:nowrap;flex-direction:row;overflow:hidden;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);min-height:100%}.slider-container.is-vertical{flex-direction:column}.slider-container .slider-item{flex:none}.slider-container .slider-item .image.is-covered img{-o-object-fit:cover;object-fit:cover;-o-object-position:center center;object-position:center center;height:100%;width:100%}.slider-container .slider-item .video-container{height:0;padding-bottom:0;padding-top:56.25%;margin:0;position:relative}.slider-container .slider-item .video-container.is-1by1,.slider-container .slider-item .video-container.is-square{padding-top:100%}.slider-container .slider-item .video-container.is-4by3{padding-top:75%}.slider-container .slider-item .video-container.is-21by9{padding-top:42.857143%}.slider-container .slider-item .video-container embed,.slider-container .slider-item .video-container iframe,.slider-container .slider-item .video-container object{position:absolute;top:0;left:0;width:100%!important;height:100%!important}.slider-navigation-next,.slider-navigation-previous{display:flex;justify-content:center;align-items:center;position:absolute;width:42px;height:42px;background:#fff center center no-repeat;background-size:20px 20px;border:1px solid #fff;border-radius:25091983px;box-shadow:0 2px 5px #3232321a;top:50%;margin-top:-20px;left:0;cursor:pointer;transition:opacity .3s,-webkit-transform .3s;transition:transform .3s,opacity .3s;transition:transform .3s,opacity .3s,-webkit-transform .3s}.slider-navigation-next:hover,.slider-navigation-previous:hover{-webkit-transform:scale(1.2);transform:scale(1.2)}.slider-navigation-next.is-hidden,.slider-navigation-previous.is-hidden{display:none;opacity:0}.slider-navigation-next svg,.slider-navigation-previous svg{width:25%}.slider-navigation-next{left:auto;right:0;background:#fff center center no-repeat;background-size:20px 20px}.slider-pagination{display:none;justify-content:center;align-items:center;position:absolute;bottom:0;left:0;right:0;padding:.5rem 1rem;text-align:center}.slider-pagination .slider-page{background:#fff;width:10px;height:10px;border-radius:25091983px;display:inline-block;margin:0 3px;box-shadow:0 2px 5px #3232321a;transition:-webkit-transform .3s;transition:transform .3s;transition:transform .3s,-webkit-transform .3s;cursor:pointer}.slider-pagination .slider-page.is-active,.slider-pagination .slider-page:hover{-webkit-transform:scale(1.4);transform:scale(1.4)}@media screen and (min-width:800px){.slider-pagination{display:flex}}.hero.has-carousel{position:relative}.hero.has-carousel+.hero-body,.hero.has-carousel+.hero-footer,.hero.has-carousel+.hero-head{z-index:10;overflow:hidden}.hero.has-carousel .hero-carousel{position:absolute;top:0;left:0;bottom:0;right:0;height:auto;border:none;margin:auto;padding:0;z-index:0}.hero.has-carousel .hero-carousel .slider{width:100%;max-width:100%;overflow:hidden;height:100%!important;max-height:100%;z-index:0}.hero.has-carousel .hero-carousel .slider .has-background{max-height:100%}.hero.has-carousel .hero-carousel .slider .has-background .is-background{-o-object-fit:cover;object-fit:cover;-o-object-position:center center;object-position:center center;height:100%;width:100%}.hero.has-carousel .hero-body{margin:0 3rem;z-index:10}
|
1
docs/resources/css/bulma-slider.min.css
vendored
Normal file
1
docs/resources/css/bulma-slider.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
docs/resources/css/bulma.css.map.txt
Normal file
1
docs/resources/css/bulma.css.map.txt
Normal file
File diff suppressed because one or more lines are too long
1
docs/resources/css/bulma.min.css
vendored
Normal file
1
docs/resources/css/bulma.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
0
docs/resources/css/carasoul.css
Normal file
0
docs/resources/css/carasoul.css
Normal file
191
docs/resources/css/dics.original.css
Normal file
191
docs/resources/css/dics.original.css
Normal file
@ -0,0 +1,191 @@
|
||||
.b-dics {
|
||||
width : 100%;
|
||||
max-width : 100%;
|
||||
position : relative;
|
||||
overflow : hidden;
|
||||
display : flex;
|
||||
opacity : 0;
|
||||
}
|
||||
|
||||
.b-dics__section {
|
||||
height : 100%;
|
||||
}
|
||||
|
||||
.b-dics__slider:hover :before {
|
||||
color : #FFFFFF;
|
||||
border-color : #FFFFFF;
|
||||
}
|
||||
|
||||
.b-dics__text {
|
||||
position : absolute;
|
||||
top : 0;
|
||||
left : 50%;
|
||||
padding : 5px 25px;
|
||||
transform : translateX(-50%);
|
||||
background : #FFFFFF;
|
||||
z-index : 11;
|
||||
font-family : Arial, serif;
|
||||
color : #3d3d3d;
|
||||
user-select : none;
|
||||
font-size : 13px;
|
||||
text-align : center;
|
||||
margin : 16px 0;
|
||||
white-space : nowrap;
|
||||
opacity : .7;
|
||||
pointer-events : none;
|
||||
}
|
||||
|
||||
.b-dics__image-container {
|
||||
width : 100%;
|
||||
height : 100%;
|
||||
display : block;
|
||||
overflow : hidden;
|
||||
position : relative;
|
||||
}
|
||||
|
||||
.b-dics__image {
|
||||
height : 100%;
|
||||
position : absolute;
|
||||
left : 0;
|
||||
top : 50%;
|
||||
transform : translateY(-50%);
|
||||
user-select : none;
|
||||
max-width : none;
|
||||
}
|
||||
|
||||
.b-dics__slider {
|
||||
color : #FFFFFF;
|
||||
position : absolute;
|
||||
left : 100%;
|
||||
top : 0;
|
||||
cursor : pointer;
|
||||
transform : translateX(-50%);
|
||||
height : 100%;
|
||||
width : 3px;
|
||||
padding : 0 30px;
|
||||
z-index : 1;
|
||||
touch-action : none;
|
||||
line-height : normal;
|
||||
opacity : .7;
|
||||
}
|
||||
|
||||
.b-dics__slider:before {
|
||||
content : '';
|
||||
-webkit-mask : url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNTEyIDUxMjsiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+LnN0MHtmaWxsOiNGRkZGRkY7ZW5hYmxlLWJhY2tncm91bmQ6bmV3ICAgIDt9PC9zdHlsZT48cGF0aCBjbGFzcz0ic3QwIiBkPSJNMTgwLjIsMTA4LjFsNjEuNy02Mi4yYzMuOC0zLjgsOC44LTUuOSwxNC4xLTUuOWM1LjMsMCwxMC40LDIuMSwxNC4xLDUuOWw2MS43LDYyLjJjMy45LDMuOSw5LjEsNS45LDE0LjIsNS45czEwLjItMS45LDE0LjEtNS44YzcuOC03LjgsNy45LTIwLjQsMC4xLTI4LjNsLTYxLjctNjIuMkMyODcuMiw2LjMsMjcyLjEsMCwyNTYsMHMtMzEuMiw2LjMtNDIuNSwxNy44TDE1MS44LDgwYy03LjgsNy44LTcuNywyMC41LDAuMSwyOC4zQzE1OS44LDExNiwxNzIuNCwxMTUuOSwxODAuMiwxMDguMXoiLz48cGF0aCBjbGFzcz0ic3QwIiBkPSJNMzMxLjgsNDAzLjlsLTYxLjcsNjIuMmMtMy44LDMuOC04LjgsNS45LTE0LjEsNS45Yy01LjMsMC0xMC40LTIuMS0xNC4xLTUuOWwtNjEuNy02Mi4yYy03LjgtNy44LTIwLjQtNy45LTI4LjMtMC4xYy03LjgsNy44LTcuOSwyMC40LTAuMSwyOC4zbDYxLjcsNjIuMmMxMS40LDExLjQsMjYuNSwxNy44LDQyLjUsMTcuOHMzMS4yLTYuMyw0Mi41LTE3LjhsNjEuNy02Mi4yYzcuOC03LjgsNy43LTIwLjUtMC4xLTI4LjNDMzUyLjIsMzk2LDMzOS42LDM5Ni4xLDMzMS44LDQwMy45eiIvPjwvc3ZnPg==) no-repeat 100% 100%;
|
||||
mask : url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNTEyIDUxMjsiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+LnN0MHtmaWxsOiNGRkZGRkY7ZW5hYmxlLWJhY2tncm91bmQ6bmV3ICAgIDt9PC9zdHlsZT48cGF0aCBjbGFzcz0ic3QwIiBkPSJNMTgwLjIsMTA4LjFsNjEuNy02Mi4yYzMuOC0zLjgsOC44LTUuOSwxNC4xLTUuOWM1LjMsMCwxMC40LDIuMSwxNC4xLDUuOWw2MS43LDYyLjJjMy45LDMuOSw5LjEsNS45LDE0LjIsNS45czEwLjItMS45LDE0LjEtNS44YzcuOC03LjgsNy45LTIwLjQsMC4xLTI4LjNsLTYxLjctNjIuMkMyODcuMiw2LjMsMjcyLjEsMCwyNTYsMHMtMzEuMiw2LjMtNDIuNSwxNy44TDE1MS44LDgwYy03LjgsNy44LTcuNywyMC41LDAuMSwyOC4zQzE1OS44LDExNiwxNzIuNCwxMTUuOSwxODAuMiwxMDguMXoiLz48cGF0aCBjbGFzcz0ic3QwIiBkPSJNMzMxLjgsNDAzLjlsLTYxLjcsNjIuMmMtMy44LDMuOC04LjgsNS45LTE0LjEsNS45Yy01LjMsMC0xMC40LTIuMS0xNC4xLTUuOWwtNjEuNy02Mi4yYy03LjgtNy44LTIwLjQtNy45LTI4LjMtMC4xYy03LjgsNy44LTcuOSwyMC40LTAuMSwyOC4zbDYxLjcsNjIuMmMxMS40LDExLjQsMjYuNSwxNy44LDQyLjUsMTcuOHMzMS4yLTYuMyw0Mi41LTE3LjhsNjEuNy02Mi4yYzcuOC03LjgsNy43LTIwLjUtMC4xLTI4LjNDMzUyLjIsMzk2LDMzOS42LDM5Ni4xLDMzMS44LDQwMy45eiIvPjwvc3ZnPg==) no-repeat 100% 100%;
|
||||
mask-size : cover;
|
||||
-webkit-mask-size : cover;
|
||||
width : 26px;
|
||||
height : 26px;
|
||||
padding : 0;
|
||||
background-color : currentColor;
|
||||
position : absolute;
|
||||
top : 50%;
|
||||
left : 50%;
|
||||
transform : translate(-50%, -50%) rotate(90deg);
|
||||
z-index : 2;
|
||||
font-size : 0;
|
||||
}
|
||||
|
||||
.b-dics__slider:after {
|
||||
content : '';
|
||||
position : absolute;
|
||||
left : 50%;
|
||||
top : 0;
|
||||
transform : translateX(-50%);
|
||||
height : 100%;
|
||||
width : 3px;
|
||||
background-color : currentColor;
|
||||
z-index : 1;
|
||||
}
|
||||
|
||||
.b-dics__image-container:hover .b-dics__text {
|
||||
opacity : 1;
|
||||
}
|
||||
|
||||
.b-dics__slider:hover {
|
||||
opacity : 1;
|
||||
}
|
||||
|
||||
/* Text Position
|
||||
****************************************************************************/
|
||||
|
||||
.b-dics--tp-center .b-dics__text {
|
||||
top : 50%;
|
||||
transform : translate(-50%, -50%);
|
||||
margin : 0;
|
||||
}
|
||||
|
||||
.b-dics--tp-bottom .b-dics__text {
|
||||
top : initial;
|
||||
bottom : 0;
|
||||
transform : translate(-50%, -50%);
|
||||
}
|
||||
|
||||
.b-dics--tp-left .b-dics__text {
|
||||
left : 0;
|
||||
top : 50%;
|
||||
transform : translateY(-50%);
|
||||
margin : 0 16px;
|
||||
}
|
||||
|
||||
.b-dics--tp-right .b-dics__text {
|
||||
left : initial;
|
||||
right : 0;
|
||||
top : 50%;
|
||||
transform : translateY(-50%);
|
||||
margin : 0 16px;
|
||||
}
|
||||
|
||||
/* Hide texts
|
||||
****************************************************************************/
|
||||
|
||||
.b-dics--hide-texts .b-dics__text {
|
||||
background : #ffffff;
|
||||
opacity : 0;
|
||||
}
|
||||
|
||||
.b-dics--hide-texts .b-dics__image-container:hover .b-dics__text {
|
||||
opacity : 1;
|
||||
}
|
||||
|
||||
/* Vertical Sliders
|
||||
****************************************************************************/
|
||||
|
||||
.b-dics--vertical {
|
||||
flex-direction : column;
|
||||
}
|
||||
|
||||
.b-dics--vertical .b-dics__section {
|
||||
height : auto;
|
||||
width : 100%;
|
||||
}
|
||||
|
||||
.b-dics--vertical .b-dics__image {
|
||||
left : 50%;
|
||||
transform : translateX(-50%);
|
||||
top : 0;
|
||||
width : 100%;
|
||||
height : auto;
|
||||
}
|
||||
|
||||
.b-dics--vertical .b-dics__slider {
|
||||
top : 100%;
|
||||
transform : translateY(-50%);
|
||||
width : 100%;
|
||||
height : 3px;
|
||||
padding : 30px 0;
|
||||
left : 0;
|
||||
}
|
||||
|
||||
.b-dics--vertical .b-dics__slider:after {
|
||||
top : 50%;
|
||||
left : 0;
|
||||
transform : translateY(-50%);
|
||||
width : 100%;
|
||||
height : 3px;
|
||||
}
|
||||
|
||||
.b-dics--vertical .b-dics__slider:before {
|
||||
transform : translate(-50%, -50%);
|
||||
}
|
5
docs/resources/css/fontawesome.all.min.css
vendored
Normal file
5
docs/resources/css/fontawesome.all.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
286
docs/resources/css/index.css
Normal file
286
docs/resources/css/index.css
Normal file
@ -0,0 +1,286 @@
|
||||
body {
|
||||
font-family: "Noto Sans", sans-serif;
|
||||
}
|
||||
|
||||
.footer .icon-link {
|
||||
font-size: 25px;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.link-block a {
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.dnerf {
|
||||
font-variant: small-caps;
|
||||
}
|
||||
|
||||
.teaser .hero-body {
|
||||
padding-top: 0;
|
||||
padding-bottom: 3rem;
|
||||
}
|
||||
|
||||
.teaser {
|
||||
font-family: "Google Sans", sans-serif;
|
||||
}
|
||||
|
||||
.publication-title {
|
||||
}
|
||||
|
||||
.publication-banner {
|
||||
max-height: parent;
|
||||
}
|
||||
|
||||
.publication-banner video {
|
||||
position: relative;
|
||||
left: auto;
|
||||
top: auto;
|
||||
transform: none;
|
||||
object-fit: fit;
|
||||
}
|
||||
|
||||
.publication-header .hero-body {
|
||||
}
|
||||
|
||||
.publication-title {
|
||||
font-family: "Google Sans", sans-serif;
|
||||
}
|
||||
|
||||
.publication-authors {
|
||||
font-family: "Google Sans", sans-serif;
|
||||
}
|
||||
|
||||
.neurips-acceptance-notice {
|
||||
font-weight: bold;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.publication-venue {
|
||||
color: #555;
|
||||
width: fit-content;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.publication-awards {
|
||||
color: #ff3860;
|
||||
width: fit-content;
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
.publication-authors {
|
||||
}
|
||||
|
||||
.publication-authors a {
|
||||
color: hsl(204, 86%, 53%) !important;
|
||||
}
|
||||
|
||||
.publication-authors a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.author-block {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.publication-banner img {
|
||||
}
|
||||
|
||||
.publication-authors {
|
||||
/*color: #4286f4;*/
|
||||
}
|
||||
|
||||
.publication-video {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 0;
|
||||
padding-bottom: 56.25%;
|
||||
|
||||
overflow: hidden;
|
||||
border-radius: 10px !important;
|
||||
}
|
||||
|
||||
.publication-video iframe {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.publication-body img {
|
||||
}
|
||||
|
||||
.results-carousel {
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.results-carousel .item {
|
||||
flex: 0 0 100%;
|
||||
max-width: 100%;
|
||||
margin: 5px;
|
||||
overflow: hidden;
|
||||
border: 1px solid #bbb;
|
||||
border-radius: 10px;
|
||||
padding: 0;
|
||||
font-size: 0;
|
||||
}
|
||||
|
||||
.results-carousel video {
|
||||
margin: 0;
|
||||
width: 100%; /* Make the video fill the width of the container */
|
||||
height: auto;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.carousel-caption p {
|
||||
text-align: center;
|
||||
margin-top: 10px; /* Adjust as needed */
|
||||
margin-bottom: 10px; /* Adjust as needed */
|
||||
font-size: 16px; /* Adjust as needed */
|
||||
color: #333; /* Adjust as needed */
|
||||
}
|
||||
|
||||
.interpolation-panel {
|
||||
background: #f5f5f5;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.interpolation-panel .interpolation-image {
|
||||
width: 100%;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.interpolation-video-column {
|
||||
}
|
||||
|
||||
.interpolation-panel .slider {
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
.interpolation-panel .slider {
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
#interpolation-image-wrapper {
|
||||
width: 100%;
|
||||
}
|
||||
#interpolation-image-wrapper img {
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.hero.teaser {
|
||||
flex: 1; /* Each section takes equal width */
|
||||
text-align: center; /* Center the text */
|
||||
}
|
||||
|
||||
.videos-container {
|
||||
display: flex;
|
||||
justify-content: center; /* Adjust this as needed */
|
||||
margin-bottom: 30px; /* Add space after the videos container */
|
||||
}
|
||||
|
||||
.video-container {
|
||||
width: 29%; /* Adjusted to slightly less than 30% */
|
||||
margin-right: 2%; /* Space between the videos */
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.video-container:last-child {
|
||||
margin-right: 0; /* Remove margin for the last video container */
|
||||
}
|
||||
|
||||
.video-container video {
|
||||
width: 100%; /* Make video take full width of its container */
|
||||
height: auto; /* Maintain aspect ratio */
|
||||
margin-bottom: 20px; /* Add space below the video */
|
||||
}
|
||||
|
||||
|
||||
video {
|
||||
width: 100%; /* Make video take full width of its container */
|
||||
height: auto; /* Maintain aspect ratio */
|
||||
}
|
||||
|
||||
|
||||
.videos-container-2 {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%; /* Set the desired width */
|
||||
height: 100%; /* Set the desired height */
|
||||
margin: 0 auto; /* Center the container horizontally */
|
||||
}
|
||||
|
||||
.video-container-2 {
|
||||
width: 80%; /* Adjusted to slightly less than 30% */
|
||||
margin-right: 2%; /* Space between the videos */
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.video-container-2:last-child {
|
||||
margin-right: 0; /* Remove margin for the last video container */
|
||||
}
|
||||
|
||||
.video-container-2 video {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.centered-line {
|
||||
width: 75%; /* Adjust the width as needed */
|
||||
height: 10px; /* This controls the thickness of the line */
|
||||
background-color: blue; /* Choose the color of the line */
|
||||
margin: 0 auto; /* This centers the line horizontally */
|
||||
margin-top: 40px; /* Space above the line */
|
||||
margin-bottom: 50px; /* Space below the line */
|
||||
box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.3);
|
||||
background: linear-gradient(to right, #1e5799, #2989d8, #207cca, #7db9e8, #207cca, #2989d8, #1e5799);
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
|
||||
.centered-line2 {
|
||||
width: 75%; /* Adjust the width as needed */
|
||||
height: 10px; /* This controls the thickness of the line */
|
||||
background-color: black; /* Choose the color of the line */
|
||||
margin: 0 auto; /* This centers the line horizontally */
|
||||
margin-top: 1px; /* Space above the line */
|
||||
margin-bottom: 1px; /* Space below the line */
|
||||
box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.3);
|
||||
border-radius: 5px;
|
||||
background: linear-gradient(to right, white, black, white);
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
margin-top: 10px; /* Adjust the value to create more or less space */
|
||||
}
|
||||
|
||||
.hero.is-light.is-small {
|
||||
background-color: lightcyan;
|
||||
width: 80%;
|
||||
margin-left:10%;
|
||||
}
|
||||
|
||||
.video {
|
||||
width: 1280px;
|
||||
height: auto;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.container2 {
|
||||
width: 100%;
|
||||
max-width: none;
|
||||
}
|
37
docs/resources/css/slide.css
Normal file
37
docs/resources/css/slide.css
Normal file
@ -0,0 +1,37 @@
|
||||
.slider-wrapper {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 400px; /* Adjust to your preference */
|
||||
margin: 0 auto; /* Center horizontally */
|
||||
}
|
||||
|
||||
.img-comp-container {
|
||||
position: relative;
|
||||
width: 500px; /* Adjust to your preference */
|
||||
}
|
||||
|
||||
.img-comp-img {
|
||||
position: absolute;
|
||||
width: auto;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.img-comp-img img {
|
||||
display: block;
|
||||
width: auto;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.img-comp-slider {
|
||||
position: absolute;
|
||||
z-index: 9;
|
||||
cursor: ew-resize;
|
||||
/* Style the slider (optional) */
|
||||
background-color: #2196F3;
|
||||
opacity: 0.7;
|
||||
height: 40px;
|
||||
width: 10px;
|
||||
border-radius: 5px;
|
||||
}
|
365
docs/resources/css/style.css
Normal file
365
docs/resources/css/style.css
Normal file
@ -0,0 +1,365 @@
|
||||
body {
|
||||
margin: 0 auto;
|
||||
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.tbl_video {
|
||||
width: 80%;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.container {
|
||||
margin: 0 auto;
|
||||
width: 100%;
|
||||
max-width: 1200px;
|
||||
text-align: center;
|
||||
display: block;
|
||||
}
|
||||
|
||||
#visualization {
|
||||
margin-top: -3em;
|
||||
}
|
||||
|
||||
#canvas {
|
||||
border-style: solid;
|
||||
border-width: 2px;
|
||||
border-color: #1f1f1f;
|
||||
}
|
||||
|
||||
#load-warning {
|
||||
position: relative;
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
font-size: 2em;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
.lil-gui {
|
||||
--width: 1000px;
|
||||
}
|
||||
|
||||
.lil-gui>.title {
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 36px;
|
||||
margin-top: 20px;
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
.venue {
|
||||
font-size: 22px;
|
||||
margin-top: 20px;
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
.author {
|
||||
width: 95%;
|
||||
max-width: 300px;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.affiliation {
|
||||
font-size: 20px;
|
||||
width: 95%;
|
||||
max-width: 450px;
|
||||
}
|
||||
|
||||
.points-label {
|
||||
margin-top: 2px;
|
||||
margin-bottom: 0px;
|
||||
margin-left: -2px;
|
||||
margin-right: 5px;
|
||||
min-width: 10px;
|
||||
min-height: 10px;
|
||||
border-radius: 50%;
|
||||
display: inline-block;
|
||||
border: 0px solid black;
|
||||
}
|
||||
|
||||
.lines-label {
|
||||
margin-top: 0px;
|
||||
margin-bottom: 3px;
|
||||
margin-left: -2px;
|
||||
margin-right: 2px;
|
||||
min-width: 15px;
|
||||
min-height: 5px;
|
||||
border-radius: 0%;
|
||||
display: inline-block;
|
||||
border: 0px solid black;
|
||||
}
|
||||
|
||||
.line {
|
||||
margin-top: 2px;
|
||||
margin-bottom: 3px;
|
||||
margin-left: -2px;
|
||||
margin-right: 5px;
|
||||
min-width: 70px;
|
||||
min-height: 2px;
|
||||
border-radius: 0%;
|
||||
display: inline-block;
|
||||
border: 0px solid black;
|
||||
}
|
||||
|
||||
.justified {
|
||||
text-align: justify;
|
||||
}
|
||||
|
||||
.links {
|
||||
font-size: 22px;
|
||||
width: 95%;
|
||||
max-width: 150px;
|
||||
}
|
||||
|
||||
.video-container {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
width: 80%;
|
||||
padding-top: 45%;
|
||||
}
|
||||
|
||||
.video-container iframe {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.paper-thumbnail {
|
||||
margin: 0 auto;
|
||||
width: 40%;
|
||||
max-width: 250px;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
padding: 2% 10% 4% 0;
|
||||
}
|
||||
|
||||
.paper-info {
|
||||
width: 45%;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
@media (max-width: 999px) {
|
||||
.paper-thumbnail {
|
||||
width: 60%;
|
||||
}
|
||||
|
||||
.paper-info {
|
||||
width: 80%;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
p {
|
||||
text-align: left;
|
||||
margin: 0 auto;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-weight: 700;
|
||||
text-align: center;
|
||||
font-size: 1.5em;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
h3 {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
h4 {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
h5 {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
div {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
hr {
|
||||
border: 0;
|
||||
height: 1px;
|
||||
background-image: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
pre {
|
||||
overflow-x: auto;
|
||||
text-align: left;
|
||||
border: 1px solid grey;
|
||||
border-radius: 3px;
|
||||
background: #eeeeee;
|
||||
padding: 5px 5px 5px 10px;
|
||||
line-height: 1.2;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
pre code {
|
||||
text-align: left;
|
||||
word-wrap: normal;
|
||||
white-space: pre-wrap;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
a:link,
|
||||
a:visited {
|
||||
color: #1367a7;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #208799;
|
||||
}
|
||||
|
||||
.layered-paper-big {
|
||||
box-shadow:
|
||||
0px 0px 1px 1px rgba(0, 0, 0, 0.35),
|
||||
/* The top layer shadow */
|
||||
5px 5px 0 0px #fff,
|
||||
/* The second layer */
|
||||
5px 5px 1px 1px rgba(0, 0, 0, 0.35),
|
||||
/* The second layer shadow */
|
||||
10px 10px 0 0px #fff,
|
||||
/* The third layer */
|
||||
10px 10px 1px 1px rgba(0, 0, 0, 0.35),
|
||||
/* The third layer shadow */
|
||||
15px 15px 0 0px #fff,
|
||||
/* The fourth layer */
|
||||
15px 15px 1px 1px rgba(0, 0, 0, 0.35),
|
||||
/* The fourth layer shadow */
|
||||
20px 20px 0 0px #fff,
|
||||
/* The fifth layer */
|
||||
20px 20px 1px 1px rgba(0, 0, 0, 0.35),
|
||||
/* The fifth layer shadow */
|
||||
25px 25px 0 0px #fff,
|
||||
/* The fifth layer */
|
||||
25px 25px 1px 1px rgba(0, 0, 0, 0.35);
|
||||
/* The fifth layer shadow */
|
||||
margin-left: 10px;
|
||||
margin-right: 45px;
|
||||
}
|
||||
|
||||
* {box-sizing: border-box;}
|
||||
|
||||
.img-comp-container {
|
||||
position: relative;
|
||||
height: 200px; /*should be the same height as the images*/
|
||||
}
|
||||
|
||||
.img-comp-img {
|
||||
position: absolute;
|
||||
width: auto;
|
||||
height: auto;
|
||||
overflow:hidden;
|
||||
}
|
||||
|
||||
.img-comp-img img {
|
||||
display:block;
|
||||
}
|
||||
|
||||
.img-comp-slider {
|
||||
position: absolute;
|
||||
z-index:9;
|
||||
cursor: ew-resize;
|
||||
/*set the appearance of the slider:*/
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
background-color: #2196F3;
|
||||
opacity: 0.7;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.tbl_comparison {
|
||||
width: 40%;
|
||||
text-align: center;
|
||||
}
|
||||
.parent-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 40%;
|
||||
text-align: center;
|
||||
}
|
||||
.parent-video-compare-container {
|
||||
width: 80%;
|
||||
justify-content: center;
|
||||
}
|
||||
.double-arrow {
|
||||
font-size: 24px;
|
||||
display: inline-block;
|
||||
white-space: nowrap; /* Prevent line break */
|
||||
}
|
||||
|
||||
.left-arrow {
|
||||
margin-right: -4px; /* Adjusted margin to remove space */
|
||||
}
|
||||
|
||||
.right-arrow {
|
||||
margin-left: -4px; /* Adjusted margin to remove space */
|
||||
}
|
||||
|
||||
.video-compare-container {
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
position: relative;
|
||||
display: block;
|
||||
line-height: 0;
|
||||
}
|
||||
|
||||
.video {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
position: relative;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.videoMerge {
|
||||
position: relative;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 10;
|
||||
width: 100%;
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.cropped-video {
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.compare-image-container img {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.compare-image-container .alt-text {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
background-color: rgba(255, 255, 255, 0.8);
|
||||
padding: 5px;
|
||||
}
|
||||
.b-dics__slider {
|
||||
color: #1e4beb;
|
||||
}
|
||||
.b-dics__slider:after {
|
||||
width: 2px;
|
||||
}
|
643
docs/resources/js/dics.original.js
Normal file
643
docs/resources/js/dics.original.js
Normal file
@ -0,0 +1,643 @@
|
||||
/*
|
||||
* Dics: Definitive image comparison slider. A multiple image vanilla comparison slider.
|
||||
*
|
||||
* By Abel Cabeza Román, a Codictados developer
|
||||
* Src: https://github.com/abelcabezaroman/definitive-image-comparison-slider
|
||||
* Example: http://codictados.com/portfolio/definitive-image-comparison-slider-demo/
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @type {{container: null, filters: null, hideTexts: null, textPosition: string, linesOrientation: string, rotate: number, arrayBackgroundColorText: null, arrayColorText: null, linesColor: null}}
|
||||
*/
|
||||
let defaultOptions = {
|
||||
container: null, // **REQUIRED**: HTML container | `document.querySelector('.b-dics')` |
|
||||
filters: null, // Array of CSS string filters |`['blur(3px)', 'grayscale(1)', 'sepia(1)', 'saturate(3)']` |
|
||||
hideTexts: true, // Show text only when you hover the image container |`true`,`false`|
|
||||
textPosition: "center", // Set the prefer text position |`'center'`,`'top'`, `'right'`, `'bottom'`, `'left'` |
|
||||
linesOrientation: "horizontal", // Change the orientation of lines |`'horizontal'`,`'vertical'` |
|
||||
rotate: 0, // Rotate the image container (not too useful but it's a beatiful effect. String of rotate CSS rule) |`'45deg'`|
|
||||
arrayBackgroundColorText: null, // Change the bacground-color of sections texts with an array |`['#000000', '#FFFFFF']`|
|
||||
arrayColorText: null, // Change the color of texts with an array |`['#FFFFFF', '#000000']`|
|
||||
linesColor: null // Change the lines and arrows color |`'rgb(0,0,0)'`|
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param options
|
||||
* @constructor
|
||||
*/
|
||||
let Dics = function(options) {
|
||||
this.options = utils.extend({}, [defaultOptions, options], {
|
||||
clearEmpty: true
|
||||
});
|
||||
|
||||
this.container = this.options.container;
|
||||
|
||||
if (this.container == null) {
|
||||
console.error("Container element not found!");
|
||||
} else {
|
||||
|
||||
this._setOrientation(this.options.linesOrientation, this.container);
|
||||
this.images = this._getImages();
|
||||
this.sliders = [];
|
||||
this._activeSlider = null;
|
||||
|
||||
|
||||
this._load(this.images[0]);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
Dics.prototype._load = function(firstImage, maxCounter = 100000) {
|
||||
if (firstImage.naturalWidth) {
|
||||
this._buidAfterFirstImageLoad(firstImage);
|
||||
window.addEventListener("resize", () => {
|
||||
this._setContainerWidth(firstImage);
|
||||
this._resetSizes();
|
||||
});
|
||||
|
||||
} else {
|
||||
if (maxCounter > 0) {
|
||||
maxCounter--;
|
||||
setTimeout(() => {
|
||||
this._load(firstImage, maxCounter);
|
||||
}, 100);
|
||||
} else {
|
||||
console.error("error loading images");
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
Dics.prototype._buidAfterFirstImageLoad = function(firstImage) {
|
||||
this._setContainerWidth(firstImage);
|
||||
|
||||
this._build();
|
||||
this._setEvents();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
Dics.prototype._setContainerWidth = function(firstImage) {
|
||||
this.options.container.style.height = `${this._calcContainerHeight(firstImage)}px`;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
Dics.prototype._setOpacityContainerForLoading = function(opacity) {
|
||||
this.options.container.style.opacity = opacity;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Reset sizes on window size change
|
||||
* @private
|
||||
*/
|
||||
Dics.prototype._resetSizes = function() {
|
||||
let dics = this;
|
||||
let imagesLength = dics.images.length;
|
||||
|
||||
let initialImagesContainerWidth = dics.container.getBoundingClientRect()[dics.config.sizeField] / imagesLength;
|
||||
|
||||
const sections$$ = dics.container.querySelectorAll("[data-function='b-dics__section']");
|
||||
for (let i = 0; i < sections$$.length; i++) {
|
||||
let section$$ = sections$$[i];
|
||||
|
||||
section$$.style.flex = `0 0 ${initialImagesContainerWidth}px`;
|
||||
|
||||
section$$.querySelector(".b-dics__image").style[this.config.positionField] = `${i * -initialImagesContainerWidth}px`;
|
||||
|
||||
const slider$$ = section$$.querySelector(".b-dics__slider");
|
||||
if (slider$$) {
|
||||
slider$$.style[this.config.positionField] = `${initialImagesContainerWidth * (i + 1)}px`;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Build HTML
|
||||
* @private
|
||||
*/
|
||||
Dics.prototype._build = function() {
|
||||
let dics = this;
|
||||
|
||||
dics._applyGlobalClass(dics.options);
|
||||
|
||||
let imagesLength = dics.images.length;
|
||||
|
||||
|
||||
let initialImagesContainerWidth = dics.container.getBoundingClientRect()[dics.config.sizeField] / imagesLength;
|
||||
|
||||
for (let i = 0; i < imagesLength; i++) {
|
||||
let image = dics.images[i];
|
||||
let section = dics._createElement("div", "b-dics__section");
|
||||
let imageContainer = dics._createElement("div", "b-dics__image-container");
|
||||
let slider = dics._createSlider(i, initialImagesContainerWidth);
|
||||
|
||||
dics._createAltText(image, i, imageContainer);
|
||||
|
||||
dics._applyFilter(image, i, dics.options.filters);
|
||||
dics._rotate(image, imageContainer);
|
||||
|
||||
|
||||
section.setAttribute("data-function", "b-dics__section");
|
||||
section.style.flex = `0 0 ${initialImagesContainerWidth}px`;
|
||||
|
||||
image.classList.add("b-dics__image");
|
||||
|
||||
section.appendChild(imageContainer);
|
||||
imageContainer.appendChild(image);
|
||||
|
||||
if (i < imagesLength - 1) {
|
||||
section.appendChild(slider);
|
||||
}
|
||||
|
||||
dics.container.appendChild(section);
|
||||
|
||||
image.style[this.config.positionField] = `${i * -initialImagesContainerWidth}px`;
|
||||
|
||||
|
||||
}
|
||||
|
||||
this.sections = this._getSections();
|
||||
this._setOpacityContainerForLoading(1);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns {NodeListOf<SVGElementTagNameMap[string]> | NodeListOf<HTMLElementTagNameMap[string]> | NodeListOf<Element>}
|
||||
* @private
|
||||
*/
|
||||
Dics.prototype._getImages = function() {
|
||||
return this.container.querySelectorAll("img");
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns {NodeListOf<SVGElementTagNameMap[string]> | NodeListOf<HTMLElementTagNameMap[string]> | NodeListOf<Element>}
|
||||
* @private
|
||||
*/
|
||||
Dics.prototype._getSections = function() {
|
||||
return this.container.querySelectorAll("[data-function=\"b-dics__section\"]");
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param elementClass
|
||||
* @param className
|
||||
* @returns {HTMLElement | HTMLSelectElement | HTMLLegendElement | HTMLTableCaptionElement | HTMLTextAreaElement | HTMLModElement | HTMLHRElement | HTMLOutputElement | HTMLPreElement | HTMLEmbedElement | HTMLCanvasElement | HTMLFrameSetElement | HTMLMarqueeElement | HTMLScriptElement | HTMLInputElement | HTMLUnknownElement | HTMLMetaElement | HTMLStyleElement | HTMLObjectElement | HTMLTemplateElement | HTMLBRElement | HTMLAudioElement | HTMLIFrameElement | HTMLMapElement | HTMLTableElement | HTMLAnchorElement | HTMLMenuElement | HTMLPictureElement | HTMLParagraphElement | HTMLTableDataCellElement | HTMLTableSectionElement | HTMLQuoteElement | HTMLTableHeaderCellElement | HTMLProgressElement | HTMLLIElement | HTMLTableRowElement | HTMLFontElement | HTMLSpanElement | HTMLTableColElement | HTMLOptGroupElement | HTMLDataElement | HTMLDListElement | HTMLFieldSetElement | HTMLSourceElement | HTMLBodyElement | HTMLDirectoryElement | HTMLDivElement | HTMLUListElement | HTMLHtmlElement | HTMLAreaElement | HTMLMeterElement | HTMLAppletElement | HTMLFrameElement | HTMLOptionElement | HTMLImageElement | HTMLLinkElement | HTMLHeadingElement | HTMLSlotElement | HTMLVideoElement | HTMLBaseFontElement | HTMLTitleElement | HTMLButtonElement | HTMLHeadElement | HTMLParamElement | HTMLTrackElement | HTMLOListElement | HTMLDataListElement | HTMLLabelElement | HTMLFormElement | HTMLTimeElement | HTMLBaseElement}
|
||||
* @private
|
||||
*/
|
||||
Dics.prototype._createElement = function(elementClass, className) {
|
||||
let newElement = document.createElement(elementClass);
|
||||
|
||||
newElement.classList.add(className);
|
||||
|
||||
return newElement;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set need DOM events
|
||||
* @private
|
||||
*/
|
||||
Dics.prototype._setEvents = function() {
|
||||
let dics = this;
|
||||
|
||||
dics._disableImageDrag();
|
||||
|
||||
dics._isGoingRight = null;
|
||||
|
||||
let oldx = 0;
|
||||
|
||||
let listener = function(event) {
|
||||
|
||||
let xPageCoord = event.pageX ? event.pageX : event.touches[0].pageX;
|
||||
|
||||
if (xPageCoord < oldx) {
|
||||
dics._isGoingRight = false;
|
||||
} else if (xPageCoord > oldx) {
|
||||
dics._isGoingRight = true;
|
||||
}
|
||||
|
||||
oldx = xPageCoord;
|
||||
|
||||
let position = dics._calcPosition(event);
|
||||
|
||||
let beforeSectionsWidth = dics._beforeSectionsWidth(dics.sections, dics.images, dics._activeSlider);
|
||||
|
||||
let calcMovePixels = position - beforeSectionsWidth;
|
||||
|
||||
dics.sliders[dics._activeSlider].style[dics.config.positionField] = `${position}px`;
|
||||
|
||||
dics._pushSections(calcMovePixels, position);
|
||||
};
|
||||
|
||||
dics.container.addEventListener("click", listener);
|
||||
|
||||
for (let i = 0; i < dics.sliders.length; i++) {
|
||||
let slider = dics.sliders[i];
|
||||
utils.setMultiEvents(slider, ["mousedown", "touchstart"], function(event) {
|
||||
dics._activeSlider = i;
|
||||
|
||||
dics._clickPosition = dics._calcPosition(event);
|
||||
|
||||
slider.classList.add("b-dics__slider--active");
|
||||
|
||||
utils.setMultiEvents(dics.container, ["mousemove", "touchmove"], listener);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
let listener2 = function() {
|
||||
let activeElements = dics.container.querySelectorAll(".b-dics__slider--active");
|
||||
|
||||
for (let activeElement of activeElements) {
|
||||
activeElement.classList.remove("b-dics__slider--active");
|
||||
utils.removeMultiEvents(dics.container, ["mousemove", "touchmove"], listener);
|
||||
}
|
||||
};
|
||||
|
||||
utils.setMultiEvents(document.body, ["mouseup", "touchend"], listener2);
|
||||
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param sections
|
||||
* @param images
|
||||
* @param activeSlider
|
||||
* @returns {number}
|
||||
* @private
|
||||
*/
|
||||
Dics.prototype._beforeSectionsWidth = function(sections, images, activeSlider) {
|
||||
let width = 0;
|
||||
for (let i = 0; i < sections.length; i++) {
|
||||
let section = sections[i];
|
||||
if (i !== activeSlider) {
|
||||
width += section.getBoundingClientRect()[this.config.sizeField];
|
||||
} else {
|
||||
return width;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns {number}
|
||||
* @private
|
||||
*/
|
||||
Dics.prototype._calcContainerHeight = function(firstImage) {
|
||||
let imgHeight = firstImage.naturalHeight;
|
||||
let imgWidth = firstImage.naturalWidth;
|
||||
let containerWidth = this.options.container.getBoundingClientRect().width;
|
||||
|
||||
return (containerWidth / imgWidth) * imgHeight;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param sections
|
||||
* @param images
|
||||
* @private
|
||||
*/
|
||||
Dics.prototype._setLeftToImages = function(sections, images) {
|
||||
let size = 0;
|
||||
for (let i = 0; i < images.length; i++) {
|
||||
let image = images[i];
|
||||
|
||||
image.style[this.config.positionField] = `-${size}px`;
|
||||
size += sections[i].getBoundingClientRect()[this.config.sizeField];
|
||||
|
||||
this.sliders[i].style[this.config.positionField] = `${size}px`;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
Dics.prototype._disableImageDrag = function() {
|
||||
for (let i = 0; i < this.images.length; i++) {
|
||||
this.sliders[i].addEventListener("dragstart", function(e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
this.images[i].addEventListener("dragstart", function(e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param image
|
||||
* @param index
|
||||
* @param filters
|
||||
* @private
|
||||
*/
|
||||
Dics.prototype._applyFilter = function(image, index, filters) {
|
||||
if (filters) {
|
||||
image.style.filter = filters[index];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param options
|
||||
* @private
|
||||
*/
|
||||
Dics.prototype._applyGlobalClass = function(options) {
|
||||
let container = options.container;
|
||||
|
||||
|
||||
if (options.hideTexts) {
|
||||
container.classList.add("b-dics--hide-texts");
|
||||
}
|
||||
|
||||
if (options.linesOrientation === "vertical") {
|
||||
container.classList.add("b-dics--vertical");
|
||||
}
|
||||
|
||||
if (options.textPosition === "center") {
|
||||
container.classList.add("b-dics--tp-center");
|
||||
} else if (options.textPosition === "bottom") {
|
||||
container.classList.add("b-dics--tp-bottom");
|
||||
} else if (options.textPosition === "left") {
|
||||
container.classList.add("b-dics--tp-left");
|
||||
} else if (options.textPosition === "right") {
|
||||
container.classList.add("b-dics--tp-right");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Dics.prototype._createSlider = function(i, initialImagesContainerWidth) {
|
||||
let slider = this._createElement("div", "b-dics__slider");
|
||||
|
||||
if (this.options.linesColor) {
|
||||
slider.style.color = this.options.linesColor;
|
||||
}
|
||||
|
||||
slider.style[this.config.positionField] = `${initialImagesContainerWidth * (i + 1)}px`;
|
||||
|
||||
this.sliders.push(slider);
|
||||
|
||||
|
||||
return slider;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param image
|
||||
* @param i
|
||||
* @param imageContainer
|
||||
* @private
|
||||
*/
|
||||
Dics.prototype._createAltText = function(image, i, imageContainer) {
|
||||
let textContent = image.getAttribute("alt");
|
||||
if (textContent) {
|
||||
let text = this._createElement("p", "b-dics__text");
|
||||
|
||||
if (this.options.arrayBackgroundColorText) {
|
||||
text.style.backgroundColor = this.options.arrayBackgroundColorText[i];
|
||||
}
|
||||
if (this.options.arrayColorText) {
|
||||
text.style.color = this.options.arrayColorText[i];
|
||||
}
|
||||
|
||||
text.appendChild(document.createTextNode(textContent));
|
||||
|
||||
imageContainer.appendChild(text);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param image
|
||||
* @param imageContainer
|
||||
* @private
|
||||
*/
|
||||
Dics.prototype._rotate = function(image, imageContainer) {
|
||||
image.style.rotate = `-${this.options.rotate}`;
|
||||
imageContainer.style.rotate = this.options.rotate;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
Dics.prototype._removeActiveElements = function() {
|
||||
let activeElements = Dics.container.querySelectorAll(".b-dics__slider--active");
|
||||
|
||||
for (let activeElement of activeElements) {
|
||||
activeElement.classList.remove("b-dics__slider--active");
|
||||
utils.removeMultiEvents(Dics.container, ["mousemove", "touchmove"], Dics.prototype._removeActiveElements);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param linesOrientation
|
||||
* @private
|
||||
*/
|
||||
Dics.prototype._setOrientation = function(linesOrientation) {
|
||||
this.config = {};
|
||||
|
||||
if (linesOrientation === "vertical") {
|
||||
this.config.offsetSizeField = "offsetHeight";
|
||||
this.config.offsetPositionField = "offsetTop";
|
||||
this.config.sizeField = "height";
|
||||
this.config.positionField = "top";
|
||||
this.config.clientField = "clientY";
|
||||
this.config.pageField = "pageY";
|
||||
} else {
|
||||
this.config.offsetSizeField = "offsetWidth";
|
||||
this.config.offsetPositionField = "offsetLeft";
|
||||
this.config.sizeField = "width";
|
||||
this.config.positionField = "left";
|
||||
this.config.clientField = "clientX";
|
||||
this.config.pageField = "pageX";
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param event
|
||||
* @returns {number}
|
||||
* @private
|
||||
*/
|
||||
Dics.prototype._calcPosition = function(event) {
|
||||
let containerCoords = this.container.getBoundingClientRect();
|
||||
let pixel = !isNaN(event[this.config.clientField]) ? event[this.config.clientField] : event.touches[0][this.config.clientField];
|
||||
|
||||
return containerCoords[this.config.positionField] < pixel ? pixel - containerCoords[this.config.positionField] : 0;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
Dics.prototype._pushSections = function(calcMovePixels, position) {
|
||||
// if (this._rePosUnderActualSections(position)) {
|
||||
this._setFlex(position, this._isGoingRight);
|
||||
|
||||
let section = this.sections[this._activeSlider];
|
||||
let postActualSection = this.sections[this._activeSlider + 1];
|
||||
let sectionWidth = postActualSection.getBoundingClientRect()[this.config.sizeField] - (calcMovePixels - this.sections[this._activeSlider].getBoundingClientRect()[this.config.sizeField]);
|
||||
|
||||
|
||||
section.style.flex = this._isGoingRight === true ? `2 0 ${calcMovePixels}px` : `1 1 ${calcMovePixels}px`;
|
||||
postActualSection.style.flex = this._isGoingRight === true ? ` ${sectionWidth}px` : `2 0 ${sectionWidth}px`;
|
||||
|
||||
this._setLeftToImages(this.sections, this.images);
|
||||
|
||||
// }
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
Dics.prototype._setFlex = function(position, isGoingRight) {
|
||||
let beforeSumSectionsSize = 0;
|
||||
|
||||
|
||||
for (let i = 0; i < this.sections.length; i++) {
|
||||
let section = this.sections[i];
|
||||
const sectionSize = section.getBoundingClientRect()[this.config.sizeField];
|
||||
|
||||
beforeSumSectionsSize += sectionSize;
|
||||
|
||||
if ((isGoingRight && position > (beforeSumSectionsSize - sectionSize) && i > this._activeSlider) || (!isGoingRight && position < beforeSumSectionsSize) && i < this._activeSlider) {
|
||||
section.style.flex = `1 100 ${sectionSize}px`;
|
||||
} else {
|
||||
section.style.flex = `0 0 ${sectionSize}px`;
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @type {{extend: (function(*=, *, *): *), setMultiEvents: setMultiEvents, removeMultiEvents: removeMultiEvents, getConstructor: (function(*=): string)}}
|
||||
*/
|
||||
let utils = {
|
||||
|
||||
|
||||
/**
|
||||
* Native extend object
|
||||
* @param target
|
||||
* @param objects
|
||||
* @param options
|
||||
* @returns {*}
|
||||
*/
|
||||
extend: function(target, objects, options) {
|
||||
|
||||
for (let object in objects) {
|
||||
if (objects.hasOwnProperty(object)) {
|
||||
recursiveMerge(target, objects[object]);
|
||||
}
|
||||
}
|
||||
|
||||
function recursiveMerge (target, object) {
|
||||
for (let property in object) {
|
||||
if (object.hasOwnProperty(property)) {
|
||||
let current = object[property];
|
||||
if (utils.getConstructor(current) === "Object") {
|
||||
if (!target[property]) {
|
||||
target[property] = {};
|
||||
}
|
||||
recursiveMerge(target[property], current);
|
||||
} else {
|
||||
// clearEmpty
|
||||
if (options.clearEmpty) {
|
||||
if (current == null) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
target[property] = current;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return target;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Set Multi addEventListener
|
||||
* @param element
|
||||
* @param events
|
||||
* @param func
|
||||
*/
|
||||
setMultiEvents: function(element, events, func) {
|
||||
for (let i = 0; i < events.length; i++) {
|
||||
element.addEventListener(events[i], func);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param element
|
||||
* @param events
|
||||
* @param func
|
||||
*/
|
||||
removeMultiEvents: function(element, events, func) {
|
||||
for (let i = 0; i < events.length; i++) {
|
||||
element.removeEventListener(events[i], func, false);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Get object constructor
|
||||
* @param object
|
||||
* @returns {string}
|
||||
*/
|
||||
getConstructor: function(object) {
|
||||
return Object.prototype.toString.call(object).slice(8, -1);
|
||||
}
|
||||
};
|
||||
|
133
docs/resources/js/video_comparison.js
Normal file
133
docs/resources/js/video_comparison.js
Normal file
@ -0,0 +1,133 @@
|
||||
// Written by Dor Verbin, October 2021
|
||||
// This is based on: http://thenewcode.com/364/Interactive-Before-and-After-Video-Comparison-in-HTML5-Canvas
|
||||
// With additional modifications based on: https://jsfiddle.net/7sk5k4gp/13/
|
||||
|
||||
function playVids(videoId) {
|
||||
var videoMerge = document.getElementById(videoId + "Merge");
|
||||
var vid = document.getElementById(videoId);
|
||||
|
||||
var position = 0.5;
|
||||
var vidWidth = vid.videoWidth/2;
|
||||
var vidHeight = vid.videoHeight;
|
||||
|
||||
var mergeContext = videoMerge.getContext("2d");
|
||||
|
||||
|
||||
if (vid.readyState > 3) {
|
||||
vid.play();
|
||||
|
||||
function trackLocation(e) {
|
||||
// Normalize to [0, 1]
|
||||
bcr = videoMerge.getBoundingClientRect();
|
||||
position = ((e.pageX - bcr.x) / bcr.width);
|
||||
}
|
||||
function trackLocationTouch(e) {
|
||||
// Normalize to [0, 1]
|
||||
bcr = videoMerge.getBoundingClientRect();
|
||||
position = ((e.touches[0].pageX - bcr.x) / bcr.width);
|
||||
}
|
||||
|
||||
videoMerge.addEventListener("mousemove", trackLocation, false);
|
||||
videoMerge.addEventListener("touchstart", trackLocationTouch, false);
|
||||
videoMerge.addEventListener("touchmove", trackLocationTouch, false);
|
||||
|
||||
|
||||
function drawLoop() {
|
||||
var colStart = (vidWidth * position).clamp(0.0, vidWidth);
|
||||
var colWidth = (vidWidth - (vidWidth * position)).clamp(0.0, vidWidth);
|
||||
mergeContext.drawImage(vid,
|
||||
vidWidth, 0, vidWidth, vidHeight,
|
||||
0, 0, vidWidth, vidHeight
|
||||
);
|
||||
mergeContext.drawImage(vid,
|
||||
colStart, 0, colWidth, vidHeight,
|
||||
colStart, 0, colWidth, vidHeight
|
||||
);
|
||||
requestAnimationFrame(drawLoop);
|
||||
|
||||
|
||||
var arrowLength = 0.09 * vidHeight;
|
||||
var arrowheadWidth = 0.025 * vidHeight;
|
||||
var arrowheadLength = 0.04 * vidHeight;
|
||||
var arrowPosY = vidHeight / 10 * 8;
|
||||
var arrowWidth = 0.007 * vidHeight;
|
||||
var currX = vidWidth * position;
|
||||
|
||||
// Draw circle
|
||||
mergeContext.arc(currX, arrowPosY, arrowLength*0.7, 0, Math.PI * 2, false);
|
||||
mergeContext.fillStyle = "#FFD79340";
|
||||
mergeContext.fill()
|
||||
//mergeContext.strokeStyle = "#444444";
|
||||
//mergeContext.stroke()
|
||||
|
||||
// Draw border
|
||||
mergeContext.beginPath();
|
||||
mergeContext.moveTo(vidWidth*position, 0);
|
||||
mergeContext.lineTo(vidWidth*position, vidHeight);
|
||||
mergeContext.closePath()
|
||||
mergeContext.strokeStyle = "#AAAAAA";
|
||||
mergeContext.lineWidth = 5;
|
||||
mergeContext.stroke();
|
||||
|
||||
// Draw arrow
|
||||
mergeContext.beginPath();
|
||||
mergeContext.moveTo(currX, arrowPosY - arrowWidth/2);
|
||||
|
||||
// Move right until meeting arrow head
|
||||
mergeContext.lineTo(currX + arrowLength/2 - arrowheadLength/2, arrowPosY - arrowWidth/2);
|
||||
|
||||
// Draw right arrow head
|
||||
mergeContext.lineTo(currX + arrowLength/2 - arrowheadLength/2, arrowPosY - arrowheadWidth/2);
|
||||
mergeContext.lineTo(currX + arrowLength/2, arrowPosY);
|
||||
mergeContext.lineTo(currX + arrowLength/2 - arrowheadLength/2, arrowPosY + arrowheadWidth/2);
|
||||
mergeContext.lineTo(currX + arrowLength/2 - arrowheadLength/2, arrowPosY + arrowWidth/2);
|
||||
|
||||
// Go back to the left until meeting left arrow head
|
||||
mergeContext.lineTo(currX - arrowLength/2 + arrowheadLength/2, arrowPosY + arrowWidth/2);
|
||||
|
||||
// Draw left arrow head
|
||||
mergeContext.lineTo(currX - arrowLength/2 + arrowheadLength/2, arrowPosY + arrowheadWidth/2);
|
||||
mergeContext.lineTo(currX - arrowLength/2, arrowPosY);
|
||||
mergeContext.lineTo(currX - arrowLength/2 + arrowheadLength/2, arrowPosY - arrowheadWidth/2);
|
||||
mergeContext.lineTo(currX - arrowLength/2 + arrowheadLength/2, arrowPosY);
|
||||
|
||||
mergeContext.lineTo(currX - arrowLength/2 + arrowheadLength/2, arrowPosY - arrowWidth/2);
|
||||
mergeContext.lineTo(currX, arrowPosY - arrowWidth/2);
|
||||
|
||||
mergeContext.closePath();
|
||||
|
||||
mergeContext.fillStyle = "#AAAAAA";
|
||||
mergeContext.fill();
|
||||
|
||||
// Draw text overlay for our method
|
||||
mergeContext.font = "40px Arial";
|
||||
mergeContext.fillStyle = "white";
|
||||
mergeContext.fillText("Our Method", 1010, 50);
|
||||
|
||||
// Draw text overlay for our method
|
||||
mergeContext.font = "40px Arial";
|
||||
mergeContext.fillStyle = "white";
|
||||
mergeContext.fillText("Baseline", 10, 50);
|
||||
// mergeContext.fillText("Gaussian", 10, 100);
|
||||
// mergeContext.fillText("Splatting", 10, 150);
|
||||
|
||||
}
|
||||
requestAnimationFrame(drawLoop);
|
||||
}
|
||||
}
|
||||
|
||||
Number.prototype.clamp = function(min, max) {
|
||||
return Math.min(Math.max(this, min), max);
|
||||
};
|
||||
|
||||
|
||||
function resizeAndPlay(element)
|
||||
{
|
||||
var cv = document.getElementById(element.id + "Merge");
|
||||
cv.width = element.videoWidth/2;
|
||||
cv.height = element.videoHeight;
|
||||
element.play();
|
||||
element.style.height = "0px"; // Hide video without stopping it
|
||||
|
||||
playVids(element.id);
|
||||
}
|
BIN
docs/resources/stump/stump.mp4
Normal file
BIN
docs/resources/stump/stump.mp4
Normal file
Binary file not shown.
BIN
docs/resources/training_rand_compare/bicycle_both-rand.mp4
Normal file
BIN
docs/resources/training_rand_compare/bicycle_both-rand.mp4
Normal file
Binary file not shown.
@ -82,7 +82,7 @@ def render(viewpoint_camera, pc : GaussianModel, pipe, bg_color : torch.Tensor,
|
||||
colors_precomp = override_color
|
||||
|
||||
# Rasterize visible Gaussians to image, obtain their radii (on screen).
|
||||
rendered_image, radii = rasterizer(
|
||||
rendered_image, radii, is_used = rasterizer(
|
||||
means3D = means3D,
|
||||
means2D = means2D,
|
||||
shs = shs,
|
||||
@ -97,4 +97,5 @@ def render(viewpoint_camera, pc : GaussianModel, pipe, bg_color : torch.Tensor,
|
||||
return {"render": rendered_image,
|
||||
"viewspace_points": screenspace_points,
|
||||
"visibility_filter" : radii > 0,
|
||||
"radii": radii}
|
||||
"radii": radii,
|
||||
"is_used": is_used}
|
||||
|
@ -41,7 +41,7 @@ class Scene:
|
||||
self.test_cameras = {}
|
||||
|
||||
if os.path.exists(os.path.join(args.source_path, "sparse")):
|
||||
scene_info = sceneLoadTypeCallbacks["Colmap"](args.source_path, args.images, args.eval)
|
||||
scene_info = sceneLoadTypeCallbacks["Colmap"](args.source_path, args.images, args.eval, init_type=args.init_type)
|
||||
elif os.path.exists(os.path.join(args.source_path, "transforms_train.json")):
|
||||
print("Found transforms_train.json file, assuming Blender data set!")
|
||||
scene_info = sceneLoadTypeCallbacks["Blender"](args.source_path, args.white_background, args.eval)
|
||||
|
@ -129,7 +129,7 @@ def storePly(path, xyz, rgb):
|
||||
ply_data = PlyData([vertex_element])
|
||||
ply_data.write(path)
|
||||
|
||||
def readColmapSceneInfo(path, images, eval, llffhold=8):
|
||||
def readColmapSceneInfo(path, images, eval, llffhold=8, init_type="sfm", num_pts=100000):
|
||||
try:
|
||||
cameras_extrinsic_file = os.path.join(path, "sparse/0", "images.bin")
|
||||
cameras_intrinsic_file = os.path.join(path, "sparse/0", "cameras.bin")
|
||||
@ -154,16 +154,32 @@ def readColmapSceneInfo(path, images, eval, llffhold=8):
|
||||
|
||||
nerf_normalization = getNerfppNorm(train_cam_infos)
|
||||
|
||||
ply_path = os.path.join(path, "sparse/0/points3D.ply")
|
||||
bin_path = os.path.join(path, "sparse/0/points3D.bin")
|
||||
txt_path = os.path.join(path, "sparse/0/points3D.txt")
|
||||
if not os.path.exists(ply_path):
|
||||
print("Converting point3d.bin to .ply, will happen only the first time you open the scene.")
|
||||
try:
|
||||
xyz, rgb, _ = read_points3D_binary(bin_path)
|
||||
except:
|
||||
xyz, rgb, _ = read_points3D_text(txt_path)
|
||||
storePly(ply_path, xyz, rgb)
|
||||
if init_type == "sfm":
|
||||
ply_path = os.path.join(path, "sparse/0/points3D.ply")
|
||||
bin_path = os.path.join(path, "sparse/0/points3D.bin")
|
||||
txt_path = os.path.join(path, "sparse/0/points3D.txt")
|
||||
if not os.path.exists(ply_path):
|
||||
print("Converting point3d.bin to .ply, will happen only the first time you open the scene.")
|
||||
try:
|
||||
xyz, rgb, _ = read_points3D_binary(bin_path)
|
||||
except:
|
||||
xyz, rgb, _ = read_points3D_text(txt_path)
|
||||
storePly(ply_path, xyz, rgb)
|
||||
elif init_type == "random":
|
||||
ply_path = os.path.join(path, "random.ply")
|
||||
print(f"Generating random point cloud ({num_pts})...")
|
||||
|
||||
xyz = np.random.random((num_pts, 3)) * nerf_normalization["radius"]* 3*2 -(nerf_normalization["radius"]*3)
|
||||
|
||||
num_pts = xyz.shape[0]
|
||||
shs = np.random.random((num_pts, 3)) / 255.0
|
||||
pcd = BasicPointCloud(points=xyz, colors=SH2RGB(shs), normals=np.zeros((num_pts, 3)))
|
||||
|
||||
storePly(ply_path, xyz, SH2RGB(shs) * 255)
|
||||
else:
|
||||
print("Please specify a correct init_type: random or sfm")
|
||||
exit(0)
|
||||
|
||||
try:
|
||||
pcd = fetchPly(ply_path)
|
||||
except:
|
||||
|
@ -20,6 +20,7 @@ from utils.sh_utils import RGB2SH
|
||||
from simple_knn._C import distCUDA2
|
||||
from utils.graphics_utils import BasicPointCloud
|
||||
from utils.general_utils import strip_symmetric, build_scaling_rotation
|
||||
from utils.reloc_utils import compute_relocation_cuda
|
||||
|
||||
class GaussianModel:
|
||||
|
||||
@ -132,11 +133,11 @@ class GaussianModel:
|
||||
print("Number of points at initialisation : ", fused_point_cloud.shape[0])
|
||||
|
||||
dist2 = torch.clamp_min(distCUDA2(torch.from_numpy(np.asarray(pcd.points)).float().cuda()), 0.0000001)
|
||||
scales = torch.log(torch.sqrt(dist2))[...,None].repeat(1, 3)
|
||||
scales = torch.log(torch.sqrt(dist2)*0.1)[...,None].repeat(1, 3)
|
||||
rots = torch.zeros((fused_point_cloud.shape[0], 4), device="cuda")
|
||||
rots[:, 0] = 1
|
||||
|
||||
opacities = inverse_sigmoid(0.1 * torch.ones((fused_point_cloud.shape[0], 1), dtype=torch.float, device="cuda"))
|
||||
opacities = inverse_sigmoid(0.5 * torch.ones((fused_point_cloud.shape[0], 1), dtype=torch.float, device="cuda"))
|
||||
|
||||
self._xyz = nn.Parameter(fused_point_cloud.requires_grad_(True))
|
||||
self._features_dc = nn.Parameter(features[:,:,0:1].transpose(1, 2).contiguous().requires_grad_(True))
|
||||
@ -326,7 +327,7 @@ class GaussianModel:
|
||||
|
||||
return optimizable_tensors
|
||||
|
||||
def densification_postfix(self, new_xyz, new_features_dc, new_features_rest, new_opacities, new_scaling, new_rotation):
|
||||
def densification_postfix(self, new_xyz, new_features_dc, new_features_rest, new_opacities, new_scaling, new_rotation, reset_params=True):
|
||||
d = {"xyz": new_xyz,
|
||||
"f_dc": new_features_dc,
|
||||
"f_rest": new_features_rest,
|
||||
@ -342,9 +343,10 @@ class GaussianModel:
|
||||
self._scaling = optimizable_tensors["scaling"]
|
||||
self._rotation = optimizable_tensors["rotation"]
|
||||
|
||||
self.xyz_gradient_accum = torch.zeros((self.get_xyz.shape[0], 1), device="cuda")
|
||||
self.denom = torch.zeros((self.get_xyz.shape[0], 1), device="cuda")
|
||||
self.max_radii2D = torch.zeros((self.get_xyz.shape[0]), device="cuda")
|
||||
if reset_params:
|
||||
self.xyz_gradient_accum = torch.zeros((self.get_xyz.shape[0], 1), device="cuda")
|
||||
self.denom = torch.zeros((self.get_xyz.shape[0], 1), device="cuda")
|
||||
self.max_radii2D = torch.zeros((self.get_xyz.shape[0]), device="cuda")
|
||||
|
||||
def densify_and_split(self, grads, grad_threshold, scene_extent, N=2):
|
||||
n_init_points = self.get_xyz.shape[0]
|
||||
@ -404,4 +406,126 @@ class GaussianModel:
|
||||
|
||||
def add_densification_stats(self, viewspace_point_tensor, update_filter):
|
||||
self.xyz_gradient_accum[update_filter] += torch.norm(viewspace_point_tensor.grad[update_filter,:2], dim=-1, keepdim=True)
|
||||
self.denom[update_filter] += 1
|
||||
self.denom[update_filter] += 1
|
||||
|
||||
def replace_tensors_to_optimizer(self, inds=None):
|
||||
tensors_dict = {"xyz": self._xyz,
|
||||
"f_dc": self._features_dc,
|
||||
"f_rest": self._features_rest,
|
||||
"opacity": self._opacity,
|
||||
"scaling" : self._scaling,
|
||||
"rotation" : self._rotation}
|
||||
|
||||
optimizable_tensors = {}
|
||||
for group in self.optimizer.param_groups:
|
||||
assert len(group["params"]) == 1
|
||||
tensor = tensors_dict[group["name"]]
|
||||
stored_state = self.optimizer.state.get(group['params'][0], None)
|
||||
|
||||
if inds is not None:
|
||||
stored_state["exp_avg"][inds] = 0
|
||||
stored_state["exp_avg_sq"][inds] = 0
|
||||
else:
|
||||
stored_state["exp_avg"] = torch.zeros_like(tensor)
|
||||
stored_state["exp_avg_sq"] = torch.zeros_like(tensor)
|
||||
|
||||
del self.optimizer.state[group['params'][0]]
|
||||
group["params"][0] = nn.Parameter(tensor.requires_grad_(True))
|
||||
self.optimizer.state[group['params'][0]] = stored_state
|
||||
|
||||
optimizable_tensors[group["name"]] = group["params"][0]
|
||||
|
||||
self._xyz = optimizable_tensors["xyz"]
|
||||
self._features_dc = optimizable_tensors["f_dc"]
|
||||
self._features_rest = optimizable_tensors["f_rest"]
|
||||
self._opacity = optimizable_tensors["opacity"]
|
||||
self._scaling = optimizable_tensors["scaling"]
|
||||
self._rotation = optimizable_tensors["rotation"]
|
||||
|
||||
return optimizable_tensors
|
||||
|
||||
|
||||
def _update_params(self, idxs, ratio):
|
||||
new_opacity, new_scaling = compute_relocation_cuda(
|
||||
opacity_old=self.get_opacity[idxs, 0],
|
||||
scale_old=self.get_scaling[idxs],
|
||||
N=ratio[idxs, 0] + 1
|
||||
)
|
||||
new_opacity = torch.clamp(new_opacity.unsqueeze(-1), max=1.0 - torch.finfo(torch.float32).eps, min=0.005)
|
||||
new_opacity = self.inverse_opacity_activation(new_opacity)
|
||||
new_scaling = self.scaling_inverse_activation(new_scaling.reshape(-1, 3))
|
||||
|
||||
return self._xyz[idxs], self._features_dc[idxs], self._features_rest[idxs], new_opacity, new_scaling, self._rotation[idxs]
|
||||
|
||||
|
||||
def _sample_alives(self, probs, num, alive_indices=None):
|
||||
probs = probs / (probs.sum() + torch.finfo(torch.float32).eps)
|
||||
sampled_idxs = torch.multinomial(probs, num, replacement=True)
|
||||
if alive_indices is not None:
|
||||
sampled_idxs = alive_indices[sampled_idxs]
|
||||
ratio = torch.bincount(sampled_idxs).unsqueeze(-1)
|
||||
return sampled_idxs, ratio
|
||||
|
||||
|
||||
def relocate_gs(self, dead_mask=None):
|
||||
|
||||
if dead_mask.sum() == 0:
|
||||
return
|
||||
|
||||
alive_mask = ~dead_mask
|
||||
dead_indices = dead_mask.nonzero(as_tuple=True)[0]
|
||||
alive_indices = alive_mask.nonzero(as_tuple=True)[0]
|
||||
|
||||
if alive_indices.shape[0] <= 0:
|
||||
return
|
||||
|
||||
# sample from alive ones based on opacity
|
||||
probs = (self.get_opacity[alive_indices, 0])
|
||||
reinit_idx, ratio = self._sample_alives(alive_indices=alive_indices, probs=probs, num=dead_indices.shape[0])
|
||||
|
||||
(
|
||||
self._xyz[dead_indices],
|
||||
self._features_dc[dead_indices],
|
||||
self._features_rest[dead_indices],
|
||||
self._opacity[dead_indices],
|
||||
self._scaling[dead_indices],
|
||||
self._rotation[dead_indices]
|
||||
) = self._update_params(reinit_idx, ratio=ratio)
|
||||
|
||||
self._opacity[reinit_idx] = self._opacity[dead_indices]
|
||||
self._scaling[reinit_idx] = self._scaling[dead_indices]
|
||||
|
||||
self.replace_tensors_to_optimizer(inds=reinit_idx)
|
||||
|
||||
|
||||
def add_new_gs(self, cap_max):
|
||||
current_num_points = self._opacity.shape[0]
|
||||
target_num = min(cap_max, int(1.05 * current_num_points))
|
||||
num_gs = max(0, target_num - current_num_points)
|
||||
|
||||
if num_gs <= 0:
|
||||
return 0
|
||||
|
||||
probs = self.get_opacity.squeeze(-1)
|
||||
add_idx, ratio = self._sample_alives(probs=probs, num=num_gs)
|
||||
|
||||
(
|
||||
new_xyz,
|
||||
new_features_dc,
|
||||
new_features_rest,
|
||||
new_opacity,
|
||||
new_scaling,
|
||||
new_rotation
|
||||
) = self._update_params(add_idx, ratio=ratio)
|
||||
|
||||
self._opacity[add_idx] = new_opacity
|
||||
self._scaling[add_idx] = new_scaling
|
||||
|
||||
self.densification_postfix(new_xyz, new_features_dc, new_features_rest, new_opacity, new_scaling, new_rotation, reset_params=False)
|
||||
self.replace_tensors_to_optimizer(inds=add_idx)
|
||||
|
||||
return num_gs
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 59f5f77e3ddbac3ed9db93ec2cfe99ed6c5d121d
|
||||
Subproject commit 1761eb93b8b9bfebec9fbf06af4654583c2b1ddb
|
73
train.py
73
train.py
@ -22,6 +22,7 @@ from tqdm import tqdm
|
||||
from utils.image_utils import psnr
|
||||
from argparse import ArgumentParser, Namespace
|
||||
from arguments import ModelParams, PipelineParams, OptimizationParams
|
||||
from scene.gaussian_model import build_scaling_rotation
|
||||
try:
|
||||
from torch.utils.tensorboard import SummaryWriter
|
||||
TENSORBOARD_FOUND = True
|
||||
@ -29,6 +30,9 @@ except ImportError:
|
||||
TENSORBOARD_FOUND = False
|
||||
|
||||
def training(dataset, opt, pipe, testing_iterations, saving_iterations, checkpoint_iterations, checkpoint, debug_from):
|
||||
if dataset.cap_max == -1:
|
||||
print("Please specify the maximum number of Gaussians using --cap_max.")
|
||||
exit()
|
||||
first_iter = 0
|
||||
tb_writer = prepare_output_and_logger(dataset)
|
||||
gaussians = GaussianModel(dataset.sh_degree)
|
||||
@ -48,25 +52,26 @@ def training(dataset, opt, pipe, testing_iterations, saving_iterations, checkpoi
|
||||
ema_loss_for_log = 0.0
|
||||
progress_bar = tqdm(range(first_iter, opt.iterations), desc="Training progress")
|
||||
first_iter += 1
|
||||
|
||||
for iteration in range(first_iter, opt.iterations + 1):
|
||||
if network_gui.conn == None:
|
||||
network_gui.try_connect()
|
||||
while network_gui.conn != None:
|
||||
try:
|
||||
net_image_bytes = None
|
||||
custom_cam, do_training, pipe.convert_SHs_python, pipe.compute_cov3D_python, keep_alive, scaling_modifer = network_gui.receive()
|
||||
if custom_cam != None:
|
||||
net_image = render(custom_cam, gaussians, pipe, background, scaling_modifer)["render"]
|
||||
net_image_bytes = memoryview((torch.clamp(net_image, min=0, max=1.0) * 255).byte().permute(1, 2, 0).contiguous().cpu().numpy())
|
||||
network_gui.send(net_image_bytes, dataset.source_path)
|
||||
if do_training and ((iteration < int(opt.iterations)) or not keep_alive):
|
||||
break
|
||||
except Exception as e:
|
||||
network_gui.conn = None
|
||||
# if network_gui.conn == None:
|
||||
# network_gui.try_connect()
|
||||
# while network_gui.conn != None:
|
||||
# try:
|
||||
# net_image_bytes = None
|
||||
# custom_cam, do_training, pipe.convert_SHs_python, pipe.compute_cov3D_python, keep_alive, scaling_modifer = network_gui.receive()
|
||||
# if custom_cam != None:
|
||||
# net_image = render(custom_cam, gaussians, pipe, background, scaling_modifer)["render"]
|
||||
# net_image_bytes = memoryview((torch.clamp(net_image, min=0, max=1.0) * 255).byte().permute(1, 2, 0).contiguous().cpu().numpy())
|
||||
# network_gui.send(net_image_bytes, dataset.source_path)
|
||||
# if do_training and ((iteration < int(opt.iterations)) or not keep_alive):
|
||||
# break
|
||||
# except Exception as e:
|
||||
# network_gui.conn = None
|
||||
|
||||
iter_start.record()
|
||||
|
||||
gaussians.update_learning_rate(iteration)
|
||||
xyz_lr = gaussians.update_learning_rate(iteration)
|
||||
|
||||
# Every 1000 its we increase the levels of SH up to a maximum degree
|
||||
if iteration % 1000 == 0:
|
||||
@ -75,7 +80,9 @@ def training(dataset, opt, pipe, testing_iterations, saving_iterations, checkpoi
|
||||
# Pick a random Camera
|
||||
if not viewpoint_stack:
|
||||
viewpoint_stack = scene.getTrainCameras().copy()
|
||||
viewpoint_cam = viewpoint_stack.pop(randint(0, len(viewpoint_stack)-1))
|
||||
viewpoint_cam = viewpoint_stack.pop(randint(0, len(viewpoint_stack)-1))
|
||||
else:
|
||||
viewpoint_cam = viewpoint_stack.pop(randint(0, len(viewpoint_stack)-1))
|
||||
|
||||
# Render
|
||||
if (iteration - 1) == debug_from:
|
||||
@ -84,12 +91,16 @@ def training(dataset, opt, pipe, testing_iterations, saving_iterations, checkpoi
|
||||
bg = torch.rand((3), device="cuda") if opt.random_background else background
|
||||
|
||||
render_pkg = render(viewpoint_cam, gaussians, pipe, bg)
|
||||
image, viewspace_point_tensor, visibility_filter, radii = render_pkg["render"], render_pkg["viewspace_points"], render_pkg["visibility_filter"], render_pkg["radii"]
|
||||
image = render_pkg["render"]
|
||||
|
||||
# Loss
|
||||
gt_image = viewpoint_cam.original_image.cuda()
|
||||
Ll1 = l1_loss(image, gt_image)
|
||||
loss = (1.0 - opt.lambda_dssim) * Ll1 + opt.lambda_dssim * (1.0 - ssim(image, gt_image))
|
||||
|
||||
loss = loss + args.opacity_reg * torch.abs(gaussians.get_opacity).mean()
|
||||
loss = loss + args.scale_reg * torch.abs(gaussians.get_scaling).mean()
|
||||
|
||||
loss.backward()
|
||||
|
||||
iter_end.record()
|
||||
@ -109,24 +120,26 @@ def training(dataset, opt, pipe, testing_iterations, saving_iterations, checkpoi
|
||||
print("\n[ITER {}] Saving Gaussians".format(iteration))
|
||||
scene.save(iteration)
|
||||
|
||||
# Densification
|
||||
if iteration < opt.densify_until_iter:
|
||||
# Keep track of max radii in image-space for pruning
|
||||
gaussians.max_radii2D[visibility_filter] = torch.max(gaussians.max_radii2D[visibility_filter], radii[visibility_filter])
|
||||
gaussians.add_densification_stats(viewspace_point_tensor, visibility_filter)
|
||||
|
||||
if iteration > opt.densify_from_iter and iteration % opt.densification_interval == 0:
|
||||
size_threshold = 20 if iteration > opt.opacity_reset_interval else None
|
||||
gaussians.densify_and_prune(opt.densify_grad_threshold, 0.005, scene.cameras_extent, size_threshold)
|
||||
|
||||
if iteration % opt.opacity_reset_interval == 0 or (dataset.white_background and iteration == opt.densify_from_iter):
|
||||
gaussians.reset_opacity()
|
||||
if iteration < opt.densify_until_iter and iteration > opt.densify_from_iter and iteration % opt.densification_interval == 0:
|
||||
dead_mask = (gaussians.get_opacity <= 0.005).squeeze(-1)
|
||||
gaussians.relocate_gs(dead_mask=dead_mask)
|
||||
gaussians.add_new_gs(cap_max=args.cap_max)
|
||||
|
||||
# Optimizer step
|
||||
if iteration < opt.iterations:
|
||||
gaussians.optimizer.step()
|
||||
gaussians.optimizer.zero_grad(set_to_none = True)
|
||||
|
||||
L = build_scaling_rotation(gaussians.get_scaling, gaussians.get_rotation)
|
||||
actual_covariance = L @ L.transpose(1, 2)
|
||||
|
||||
def op_sigmoid(x, k=100, x0=0.995):
|
||||
return 1 / (1 + torch.exp(-k * (x - x0)))
|
||||
|
||||
noise = torch.randn_like(gaussians._xyz) * (op_sigmoid(1- gaussians.get_opacity))*args.noise_lr*xyz_lr
|
||||
noise = torch.bmm(actual_covariance, noise.unsqueeze(-1)).squeeze(-1)
|
||||
gaussians._xyz.add_(noise)
|
||||
|
||||
if (iteration in checkpoint_iterations):
|
||||
print("\n[ITER {}] Saving Checkpoint".format(iteration))
|
||||
torch.save((gaussians.capture(), iteration), scene.model_path + "/chkpnt" + str(iteration) + ".pth")
|
||||
@ -214,7 +227,7 @@ if __name__ == "__main__":
|
||||
safe_state(args.quiet)
|
||||
|
||||
# Start GUI server, configure and run training
|
||||
network_gui.init(args.ip, args.port)
|
||||
# network_gui.init(args.ip, args.port)
|
||||
torch.autograd.set_detect_anomaly(args.detect_anomaly)
|
||||
training(lp.extract(args), op.extract(args), pp.extract(args), args.test_iterations, args.save_iterations, args.checkpoint_iterations, args.start_checkpoint, args.debug_from)
|
||||
|
||||
|
12
utils/reloc_utils.py
Normal file
12
utils/reloc_utils.py
Normal file
@ -0,0 +1,12 @@
|
||||
from diff_gaussian_rasterization import compute_relocation
|
||||
import torch
|
||||
import math
|
||||
|
||||
N_max = 51
|
||||
binoms = torch.zeros((N_max, N_max)).float().cuda()
|
||||
for n in range(N_max):
|
||||
for k in range(n+1):
|
||||
binoms[n, k] = math.comb(n, k)
|
||||
|
||||
def compute_relocation_cuda(opacity_old, scale_old, N):
|
||||
return compute_relocation(opacity_old, scale_old, N, binoms, N_max)
|
Loading…
Reference in New Issue
Block a user