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

nano-webgpu

v0.11.0

Published

A lightweight, fast, and ergonomic WebGPU 3D graphics library for TypeScript and JavaScript.

Downloads

13

Readme

nano-webgpu

npm version license bundle size

A lightweight, fast, and ergonomic 3D WebGPU graphics library for TypeScript and JavaScript.

nano-webgpu simplifies 3D graphics rendering on the web by wrapping raw WebGPU APIs into a clean, modern, and developer-friendly scene graph interface, without compromising performance or flexibility.


✨ Features

  • ⚡ Native WebGPU Engine: Built ground-up on WebGPU for next-generation rendering performance.
  • 🎨 Ergonomic Scene Graph: High-level abstractions (Scene, Node3D, Mesh, Camera) for rapid 3D development.
  • 💡 Lighting & Shadows: Support for DirectionalLight, PointLight, and SpotLight with shadow mapping (ShadowSystem).
  • 💎 PBR & Custom Shaders: StandardMaterial with metallic/roughness properties + ShaderMaterial for custom WGSL shaders.
  • 🌸 Post-Processing: Integrated bloom system (BloomSystem) for high-quality glow effects.
  • 🎥 Camera Controllers: Ready-to-use Orbit, First-Person, and Third-Person camera controls.
  • 📦 3D Model Loader: Built-in loader for GLTF / GLB 3D models with materials and textures.
  • 🧮 Math Suite: Included 3D math library (Vec2, Vec3, Mat4, Quaternion, Color, AABB).
  • 📊 Debug & Profiling: Built-in performance monitor (PerformanceTracker), VRAMTracker, and debug panel.
  • 📘 100% TypeScript: Full type definitions included out of the box.

📦 Installation

Install via npm, pnpm, or yarn:

# Using npm
npm install nano-webgpu

# Using pnpm
pnpm add nano-webgpu

# Using yarn
yarn add nano-webgpu

🚀 Quick Start

Here is a simple example showing how to initialize a WebGPU scene, add lighting, load a 3D model, and render:

import { Scene } from "nano-webgpu";

// 1. Initialize scene on an HTML <canvas id="canvas"></canvas>
const scene = await Scene.init("#canvas");
const canvas = scene.getCanvas();

// 2. Set camera position and background color
scene.setCamera({ position: [0, 3, 8] });
scene.backgroundColor = "#07070b";

// 3. Add a ground plane
scene.addPlane({
  position: [0, -1, 0],
  scale: 15,
  color: "#161622",
  roughness: 0.7,
  metallic: 0.1,
});

// 4. Add a spotlight with shadow mapping
scene.addLight({
  type: "spotlight",
  position: [0, 5, 5],
  rotationDegrees: [-45, 0, 0],
  color: "#00f0ff",
  intensity: 3.5,
  innerAngle: 30,
  outerAngle: 50,
});

// 5. Load a GLTF / GLB model
const mesh = await scene.loadMesh("./models/character.glb", {
  position: [0, 0, 0],
  scale: 1.5,
});

// 6. Start render loop with automatic canvas resize handling
scene.render(() => {
  if (canvas.width !== window.innerWidth || canvas.height !== window.innerHeight) {
    canvas.width = window.innerWidth;
    canvas.height = window.innerHeight;
  }
});

🎮 Camera Controllers

Easily attach interactive controls to your camera:

import { Scene, OrbitCameraController } from "nano-webgpu";

const scene = await Scene.init("#canvas");
const camera = scene.setCamera({ position: [0, 2, 5] });

// Enable Orbit Controls (mouse drag to rotate, scroll to zoom)
const controller = new OrbitCameraController(camera, {
  target: [0, 0, 0],
  distance: 5,
  damping: 0.1,
});

nano-webgpu also supports FirstPersonCameraController and ThirdPersonCameraController.


🎨 Materials & Custom WGSL Shaders

Standard PBR Material

import { StandardMaterial } from "nano-webgpu";

const material = new StandardMaterial({
  color: "#ff3366",
  metallic: 0.8,
  roughness: 0.2,
});

Custom WGSL Shader Material

import { ShaderMaterial } from "nano-webgpu";

const customMaterial = new ShaderMaterial({
  code: `
    @fragment
    fn main(@location(0) uv: vec2f) -> @location(0) vec4f {
      return vec4f(uv.x, uv.y, 1.0, 1.0);
    }
  `
});

🛠 Browser Support

nano-webgpu relies on the W3C WebGPU standard. Compatible with:

  • Google Chrome / Microsoft Edge 113+
  • Safari 18+ (macOS 15+, iOS 18+)
  • Firefox Nightly (with WebGPU flag enabled)

📜 License

Distributed under the MIT License. See LICENSE for details.


Made with ❤️ by Gabriel Alves