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 🙏

© 2026 – Pkg Stats / Ryan Hefner

three-impostor

v0.4.2

Published

Box and octahedral impostors for three.js WebGPU

Readme

three-impostor

Impostors for three.js WebGPURenderer.

Demo

An object is captured once into textures. It can then be drawn as a box of 12 triangles whose shader reconstructs the object from those textures and shades it through the usual three.js lighting. Each pixel writes its depth, so impostors intersect each other and the rest of the scene.

There are two layouts:

  • 'box' captures six views and ray marches them. It gives true depth, looks the same from every angle and holds up at closer range.
  • 'octahedral' captures a grid of views from around the object and blends the three nearest. It's cheaper per pixel and suits objects further away.
npm install three-impostor
import * as THREE from 'three/webgpu';
import { ImpostorBaker, ImpostorNodeMaterial } from 'three-impostor';

const baker = new ImpostorBaker( renderer );
const near = await baker.bake( mesh );
const far = await baker.bake( mesh, { layout: 'octahedral' } );

const lod = new THREE.LOD();
lod.addLevel( mesh, 0 );
lod.addLevel( new THREE.Mesh( near.geometry, new ImpostorNodeMaterial( near ) ), 20 );
lod.addLevel( new THREE.Mesh( far.geometry, new ImpostorNodeMaterial( far ) ), 60 );

Many copies work with InstancedMesh:

const forest = new THREE.InstancedMesh( far.geometry, new ImpostorNodeMaterial( far ), 5000 );

API

new ImpostorBaker( renderer )

bake( object, options ) captures object in its local space and returns a promise for an ImpostorData. The object's own position, rotation and scale are ignored, so give the impostor the same transform as the object.

  • layout: 'box' (default) or 'octahedral'
  • resolution: the size in pixels of each view (default 256 for box, 128 for octahedral)
  • frames: octahedral only, the number of views along each side of the grid (default 12)
  • hemisphere: octahedral only, capture views from above only, for objects never seen from below (default false)
  • maps: the material properties to capture besides colour and normals, any of 'roughness', 'metalness', 'ao' and 'emissive' (default all four). Leave out the ones you don't need to save memory; [] captures none.

ImpostorData

  • layout: the layout it was captured with
  • box: the box the object was captured in, in local space
  • geometry: a box geometry to draw the impostor with
  • maps: the material properties that were captured. 'emissive' is left out when nothing on the object is emissive.
  • colorMap, normalMap, materialMap, emissiveMap, intervalMap, rangeMap, distanceMap: the captured textures. materialMap holds roughness, metalness and ambient occlusion and emissiveMap emissive light, when captured; intervalMap, rangeMap and distanceMap are box only.
  • dispose()

new ImpostorNodeMaterial( impostor, parameters )

A MeshStandardNodeMaterial, so color, roughness, metalness and the other standard parameters apply. color tints the captured colour, and roughness and metalness scale the captured values like they do a texture map. When a property wasn't captured, the material's own value is used.

  • steps: box only, the largest number of ray steps for a pixel (default 128). A step either crosses empty space, up to 13 blocks of 8 texels at once, or moves a texel and a half through a block that may hold a surface.

Notes

  • Requires three.js r186 or later. Works with both the WebGPU and WebGL 2 backends of WebGPURenderer.
  • The capture records base colour and normals, plus whichever of roughness, metalness, ambient occlusion and emissive light maps asks for. Roughness, metalness and ambient occlusion share one 8-bit atlas, so leaving out only some of them saves no memory; emissive light has its own.
  • Box: each axis keeps the first gap inside the object, so a part in front of another, like a leg in front of a body, stays separate. Deeper hollows that can't be seen from any of the six sides are filled in. Gaps are found from back faces, so they work best with closed meshes. Where a mesh is open, like a scan with no base, the object is taken to run on to the side of the box it opens towards.
  • GPU memory at the default sizes: box about 8 MB, plus 1.5 MB for roughness, metalness and ambient occlusion and 3 MB for emissive light; octahedral about 38 MB, plus 9 MB and 19 MB.
  • Octahedral: silhouettes are slightly softer.
  • Impostors don't cast shadows yet.