# troika-three-utils

> Various utilities related to Three.js

Latest version **0.52.5** (published 2026-07-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install troika-three-utils
pnpm add troika-three-utils
yarn add troika-three-utils
bun add troika-three-utils
```

## Health

**Score 60/100 (C)** — status: active.

Positive: esm support; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.52.5 |
| Published | 2026-07-24 |
| First published | 2019-08-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 157.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1971 |
| Author | Jason Johnston |
| Maintainers | lojjic |

## Links

- npm: https://www.npmjs.com/package/troika-three-utils
- Repository: https://github.com/protectwise/troika
- Homepage: https://github.com/protectwise/troika#readme
- Issues: https://github.com/protectwise/troika/issues
- npm.io page: https://npm.io/package/troika-three-utils

## Recent versions

- 0.52.5 (latest) — 2026-07-24
- 0.53.0 — 2026-07-24
- 0.52.4 — 2025-04-02
- 0.52.0 — 2024-11-11
- 0.51.0 — 2024-11-10
- 0.50.3 — 2024-11-01
- 0.50.0 — 2024-10-11
- 0.49.0 — 2023-10-08
- 0.48.0 — 2023-09-09
- 0.47.2 — 2023-05-15
- 0.47.0 — 2022-12-15
- 0.46.0 — 2022-03-05
- 0.45.0 — 2022-01-02
- 0.44.0 — 2021-11-14
- 0.43.0 — 2021-09-20
- … 34 more at https://npm.io/package/troika-three-utils/versions

## README

# Troika Three.js Utilities

This package provides various utilities for working with [Three.js](https://github.com/mrdoob/three.js), particularly having to do with shaders. It is used by [Troika 3D](../troika-3d), but has no dependencies itself other than Three.js, so it can be used outside the Troika framework.


## Installation

Get it from [NPM](https://www.npmjs.com/package/troika-three-utils):

```sh
npm install troika-three-utils
```

You will also need to install a compatible version of [Three.js](https://threejs.org); see the [notes on Three.js versions in the Getting Started docs](../../docs/getting-started/setup.md#threejs) for details.

```sh
npm install three
```


## Provided Utilities

Several utilities are provided; for a full list follow the imports in [index.js](./src/index.js) to their source files, where each is documented in JSDoc comments.

Some of the most useful ones are:


### createDerivedMaterial()

This utility allows you to easily _extend_ existing Three.js materials with your own custom shader code. This is an incredibly powerful tool, and is the  secret behind most of Troika's shader-driven tools like `troika-three-text`, `three-instanced-uniforms-mesh`, and `BezierMesh`. 

See the [createDerivedMaterial documentation page](./docs/createDerivedMaterial.md) and its [source code with JSDoc](./src/DerivedMaterial.js) for details.


### BezierMesh

This creates a cylindrical mesh and bends it along a 3D cubic bezier path between two points, in a custom derived vertex shader. This is useful for visually connecting objects in 3D space with a line that has thickness to it.

See the [BezierMesh documentation page](./docs/BezierMesh.md) and its [source code with JSDoc](./src/BezierMesh.js) for details.


### InstancedUniformsMesh

> NOTE: InstancedUniformsMesh has been moved to [its own `three-instanced-uniforms-mesh` package](https://github.com/protectwise/troika/tree/master/packages/three-instanced-uniforms-mesh).

---
_Source: https://npm.io/package/troika-three-utils · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
