npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@zappar/three-gaussian-splat

v0.1.0

Published

This library allows you to render [3D Gaussian Splats](https://github.com/graphdeco-inria/gaussian-splatting) using the 3D rendering platform ThreeJS.

Downloads

5

Readme

Gaussian Splats for ThreeJS

This library allows you to render 3D Gaussian Splats using the 3D rendering platform ThreeJS.

You may also be interested in Mattercraft, a browser based 3D content development environment perfected for building interactive experiences for the web.

Table Of Contents

Starting Development

You can use this library by installing from NPM.

NPM Package

Run the following NPM command inside your project directory:

npm install --save @zappar/three-guassian-splat

Then import the library into your JavaScript or TypeScript files:

import * as ZapSplat from '@zappar/three-guassian-splat';

Please note - This library supports Webpack 5 and later.

Quick Start

You can integrate the library with the existing requestAnimationFrame loop of your ThreeJS project. A typical project may look like this. The remainder of this document goes into more detail about each of the component elements of this example.

import * as ZapSplat from '@zappar/three-gaussian-splat';

const bonsai = new URL('./bonsai.splat', import.meta.url).href;
const maxSplats = Infinity;
const splat = new ZapSplat.GaussianSplatMesh(camera, renderer, bonsai, maxSplats);
splat.load();
scene.add(splat);

renderer.setAnimationLoop(animation);

function animation() {
  splat.update();
  renderer.render(scene, camera);
}

GitHub Templates

Explore our template project at this link: Three Gaussian Splat Example on GitHub

For a live preview, visit: Three Gaussian Splat Example Preview

GaussianSplatMesh

You can use the GaussianSplatMesh to construct the splat mesh. It takes 2 arguments.

const splat = new ZapSplat.GaussianSplatMesh(
  url, // url to .splat file
  maxSplats // Maximum number of splats to render. Default = Infinity.
);

Loading

To start loading the .splat file, call the load function.

splat.load();

You may optionally choose to provide a THREE.LoadingManager to track the loading progress:

const loadingManager = new THREE.LoadingManager();
splat.load(loadingManager);

Adding To Scene

The GaussianSplat mesh can be added to the scene like any other Object3D:

scene.add(splat);

Updating the mesh

The mesh needs to be updated before rendering. This can be done by calling the update function.

splat.update(
  camera, // THREE.PerspectiveCamera
  renderer // THREE.WebGLRenderer
);

Masking

The library provides two meshes to define invisible areas of your splat.

Sphere

A MaskingShere can be added to the GaussianSplatMesh to hide anything outside of the sphere.

const splat = new ZapSplat.GaussianSplatMesh(bonsai, Infinity);
splat.load();
scene.add(splat);

const maskSphere = new ZapSplat.MaskingSphere();

splat.addMaskMesh(maskSphere);
maskSphere.position.y = 0.9;
maskSphere.scale.setScalar(2.5);
// set to invisible once finalized position
maskSphere.visible = false;
renderer.setAnimationLoop(animation);

function animation() {
  splat.update(camera, renderer);
  renderer.render(scene, camera);
}

Plane

A MaskingPlane can be added to the GaussianSplatMesh to hide anything in the planes normal direction.

const splat = new ZapSplat.GaussianSplatMesh(bonsai, Infinity);
splat.load();
scene.add(splat);

const maskPlane = new ZapSplat.MaskingPlane();

splat.addMaskMesh(maskPlane);
renderer.setAnimationLoop(animation);

function animation() {
  splat.update(camera, renderer);
  renderer.render(scene, camera);
}

Helper

To aid development, the MaskMesh objects are rendered with a wireframe material. You can hide this by setting the visible property to false.

Performance

For devices that support SharedArrayBuffer, the sorting process within this library is significantly optimized. This feature enhances the efficiency of data handling, leading to faster rendering times and smoother user experiences.

To check if your device supports SharedArrayBuffer, please refer to https://caniuse.com/sharedarraybuffer

How do i get .splat files?

  • https://github.com/dylanebert/gsplat.js#faq

Splat format discussion https://github.com/mkkellogg/GaussianSplats3D/issues/47

License

This project is released under the MIT license. It is built upon several other open-source projects:

Please note that the license of the original 3D Gaussian Splatting research project is non-commercial. While this library provides an open-source rendering implementation, users should consider the source of the splat data separately.