Skip to content

omigroup/three-omi

Repository files navigation

Three.js OMI glTF extensions

This repository contains Three.js implementations of OMI glTF extensions.

Try it out here: https://omigroup.github.io/three-omi/

Run the demo locally

Assuming you have Node.js 18+ installed, including the npm and npx commands, run these commands to clone the repository and start a local server:

git clone https://github.com/omigroup/three-omi
cd three-omi
npm install
npx vite

Using the library in your Three.js project

Install with this command:

npm install -S three three-omi

Then use it like this:

import * as THREE from "three";
import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js";
import { GLTFLoaderAudioEmitterExtension } from "three-omi/src/khr_audio_emitter.js";

// Set up your scene, camera, and renderer here.

// The extension needs a reference to your AudioListener.
// Make sure you have one added as a child of your camera.
const listener = new THREE.AudioListener();
camera.add(listener);

// Create a glTF loader and register the extension.
const gltfLoader = new GLTFLoader();
gltfLoader.register((parser) => new GLTFLoaderAudioEmitterExtension(parser, listener));

gltfLoader.load(
	"path/to/your/model.glb",
	function (generated) {
		scene.add(generated.scene);
	},
	undefined,
	function (error) {
		console.error(error);
	}
);

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •