Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
T

three-mesh-ui

> 编程语言
Open source

⏹ Make VR user interfaces for Three.js

1.5K stars0 likes1 views
WebsiteGitHub

About

⏹ Make VR user interfaces for Three.js

three-mesh-ui

Examples (live)  |  NPM  |  Documentation  |  Contributing

7.x.x is in evaluation, check it out here https://github.com/felixmariotto/three-mesh-ui/pull/223

What is it ?

three-mesh-ui is a small library for building VR user interfaces. The objects it creates are three.object3Ds, usable directly in a three.js scene like any other Object3D.

It is not a framework, but a minimalist library to be used with the last version of three.js. It has no dependency but three.js.

Why ?

In a normal three.js workflow, the common practice is to build user interfaces with HTML/CSS.

In immersive VR, it is impossible, therefore this library was created.

Quick Start

Try it now

Give it a try in this jsFiddle

Using react-three-fiber ? Here is a codesandbox to get started.

Import

JSM

With NPM

npm install three-mesh-ui :warning: It requires three as peer dependency

ES6 (codesandbox demo)
import ThreeMeshUI from 'three-mesh-ui'
CommonJS
const ThreeMeshUI = require('three-mesh-ui');
HTML <script> tag (codesandbox demo)
 
<script async src="https://unpkg.com/[email protected]/dist/es-module-shims.js"></script>
<script type="importmap">
{
    "imports": {
        "three": "https://unpkg.com/[email protected]/build/three.module.js",
        "three-mesh-ui": "https://unpkg.com/[email protected]/build/three-mesh-ui.module.js"
    }
}
</script>

<script type="module">
    import * as THREE from "three";
    import * as ThreeMeshUI from "three-mesh-ui";

    // code goes here ...
</script>

:muscle: You can use the minified version named three-mesh-ui.module.min.js (codesandbox demo)

JS

HTML <script> tag (codesandbox demo)


<script src="https://unpkg.com/[email protected]/build/three.js"></script>

<script src="https://unpkg.com/[email protected]/build/three-mesh-ui.js"></script>

<script>
    /* global THREE, ThreeMeshUI */

    // code goes here ...
</script>

:muscle: You can use the minified version named three-mesh-ui.min.js (codesandbox demo)
:warning: Although this would theorically allows you to build 'something', loading js libraries instead of using jsm, might restrict the global features you would have. This is true for both three and three-mesh-ui libraries.

Font files

In order to display some text with three-mesh-ui, you will need to provide font files.
You can use the two files named Roboto-msdf in this directory, or create your own font files

API

Here is an example of basic three-mesh-ui usage :

const container = new ThreeMeshUI.Block({
 width: 1.2,
 height: 0.7,
 padding: 0.2,
 fontFamily: './assets/Roboto-msdf.json',
 fontTexture: './assets/Roboto-msdf.png',
});

//

const text = new ThreeMeshUI.Text({
 content: "Some text to be displayed"
});

container.add( text );

// scene is a THREE.Scene (see three.js)
scene.add( container );

// This is typically done in the render loop :
ThreeMeshUI.update();

GitHub Issues· 74 open

View all on GitHub
  • #285

    Are there plans to add scroll-view and input components?

    Updated Mar 31, 2026
  • #281

    VR Text update lag

    Updated Jul 24, 2025
  • #284

    Documentation: Creating your own fonts: charset is missing ß

    Updated Jul 3, 2025
  • #283

    Changing whiteSpace breaks bestFit: 'shrink'

    Updated Jan 14, 2025
  • #282

    Text align ignores width of glyph

    Updated Jan 14, 2025
  • #216

    Examples on Website have Glitchy Artifacts in WebXR / Oculus Quest 2

    Updated Nov 27, 2024
  • #279

    THREE is Not Defined

    Updated Aug 2, 2024
  • #276

    Problem with NULL data in SVGTypographicGlyph.js

    Updated Jun 19, 2024
  • #278

    Examples of a dropdown or scrollfield?

    Updated Jun 7, 2024
  • #275

    Bug in change language

    Updated Mar 11, 2024

> Tags

JavaScript

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言