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

@th-batman/3d-viewer-core

v1.3.0

Published

The framework-agnostic 3D rendering and customization engine for luxury jewelry and precision products, powered by Three.js and custom GLSL diamond raytracing shaders.

Readme

@3d-viewer/core

The framework-agnostic 3D rendering and customization engine for luxury jewelry and precision products, powered by Three.js and custom GLSL diamond raytracing shaders.


Features

  • 💎 Photorealistic Diamond Raytracing — Spectral dispersion (RGB chromatic splitting), 5-bounce internal reflections, and facet normal baking with zero runtime CPU cost.
  • 🥇 PBR Precious Metals — Realistic 14K/18K Yellow, White, Rose Gold, Platinum 950, Silver 925, and Black Ruthenium with accurate Fresnel reflectance and roughness.
  • 📐 Automated Jewelry Part Detection — Heuristically categorizes meshes into metal, diamond, and gemstone parts upon loading.
  • 🌐 HDR Studio Environment Lighting — Integrated PMREM generation for high-dynamic-range reflections and diamond sparkle.
  • 📦 Universal Model Support — Loads .glb, .gltf with Draco compression and meshopt support out of the box.
  • ⚡ Framework Agnostic — Zero dependency on React, Angular, or Vue; works in vanilla JS, Node/SSR, and any web application.

Installation

npm install @3d-viewer/core three
# or with pnpm
pnpm add @3d-viewer/core three

Peer Dependency: Requires three >= 0.150.0.


Quickstart

import { createViewer, ALL_METAL_PRESETS, DIAMOND_PRESETS } from '@3d-viewer/core'

// 1. Initialize viewer container
const container = document.getElementById('viewer-container')!
const viewer = createViewer(container, {
  autoRotate: true,
  environment: 'studio-neutral',
})

// 2. Load 3D jewelry model
await viewer.loadModel('https://cdn.example.com/models/solitaire-ring.glb')

// 3. Customize materials
viewer.setMetal('yellow-gold-18k')
viewer.setStone('diamond-colorless')

// 4. Listen to events
viewer.on('loaded', (info) => {
  console.log('Model loaded! Detected parts:', info.parts)
})

viewer.on('metalChanged', (metalId) => {
  console.log('Active metal:', metalId)
})

Preset Catalogs

Metals (ALL_METAL_PRESETS)

  • yellow-gold-18k, yellow-gold-14k
  • white-gold-18k, white-gold-14k
  • rose-gold-18k, rose-gold-14k
  • platinum-950
  • silver-925
  • black-ruthenium

Gemstones & Diamonds (ALL_STONE_PRESETS)

  • diamond-colorless (D/E/F Grade)
  • diamond-warm (G/H Grade)
  • diamond-canary (Fancy Yellow)
  • diamond-pink (Fancy Pink)
  • diamond-blue (Fancy Blue)
  • emerald, ruby, sapphire

API Reference

createViewer(container: HTMLElement, options?: ViewerOptions): Viewer

Creates and mounts a WebGL viewer instance.

Viewer Methods:

  • loadModel(urlOrBuffer: string | ArrayBuffer): Promise<void>
  • setMetal(metalId: string): void
  • setStone(stoneId: string): void
  • setAutoRotate(enabled: boolean): void
  • resetCamera(): void
  • screenshot(options?: { mimeType?: string, quality?: number }): Promise<string>
  • dispose(): void

License

MIT