3D Gaussian Splatting

3D Gaussian Splatting for Real-Time Radiance Field Rendering (SIGGRAPH 2023)

3D Gaussian Splatting for Real-Time Radiance Field Rendering

Bernhard Kerbl, Georgios Kopanas, Thomas Leimkühler, George Drettakis

paper :
https://arxiv.org/abs/2308.04079
project website :
https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/
code :
https://github.com/graphdeco-inria/gaussian-splatting
code review :
https://semyeong-yu.github.io/blog/2024/3DGScode/
referenced blog :
https://xoft.tistory.com/51

포스팅을 시작하기에 앞서…
본 글은 직접 논문을 읽으며 정리한 내용이고
더 깔끔한 핵심 정리만 보고 싶다면
3DGS 분석1, 3DGS 분석2 글 괜찮아보임

3DGS Code 리뷰한 내 포스팅도 있음 3DGS 코드분석

Abstract

Introduction

Why 3D Gaussian?

3D scene representation 방법

  1. Mesh or Point
    • explicit
    • good for fast GPU/CUDA-based rasterization(3D \(\rightarrow\) 2D)
  2. NeRF method
    • implicit (MLP로 geometry 및 appearance를 표현)
    • ray marching
    • continuous coordinate-based representation
    • interpolate values stored in voxels, hash grids, or points
    • But,,, continuous ray로부터 discrete points를 뽑아 내는 stochastic sampling for rendering 때문에 연산량이 많고 noise 생김
    • MLP는 dot product 및 더하기(kernel regression)의 특성상 orthogonality를 흐리기 때문에 high-freq. output을 잘 표현할 수 없어서 따로 미리 positional encoding을 수행
  3. 3D Gaussian method
    • explicit (3D Gaussian으로 geometry를, SH coeff.로 appearance를 표현)
    • differentiable volumetric representation
    • efficient rasterization(projection and \(\alpha\)-blending)
    • 3D Gaussian(ellipsoid)이나 SH coeff.라는 explicit 표현 자체가 orthogonality를 잘 살리기 때문에 high-freq. output 잘 표현 가능

Rendering (NeRF vs 3DGS)

생략 (추후에 다시 볼 수도)

Overview

For unbounded and complete scenes,
For 1080p high resolution and real-time(\(\geq\) 30 fps) rendering,

  1. input :
    • Most point-based methods require MVS(Multi-View Stereo) data,
      but 3DGS only needs SfM points for initialization
    • COLMAP 등 SfM(Structure-from-Motion) camera calibration으로 얻은 sparse point cloud에서 시작해서
      scene을 3D Gaussians로 나타냄으로써
      empty space에서의 불필요한 계산을 하지 않도록 continuous volumetric radiance fields 정보를 저장
    • NeRF-synthetic dataset의 경우 bg가 없어서 3DGS random initialization으로도 좋은 퀄리티 달성
  2. optimization interleaved with adaptive density control :
    • optimize 4 parameters :
      3D position(mean), anisotropic covariance, opacity, and spherical harmonic coeff.(color)
      highly anisotropic volumetric splatsfine structures를 compact하게 나타낼 수 있음!!
      spherical harmonics를 통해 directional appearance(color)를 잘 나타낼 수 있음!![1], [2]
    • adaptive density control :
      gradient 기반으로 Gaussian 형태를 변화시키기 위해, add and occasionally remove 3D Gaussians during optimization
  3. differentiable visibility-aware real-time rendering :
    perform \(\alpha\)-blending of anisotropic splats respecting visibility order
    by fast GPU sorting algorithm and tile-based rasterization(projection and \(\alpha\)-blending)
    한편, accumulated \(\alpha\) values를 tracking함으로써 Gaussians 수에 제약 없이 빠른 backward pass도 가능

Pseudo-Code

빨간 박스 : initialization
파란 박스 : optimization
초록 박스 : 특정 iter.마다 Gaussian을 clone, split, remove

Differentiable 3D Gaussian Splatting

3D Gaussian

Parameters to train

  1. scale vector \(s\) and quaternion \(q\) for covariance matrix
  2. spherical harmonics(SH) coeff. for color
  3. opacity \(\alpha\)
  4. 3D position for mean

Parameter 1. Covariance matrix

scale vector(scale) and quaternion(rotation) for covariance matrix

\(\Sigma\) 가 symmetric and positive semi-definite이도록 \(\Sigma = R S S^T R^T\) 로 정의해서
\(\Sigma\) 대신 x,y,z-axis scale을 나타내는 3D vector \(s\) 와 rotation을 나타내는 4D quaternion \(q\) 를 optimize 하자!!
quaternion에 대한 설명은 Quaternion 블로그 참고!!

EWA volume splatting (2001) [14] [15] :
world-to-camera 는 linear transformation 이지만,
camera-to-image (projection)non-linear transformation 이다!!

위 그림 : camera coordinate / 아래 그림 : image coordinate (ray space)

Projection of 3D Gaussian covariance to 2D

param. gradient 직접 유도 (Appendix A.)

training할 때 automatic differentiation으로 인한 overhead를 방지하기 위해 param. gradient를 직접 유도함!

  1. By chain rule, \(\frac{d\Sigma^{\ast}}{ds} = \frac{d\Sigma^{\ast}}{d\Sigma}\frac{d\Sigma}{ds}\) and \(\frac{d\Sigma^{\ast}}{dq} = \frac{d\Sigma^{\ast}}{d\Sigma}\frac{d\Sigma}{dq}\)

  2. By covariance dimension reduction, \(\Sigma^{\ast}\) 는 \(U \Sigma U^T\) 의 좌상단 2-by-2 matrix
    where \(U = JW\)
    So, 편미분 값은 \(\frac{d\Sigma^{\ast}}{d\Sigma_{ij}} = \begin{bmatrix} U_{1, i} U_{1, j} & U_{1, i} U_{2, j} \\ U_{1, j} U_{2, i} & U_{2, i} U_{2, j} \end{bmatrix}\)

  3. For symmetric and positive semi-definite property of covariance matrix, we set \(\Sigma = MM^T\)
    where \(M = RS\)
    So, \(\frac{d\Sigma}{ds} = \frac{d\Sigma}{dM} \frac{dM}{ds}\) and \(\frac{d\Sigma}{dq} = \frac{d\Sigma}{dM} \frac{dM}{dq}\)
    where \(\frac{d\Sigma}{dM} = 2M^T\)

  4. \(M = RS\)
    where \(S = \begin{bmatrix} s_x & s_x & s_x \\ s_y & s_y & s_y \\ s_z & s_z & s_z \end{bmatrix}\)
    So, \(\frac{dM_{i, j}}{ds_k} = \begin{cases} R_{i, k} & \text{if j=k} \\ 0 & O.W. \end{cases}\)

  5. \(M = RS\) and \(R(q) = \begin{bmatrix} 1 - 2 \cdot (q_j^2 + q_k^2) & 2 \cdot (q_iq_j - q_rq_k) & 2 \cdot (q_iq_k + q_rq_j) \\ 2 \cdot (q_iq_j + q_rq_k) & 1 - 2 \cdot (q_i^2 + q_k^2) & 2 \cdot (q_jq_k - q_rq_i) \\ 2 \cdot (q_iq_k - q_rq_j) & 2 \cdot (q_jq_k + q_rq_i) & 1 - 2 \cdot (q_i^2 + q_j^2) \end{bmatrix}\)
    where \(q = \begin{bmatrix} q_r \\ q_i \\ q_j \\ q_k \end{bmatrix}\)
    So, \(\frac{dM}{dq_r} = 2 \begin{bmatrix} 0 & -s_y q_k & s_z q_j \\ s_x q_k & 0 & -s_z q_i \\ -s_x q_j & s_y q_i & 0 \end{bmatrix}\)
    and \(\frac{dM}{dq_i} = 2 \begin{bmatrix} 0 & s_y q_j & s_z q_k \\ s_x q_j & -2 s_y q_i & -s_z q_r \\ s_x q_k & s_y q_r & -2 s_z q_i \end{bmatrix}\)
    and \(\frac{dM}{dq_j} = 2 \begin{bmatrix} -2 s_x q_j & s_y q_i & s_z q_r \\ s_x q_i & 0 & s_z q_k \\ -s_x q_r & s_y q_k & -2 s_z q_j \end{bmatrix}\)
    and \(\frac{dM}{dq_k} = 2 \begin{bmatrix} -2 s_x q_k & -s_y q_r & s_z q_i \\ s_x q_r & -2 s_y q_k & s_z q_j \\ s_x q_i & s_y q_j & 0 \end{bmatrix}\)

  6. gradient for quaternion normalization is straightforward

Parameter 2. Spherical Harmonics(SH) coeff.

l이 같은 함수들은 same band l에 있다고 말함
가로축 : theta, 세로축 : phi, 채도 : SH magnitude, 색상 : SH phase

Parameter 3. opacity

Parameter 4. 3D position(mean)

Fast Differentiable Rasterizer for Gaussians

Tile Rasterizer

from collections import deque
# 양방향에서 삽입/삭제 가능한 queue형 자료구조

# 1의 자릿수 기준으로 정렬한 뒤
# 10의 자릿수 기준으로 정렬한 뒤
# ...
def radixSort():
    nums = list(map(int, input().split(' ')))
    buckets = [deque() for _ in range(10)] # 각 자릿수(0~9)에 대응되는 10개의 empty deque()
    
    max_val = max(nums)
    queue = deque(nums) # 정렬할 숫자들
    digit = 1 # 정렬 기준이 되는 자릿수
    
    while (max_val >= digit): # 가장 큰 수의 자릿수일 때까지만 실행
        while queue:
            num = queue.popleft() # 정렬할 숫자
            buckets[(num // digit) % 10].append(num) # 각 자릿수(0~9)에 따라 buckets에 num을 넣는다.
        
        # 해당 정렬 기준 자릿수에서 buckets에 다 넣었으면, buckets에 담겨있는 순서대로 꺼내와서 정렬한다.
        for bucket in buckets:
            while bucket:
                queue.append(bucket.popleft())

        digit *= 10 # 정렬 기준이 되는 자릿수 증가시키기
    
    print(list(queue))

Optimization with Adaptive Density Control of 3D Gaussians

Optimization

Adaptive Density Control of Gaussians

optimization of 4 param.의 경우 매 iter.마다 update하지만,
Adaptive Density Control of Gaussians의 경우 100 iter.마다 update

Results

Implementation

Evaluation

7K iter.으로도 꽤 좋은 결과

Space Carving :

  • 설명 : 여러 camera에 대해 voxel-space에서 object 있는 부분만 남기고 깎아내는 기법
  • 이유 : 3D reconstruction을 할 때 color 정보만으로 segmentation 가능할 정도로 background는 simple할수록 좋기 때문
  • 한계 : 빛, 그림자 같은 정보는 사용하지 않기 때문에 fg/bg 판단만 가능하다. 따라서 lidar처럼 camera에 depth-detection 메커니즘이 없을 경우 물체 내부의 구멍 같은 건 reconstruct 불가능

Ablation Study

PSNR score for Ablation Study
left: N=10 / right: N=inf

Discussion

Limitations & Future Work

left(Mip-NeRF360): floaters and grainy(오돌토돌한, 거친) appearance / right(3DGS): low-detail bg from coarse Gaussians
training에서 많이 보지 못한 view의 경우 left(Mip-NeRF360), right(3DGS) 모두 artifacts 발생

Conclusion

Question