pierotofy / OpenSplat

Production-grade 3D gaussian splatting with CPU/GPU support for Windows, Mac and Linux 🚀
https://antimatter15.com/splat/?url=https://splat.uav4geo.com/banana.splat
GNU Affero General Public License v3.0
892 stars 86 forks source link

loading null functions on MacOS #130

Open twixupmysleeve opened 1 month ago

twixupmysleeve commented 1 month ago

I followed the instructions to build and downloaded the banana folder to test it out. It steps through 0 till 2000 but the final ply model is empty. I see that when initially loading functions, it is returning null.

First, it successfully loads the images:

❯ ./opensplat /Users/pats/Downloads/banana -n 2000
Using MPS
Reading 14241 points
Loading /Users/pats/Downloads/banana/images/frame_00001.JPGLoading
/Users/pats/Downloads/banana/images/frame_00003.JPG
Loading /Users/pats/Downloads/banana/images/frame_00005.JPGLoading /Users/pats/Downloads/banana/images/frame_00008.JPG

Loading /Users/pats/Downloads/banana/images/frame_00015.JPG
Loading /Users/pats/Downloads/banana/images/frame_00010.JPG
Loading /Users/pats/Downloads/banana/images/frame_00013.JPG
Loading /Users/pats/Downloads/banana/images/frame_00014.JPG
Loading /Users/pats/Downloads/banana/images/frame_00004.JPG
Loading /Users/pats/Downloads/banana/images/frame_00002.JPG
Loading /Users/pats/Downloads/banana/images/frame_00006.JPG
Loading /Users/pats/Downloads/banana/images/frame_00016.JPG
Loading /Users/pats/Downloads/banana/images/frame_00009.JPG
Loading /Users/pats/Downloads/banana/images/frame_00011.JPG

It also seems to successfully load the libraries right after this, but then the load functions keep returning null:

init_gsplat_metal_context: loading '/Users/pats/Library/CloudStorage/OneDrive-Personal/Georgie/Polo/3DGS/OpenSplat/build/default.metallib'
init_gsplat_metal_context: loaded '/Users/pats/Library/CloudStorage/OneDrive-Personal/Georgie/Polo/3DGS/OpenSplat/build/default.metallib', functions: compute_cov2d_bounds_kernel, project_gaussians_backward_kernel, get_tile_bin_edges_kernel, rasterize_backward_kernel, map_gaussian_to_intersects_kernel, nd_rasterize_backward_kernel, project_gaussians_forward_kernel, compute_sh_backward_kernel, compute_sh_forward_kernel, nd_rasterize_forward_kernel
init_gsplat_metal_context: load function nd_rasterize_backward_kernel with label: (null)
init_gsplat_metal_context: load function nd_rasterize_forward_kernel with label: (null)
init_gsplat_metal_context: load function rasterize_backward_kernel with label: (null)
init_gsplat_metal_context: load function project_gaussians_forward_kernel with label: (null)
init_gsplat_metal_context: load function project_gaussians_backward_kernel with label: (null)
init_gsplat_metal_context: load function compute_sh_forward_kernel with label: (null)
init_gsplat_metal_context: load function compute_sh_backward_kernel with label: (null)
init_gsplat_metal_context: load function compute_cov2d_bounds_kernel with label: (null)
init_gsplat_metal_context: load function map_gaussian_to_intersects_kernel with label: (null)
init_gsplat_metal_context: load function get_tile_bin_edges_kernel with label: (null)
Step 10: 0.208454
.
.
.

cameras.json is not empty but splat.ply is completely empty and doesn't render online or even on the Mac Viewer. I have a Macbook Pro with M1 Pro 16G memory, running Sonoma 14.0

pierotofy commented 1 month ago

Does it work with --cpu? If so, this might be some issue with the MPS backend/rasterizer.

luizgbraga commented 1 month ago

Hey,

I'm having a very similar issue on my Macbook Air M2 8GB RAM. Everything builds and runs, however the .ply file is empty on the viewer. However, I just tried the banana on --cpu with 500 iterations and it worked fine, but taking longer. Seems like a MPS issue.

xipherx commented 1 month ago

Same issue here, with --cpu it works!

ouceduxzk commented 2 weeks ago

me too, seems like the gpu support on mac is still buggy

zctu commented 1 week ago

Same issue on Mac M2 metal version. As for the banana example, everything is OK until the 22th iteration, when the 1457th point becomes: [ nan, nan, nan, 0. , 0. ,0. , 0.28498277, 0.28498277, 0.28498277, ...... , -1.3643292 , nan, nan, nan, nan, nan, nan, nan]. I think there exists probability the data lost its value and becomes nan, and we should pass the iteration if it happens.