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

playcanvas-opti-pixel

v1.2.0

Published

GPU instancing, LOD, BVH frustum culling, and occlusion culling for [PlayCanvas](https://playcanvas.com/).

Readme

playcanvas-opti-pixel

GPU instancing, LOD, BVH frustum culling, and occlusion culling for PlayCanvas.

The library is built around a few independent systems that share the same ID and AABB conventions. Use only what you need.

| System | Start here | | --- | --- | | Hierarchical GPU instancing + LOD | Choosing an instancer | | Occlusion culling (HZB, queries, CPU software) | Choosing an occlusion backend | | Bounding volume hierarchy | BVH | | Shared stores, queues, data textures | Extras |

Full table of contents: docs/README.md.

Install

npm install playcanvas-opti-pixel playcanvas

Peer: PlayCanvas 2.x (developed against playcanvas@^2.19). WebGL2 and WebGPU are both supported; not every occlusion backend is available on both.

import {
    HierarchicalInstancer,
    AABBStore,
    SoftwareOcclusionTester,
    OCCLUSION_OCCLUDED,
} from "playcanvas-opti-pixel";

Minimal examples

Instancing with two LOD levels:

const instancer = new HierarchicalInstancer(app.graphicsDevice, { capacity: 1024 });
instancer.addLOD(lod0MeshInstances, rootEntity, 0);
instancer.addLOD(lod1MeshInstances, rootEntity, 40);

for (let i = 0; i < count; i++) {
    instancer.setMatrixAt(i, matrices[i]);
}

instancer.computeBVH();

app.on("update", (dt) => {
    instancer.update(dt, camera.camera, camera.getPosition());
});

CPU software occlusion (skip draws that fail the last completed test):

const aabbs = new AABBStore(app.graphicsDevice, 4096);
const tester = new SoftwareOcclusionTester(aabbs, { width: 256, height: 128 });

const occludeeId = tester.lock(worldAabb);
tester.occluders.lockBox(occluderWorldMatrix);

app.on("update", (dt) => {
    tester.enqueue(occludeeId);
    tester.execute(camera.camera);
    tester.frameUpdate(dt);

    if (tester.getOcclusionStatus(occludeeId) !== OCCLUSION_OCCLUDED) {
        // draw — treat OCCLUSION_UNKNOWN as visible
    }
});

OCCLUSION_UNKNOWN (-1) means there is no finished result yet. Draw in that case; do not hide the object.

Module map

Exports live in src/index.ts.

  • InstancerBasicHierarchicalInstancer, SimpleHierarchicalInstancer, HierarchicalInstancer, BasicArrayHierarchicalInstancer, LOD fade helpers
  • OcclusionOcclusionCullingSystem, HZB (WebGL / WebGPU), occlusion queries (WebGL), SoftwareOcclusionTester + OccluderStore
  • BVHBVH, HybridBuilder
  • ExtrasAABBStore, square / mat4 / color data textures, index and GPU queues

Internal worker code, HZB shaders, and buffer layouts are not part of the public docs. See comments in src/ if you are changing the implementation.

API reference: GitHub Pages (built on main). Locally: npm run docs:apidocs/api/index.html.

License

Apache-2.0