# Gaussian Splatting in Babylon.js

**URL:** <https://forum.babylonjs.com/t/gaussian-splatting-in-babylon-js/45027>\
**Category:** Completed Features\
**Created:** [October 19, 2023, 3:14am UTC](https://forum.babylonjs.com/t/gaussian-splatting-in-babylon-js/45027 "2023-10-19T03:14:48Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![labris](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/labris/32/12576_2.png) [@labris](https://forum.babylonjs.com/u/labris)\
**Post date:** [December 13, 2023, 1:47pm UTC](https://forum.babylonjs.com/t/gaussian-splatting-in-babylon-js/45027/21 "2023-12-13T13:47:11Z")

</div>

The correct method name is without the first capital letter.

```auto
loadFileAsync

```

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [December 21, 2023, 11:25pm UTC](https://forum.babylonjs.com/t/gaussian-splatting-in-babylon-js/45027/22 "2023-12-21T23:25:30Z")

</div>

It seems like this is limited to very small files, is there any future updates that will allow for larger .ply and splats to be used?

It is also very non performant as soon as you move the camera, I was going to dive into the code but a few pointers on what to look at would be nice.

All and all great work! Just trying to use this in a more production like setting now and am having some issues but it is very promising.

Are there any plans for webGPU support with this?

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [December 22, 2023, 7:48am UTC](https://forum.babylonjs.com/t/gaussian-splatting-in-babylon-js/45027/23 "2023-12-22T07:48:57Z")

</div>

We have no specific roadmap for now. As usual, we are driving our development from inputs and needs of the community.  
There is a .ply import. Do you have use-cases you’d like to see addressed?

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [December 22, 2023, 8:48am UTC](https://forum.babylonjs.com/t/gaussian-splatting-in-babylon-js/45027/24 "2023-12-22T08:48:05Z")

</div>

If we do any normal sized (100+ mbs) spat it seems to tank performance quite a bit. Also seems like when you move the camera even with the 10mb example the fps drops nearly in half.

Here is a link to some example splats.

[https://file.io/s0v8rfcrSVhv](https://file.io/s0v8rfcrSVhv)

Pretty much all of these but the gardens scene will crash the webGL context. Playcanvas is able to render them but then it seems that some of the splats do not get their affine matrix applied and appear as blue dots, which is probably because the buffers are too large.

But sites like [https://poly.cam/](https://poly.cam/) can render them no problem and at a high fps. Just wondering if there is a way to get our to work with the larger files. Im assuming its because they are using a wasm solution.

Also we probably need webGPU support!

---

<div class="post-metadata">

**Author:** ![xiasun](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/xiasun/32/36884_2.png) [@xiasun](https://forum.babylonjs.com/u/xiasun)\
**Post date:** [December 29, 2023, 7:10am UTC](https://forum.babylonjs.com/t/gaussian-splatting-in-babylon-js/45027/25 "2023-12-29T07:10:44Z")

</div>

Hello @Cedric , greeeeeeat gaussian splatting.

When I tried to load a large dataset with 2.5 million splats, I found the usage of thin instances might be a performance bottleneck, I tried to remove the sorting worker completely (ignore the rendering result mistake), but the fps is still relatively low.

Maybe we can use a single mesh containing all splat quads? This may take larger memory but will have better performance?

> [@Mesh with thin instance slower than with full vertices?](https://forum.babylonjs.com/t/mesh-with-thin-instance-slower-than-with-full-vertices/46756/6):
>
> It is strange that Three.js instanced mesh (I thought it is the equivalant of babylon instancing) with same number of quads (2.5 millions) can still run with a full fps 60. [Example here](https://jsfiddle.net/sunxia/axkzLuh4/35/) And babylon instancing as mentioned above have fps 15. @xiehangyun @Evgeni_Popov

Or do you have any other idea to improve the performance of thin instances? I would like to have a try.

Thanks~

* * *

P.S. Here’s a [threejs implementation](https://github.com/mkkellogg/GaussianSplats3D/blob/3c05854e6d998e9e7e78991e724542232d708db1/src/SplatMesh.js#L305C20-L305C20) with instancing geometry, very fast.

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [January 8, 2024, 9:51am UTC](https://forum.babylonjs.com/t/gaussian-splatting-in-babylon-js/45027/26 "2024-01-08T09:51:36Z")

</div>

I need to discuss that with @sebavan

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [January 8, 2024, 9:51am UTC](https://forum.babylonjs.com/t/gaussian-splatting-in-babylon-js/45027/27 "2024-01-08T09:51:42Z")

</div>



---

<div class="post-metadata">

**Author:** ![xiasun](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/xiasun/32/36884_2.png) [@xiasun](https://forum.babylonjs.com/u/xiasun)\
**Post date:** [January 8, 2024, 1:29pm UTC](https://forum.babylonjs.com/t/gaussian-splatting-in-babylon-js/45027/28 "2024-01-08T13:29:33Z")

</div>

Hi Cedric, I have found one of the reasons of performance issue and have an improved version.

The idea is to avoid update instance matrix (covA, covB, centers, colors) after sorting, so the instance buffer could be set to static ([dynamic is slow](https://forum.babylonjs.com/t/mesh-with-thin-instance-slower-than-with-full-vertices/46756/11)).

Gaussian info (covA, covB, centers, colors) are used as sampler2Ds, and a single splatIndex attribute is used to represent sorted index which is dynamic. In my case, the fps of 2.5 million truck.splat could be raised from 15 to 60.

I have submit a PR [here](https://github.com/BabylonJS/Babylon.js/pull/14684). Could you review it?@Cedric @sebavan

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [January 8, 2024, 1:47pm UTC](https://forum.babylonjs.com/t/gaussian-splatting-in-babylon-js/45027/29 "2024-01-08T13:47:03Z")

</div>

Sure! Can you please fix linting/formatting issues so the CI will produce a snapshot we can test?

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [January 8, 2024, 10:30pm UTC](https://forum.babylonjs.com/t/gaussian-splatting-in-babylon-js/45027/30 "2024-01-08T22:30:08Z")

</div>

Love the update !!!

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [January 11, 2024, 9:11am UTC](https://forum.babylonjs.com/t/gaussian-splatting-in-babylon-js/45027/31 "2024-01-11T09:11:23Z")

</div>



---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [February 6, 2024, 9:48am UTC](https://forum.babylonjs.com/t/gaussian-splatting-in-babylon-js/45027/34 "2024-02-06T09:48:14Z")

</div>

cc @Cedric, but we may not support this file format.

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [February 6, 2024, 9:50am UTC](https://forum.babylonjs.com/t/gaussian-splatting-in-babylon-js/45027/35 "2024-02-06T09:50:54Z")

</div>

Indeed, we don’t support that format.  
Do you have some infos on its adoption/format/usage?

---

<div class="post-metadata">

**Author:** ![Auny\_Moons](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/auny_moons/32/33053_2.png) [@Auny\_Moons](https://forum.babylonjs.com/u/Auny_Moons)\
**Post date:** [March 8, 2024, 3:33pm UTC](https://forum.babylonjs.com/t/gaussian-splatting-in-babylon-js/45027/37 "2024-03-08T15:33:58Z")

</div>

Can this be supported on XR? @Cedric you seem to know if its possible or even supported, i tried it on an AR scene trying to place a splat on a surface but it wouldnt render

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [March 8, 2024, 3:36pm UTC](https://forum.babylonjs.com/t/gaussian-splatting-in-babylon-js/45027/38 "2024-03-08T15:36:09Z")

</div>

I don’t see why it would not. can you repro in a PG so I can take a look?

---

<div class="post-metadata">

**Author:** ![Auny\_Moons](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/auny_moons/32/33053_2.png) [@Auny\_Moons](https://forum.babylonjs.com/u/Auny_Moons)\
**Post date:** [March 8, 2024, 4:05pm UTC](https://forum.babylonjs.com/t/gaussian-splatting-in-babylon-js/45027/39 "2024-03-08T16:05:24Z")

</div>

Yes just give me a minute to change the splat for something more SFW

---

<div class="post-metadata">

**Author:** ![Auny\_Moons](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/auny_moons/32/33053_2.png) [@Auny\_Moons](https://forum.babylonjs.com/u/Auny_Moons)\
**Post date:** [March 8, 2024, 4:12pm UTC](https://forum.babylonjs.com/t/gaussian-splatting-in-babylon-js/45027/40 "2024-03-08T16:12:15Z")

</div>

> **[Babylon.js Playground](https://www.babylonjs-playground.com/#U964DQ%231)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

here you go, is quite straightforward but i tested it in android and ios chrome and safari and didnt render anything, maybe im doing something wrong in the marker replacement?

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [March 8, 2024, 4:20pm UTC](https://forum.babylonjs.com/t/gaussian-splatting-in-babylon-js/45027/41 "2024-03-08T16:20:37Z")

</div>

I got the Halo GS to display on top of the camera view on my Android device. Then it vanished after a few seconds and I couldn’t get it back.  
I’m not really familiar with XR but Im sure @RaananW has some good tips.

---

<div class="post-metadata">

**Author:** ![Auny\_Moons](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/auny_moons/32/33053_2.png) [@Auny\_Moons](https://forum.babylonjs.com/u/Auny_Moons)\
**Post date:** [March 8, 2024, 4:21pm UTC](https://forum.babylonjs.com/t/gaussian-splatting-in-babylon-js/45027/42 "2024-03-08T16:21:23Z")

</div>

actually, none of the demos are working, in any of my devices, and i remember them working on my phone on chrome like a couple of weeks ago, maybe is a new unreported bug? i cant seem to do any type of hit testing demo or mesh placement demo. ( Even without the splat, just the regular demo in the documentation:

> **[Babylon.js Playground](https://playground.babylonjs.com/#XWBES1)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<div class="post-metadata">

**Author:** ![Auny\_Moons](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/auny_moons/32/33053_2.png) [@Auny\_Moons](https://forum.babylonjs.com/u/Auny_Moons)\
**Post date:** [March 8, 2024, 4:24pm UTC](https://forum.babylonjs.com/t/gaussian-splatting-in-babylon-js/45027/43 "2024-03-08T16:24:25Z")

</div>

Nevermind, i just tested everything again and indeed it does work, must have been an issue with the environment i was testing it in, maybe it wasnt detecting any surfaces and hence not rendering anything.

but can confirm, it did load the Halo GS, performance wise was a bit hard but i expected that, i intend to use small splat anyways so yay! it works

Ill test in VR during the weekend also and report back if it works too

[Previous page](https://forum.babylonjs.com/t/gaussian-splatting-in-babylon-js/45027.md?page=1)

[Next page](https://forum.babylonjs.com/t/gaussian-splatting-in-babylon-js/45027.md?page=3)
