• Stars
    star
    2,025
  • Rank 22,862 (Top 0.5 %)
  • Language
    C#
  • License
    MIT License
  • Created over 1 year ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Toy Gaussian Splatting visualization in Unity

Gaussian Splatting playground in Unity

SIGGRAPH 2023 had a paper "3D Gaussian Splatting for Real-Time Radiance Field Rendering" by Kerbl, Kopanas, Leimkühler, Drettakis that is really cool! Check out their website, source code repository, data sets and so on. I've decided to try to implement the realtime visualization part (i.e. the one that takes already-produced gaussian splat "model" file) in Unity.

Screenshot

Everything in this repository is based on that "OG" gaussian splatting paper. Towards end of 2023, there's a ton of new gaussian splatting research coming out; none of that is in this project.

Status as of 2023 December is that I'm not planning on any significant further developments.

Usage

⚠️ Note: this is all a toy that I'm just playing around with. If you file bugs or feature requests, I will most likely just ignore them. I told you so! ⚠️

Download or clone this repository and open projects/GaussianExample as a Unity project (I use Unity 2022.3, other versions might also work). Note that the project requires DX12 or Vulkan on Windows, i.e. DX11 will not work. This is not tested at all on mobile/web, and probably does not work there.

Next up, create some GaussianSplat assets: open Tools -> Gaussian Splats -> Create GaussianSplatAsset menu within Unity. In the dialog, point Input PLY File to your Gaussian Splat file (note that it has to be a gaussian splat PLY file, not some other PLY file. E.g. in the official paper models, the correct files are under point_cloud/iteration_*/point_cloud.ply). Optionally there can be cameras.json next to it or somewhere in parent folders.

Pick desired compression options and output folder, and press "Create Asset" button. The compression even at "very low" quality setting is decently usable, e.g. this capture at Very Low preset is under 8MB of total size (click to see the video):
Watch the video

If everything was fine, there should be a GaussianSplat asset that has several data files next to it.

Since the gaussian splat models are quite large, I have not included any in this Github repo. The original paper github page has a a link to 14GB zip of their models.

In the game object that has a GaussianSplatRenderer script, point the Asset field to one of your created assets. There are various controls on the script to debug/visualize the data, as well as a slider to move game camera into one of asset's camera locations.

The rendering takes game object transformation matrix into account; the official gaussian splat models seem to be all rotated by about -160 degrees around X axis, and mirrored around Z axis, so in the sample scene the object has such a transform set up.

Additional documentation:

That's it!

Write-ups

My own blog posts about all this:

Performance numbers:

"bicycle" scene from the paper, with 6.1M splats and first camera in there, rendering at 1200x797 resolution, at "Medium" asset quality level (282MB asset file):

  • Windows (NVIDIA RTX 3080 Ti):
    • Official SBIR viewer: 7.4ms (135FPS). 4.8GB VRAM usage.
    • Unity, DX12 or Vulkan: 8.1ms (123FPS) - 4.55ms rendering, 2.37ms sorting, 0.78ms splat view calc. 1.3GB VRAM usage.
  • Mac (Apple M1 Max):
    • Unity, Metal: 23.6ms (42FPS).

Besides the gaussian splat asset that is loaded into GPU memory, currently this also needs about 48 bytes of GPU memory per splat (for sorting, caching view dependent data etc.).

License and External Code Used

The code I wrote for this is under MIT license. The project also uses several 3rd party libraries:

However, keep in mind that the license of the original paper implementation says that the official training software for the Gaussian Splats is for educational / academic / non-commercial purpose; commercial usage requires getting license from INRIA. That is: even if this viewer / integration into Unity is just "MIT license", you need to separately consider how did you get your Gaussian Splat PLY files.

More Repositories

1

glsl-optimizer

GLSL optimizer based on Mesa's GLSL compiler. Used to be used in Unity for mobile shader optimization.
C++
1,729
star
2

ToyPathTracer

Toy path tracer for my own learning purposes (CPU/GPU, C++/C#, Win/Mac/Wasm, DX11/Metal, also Unity)
C++
1,058
star
3

ClangBuildAnalyzer

Clang build analysis tool using -ftime-trace
C++
979
star
4

hlsl2glslfork

HLSL to GLSL language translator based on ATI's HLSL2GLSL. Used in Unity.
C++
558
star
5

dod-playground

Sample OOP/ECS/DOD project (C++) for an internal Unity lecture in 2018
C++
366
star
6

smol-v

SMOL-V: like Vulkan/Khronos SPIR-V, but smaller.
C++
296
star
7

sizer

Win32/64 executable size reporting
C++
252
star
8

ToyMeshPathTracer

Toy Mesh Path Tracer that I used as a base for job interview tasks
C++
119
star
9

UnityGPUTexCompression

How to do DXT/BCn texture compression in Unity using compute shaders
C#
66
star
10

gamedev-emojis

128x128 sized icons of various game development things
Python
60
star
11

miniexr

Small code to write OpenEXR images
C++
58
star
12

demo-pd-cranktheworld

A real-time rendering demo for Playdate console
C
56
star
13

smol-atlas

2D rectangular bin packing with option for item removal
C++
53
star
14

UnityStbEasyFont

C#
47
star
15

HashFunctionsTest

Little test of various hash functions
C++
46
star
16

header_hero

Fork of Bitsquid's Header Hero tool
C#
41
star
17

BlackHoleDemo

C#
27
star
18

smol-compute

A tiny library for launching compute shaders on D3D11, Metal and Vulkan
C
26
star
19

markdeep-docs-style

Documentation CSS style for Markdeep
CSS
25
star
20

dingus

engine used in some nesnausk! demos
C++
23
star
21

glsl-load-speed

Quick test of GLSL shader loading speed
C++
17
star
22

obj_parse_tester

Comparing various C++ OBJ parsing libraries
C
17
star
23

bcn_decoder_tester

Testing various BCn texture format decoding libraries
C++
16
star
24

jobtask2019-trimesh-tracer

A programming task for job interviews I did in 2019 Q2
C++
16
star
25

bc7e-on-gpu

An attempt to port BC7E texture compressor to a GPU compute shader
HLSL
15
star
26

float_compr_tester

Testing various libraries/approaches for compressing floating point data
HTML
14
star
27

aras-p.hugo

This is just my website, content & Hugo bits
HTML
9
star
28

oklab_gradient_test

C++
6
star
29

sprint-fuuu

C++
6
star
30

sideshooter50

A game in 50 lines of code
4
star
31

twod_coverage_raster

Super simplistic 2D triangle coverage rasterizer
C
4
star
32

SoftRenderBlogProject

C
3
star
33

trianglomator

C#
3
star
34

dod-lecture-2018

C#
3
star
35

ggj19-rumba

A small game during Global Game Jam 2019
C#
3
star
36

filteression

C++
2
star
37

hgext

misc hg extension stuff
Python
1
star
38

website

PHP
1
star
39

image-formats-testbed-hack

C++
1
star