viser icon indicating copy to clipboard operation
viser copied to clipboard

Gaussian splatting + WebGL

Open brentyi opened this issue 2 years ago • 7 comments

I spent some time studying + adapting https://github.com/antimatter15/splat/. It's really cool stuff.

https://github.com/nerfstudio-project/viser/assets/6992947/744329df-463a-4458-a19e-f72d0c052c87

Work in progress: there's a lot of low hanging fruit for optimization, and the current implementation clashes with the <EffectComposer /> we use for outline/hover effects.

brentyi avatar Oct 01 '23 12:10 brentyi

Hey, I just tried to run the demo with Chrome and Firefox, but my display is getting incredibly slow. GPU and CPU usage stays low.

Ubuntu 22.04 LTS + GTX3080 Chrome: 117.0.5938.132 (64-bit) Firefox: 117.0.1 (64-bit) NVIDIA-SMI 525.125.06 Driver Version: 525.125.06

Does anyone have an idea what the problem could be?

brgrp avatar Oct 04 '23 15:10 brgrp

Can you confirm hardware acceleration is enabled (chrome://gpu)?

jkulhanek avatar Oct 04 '23 15:10 jkulhanek

Can you confirm hardware acceleration is enabled (chrome://gpu)?

Graphics Feature Status

  • Canvas: Hardware accelerated
  • Canvas out-of-process rasterization: Enabled
  • Direct Rendering Display Compositor: Disabled
  • Compositing: Hardware accelerated
  • Multiple Raster Threads: Enabled
  • OpenGL: Enabled
  • Rasterization: Hardware accelerated
  • Raw Draw: Disabled
  • Skia Graphite: Disabled
  • Video Decode: Hardware accelerated
  • Video Encode: Software only. Hardware acceleration disabled
  • Vulkan: Disabled
  • WebGL: Hardware accelerated
  • WebGL2: Hardware accelerated
  • WebGPU: Hardware accelerated

brgrp avatar Oct 06 '23 08:10 brgrp

Which splat file are you loading? Splats are currently rendering smoothly in Chrome on both my laptop (M1 Mac) and phone (Samsung S21+).

brentyi avatar Oct 06 '23 23:10 brentyi

sort timing notes:

# Gaussians 270K 1M
Array.sort 79ms 380ms
JS counting sort 25ms 140ms
C++ counting sort 14ms 53ms

brentyi avatar Oct 10 '23 03:10 brentyi

What is the current state of things? Is it ready to be merged soon?

jkulhanek avatar Dec 29 '23 19:12 jkulhanek

I'm leaning toward closing the PR; it's working, but:

  • Still clashes with outline effects / EffectComposer.
  • Doesn't sort properly when there are multiple splat files.
  • Can be optimized a lot. (in particular I would want to move more data into textures, as opposed to attributes)

After I implemented this splatting capabilities have also popped up in external libraries (example: https://github.com/pmndrs/drei#Splat); it may make sense to adapt one of these instead.

brentyi avatar Dec 29 '23 20:12 brentyi

Any progress?

a1raman avatar Aug 06 '24 04:08 a1raman

This is merged and the majority of kinks are worked out, but it'll be a while before it hits the stable API.

If you want to try it you can install viser from source and call server.scene._add_gaussian_splats() (or run the example in the examples/experimental directory): https://github.com/nerfstudio-project/viser/blob/ba17c7c40c955a85c845b685a767fbdd9bac6ba2/src/viser/_scene_api.py#L935-L963

brentyi avatar Aug 06 '24 07:08 brentyi

I ran the command python examples/experimental/gaussian_splats.py --splat-paths ~/data/test1-splat/point_cloud/iteration_30000/point_cloud.ply. It successfully loaded the ply file with the message "PLY file with num_gaussians=410549 loaded in 0.6525325775146484 seconds". But when I opened http://0.0.0.0:8080, it shows a blank web page in my browser.

fantasy-fish avatar Aug 26 '24 07:08 fantasy-fish