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

@y-media/jewelry3dviewer

v0.0.39

Published

A sophisticated 3D ring configurator built with React, Three.js, and React Three Fiber. This application allows users to customize and view engagement rings with realistic diamond rendering and metal finishes.

Readme

Diamond Ring Viewer

A sophisticated 3D ring configurator built with React, Three.js, and React Three Fiber. This application allows users to customize and view engagement rings with realistic diamond rendering and metal finishes.

Features

  • Interactive 3D ring visualization
  • Real-time material and color customization
  • Realistic diamond rendering with caustics and refraction
  • Customizable engraving
  • Multiple metal options (White Gold, Yellow Gold, Rose Gold)
  • Various stone color options
  • Environment-based lighting and reflections
  • Optional bloom and shadow effects

Technical Implementation

Scene Organization

The application uses Three.js layers for organized rendering:

  • Layer 0: Environment (for reflections)
  • Layer 1: Metal parts (head and shank)
  • Layer 2: Diamonds

Component Structure

The scene is built from separate GLB models:

  • head.glb: Contains the crown and prongs
  • shank.glb: Contains the ring band and accent stones

Meshes are categorized by naming convention:

  • DIA-*: Diamond components
  • MTL-*: Metal components
  • MTL-ENG-SHANK-1: Special engraving surface

Diamond Rendering System

CubeCamera and Caustics Integration

The application uses a sophisticated system for realistic diamond rendering:

<CubeCamera key={cameraKey} resolution={256} frames={1} envMap={modifiedGemTexture}>
  {(texture) => (
    <Caustics
      backfaces
      color={stoneColor}
      lightSource={[5, 5, -10]}
      ior={1.8}
      intensity={0.1}>
      <Diamonds material={MeshRefractionMaterial} />
    </Caustics>
  )}
</CubeCamera>

Key features:

  • Environment-mapped reflections using CubeCamera
  • Realistic light refraction through stones
  • Configurable caustics effects
  • Layer-based reflection capture
  • Optional simplified transmission material for performance

Stone Positioning

  • Automatic stone offset calculation from shank center
  • Dynamic positioning based on shank geometry
  • Configurable stone offset distance
  • Bounding box calculations for accurate placement

Materials and Lighting

Metal Materials

  • Uses MeshStandardMaterial
  • Configurable properties:
    • Metalness
    • Roughness
    • Color
  • Preset metal options:
    • White Gold
    • Yellow Gold
    • Rose Gold

Diamond Materials

Two rendering modes:

  1. With Caustics:
    • Uses MeshRefractionMaterial
    • Full reflection and refraction
    • Real-time environment mapping
  2. Without Caustics:
    • Uses MeshTransmissionMaterial
    • Simplified transparency
    • Better performance

Environment and Effects

  • HDR environment mapping
  • Optional bloom effects
  • Accumulative shadows
  • Auto-rotation option
  • Dynamic engraving with text rendering

Configuration Options

The application provides several customizable parameters:

  • Caustics toggle
  • Gem exposure
  • Metal properties (metalness, roughness)
  • Stone offset
  • Shadow settings
  • Bloom effects
  • Auto-rotation
  • IOR (Index of Refraction)
  • Various material-specific parameters

Performance Considerations

  • Layer-based rendering for optimal reflection calculations
  • Optional caustics for performance vs quality trade-off
  • Configurable bloom resolution
  • Optimized environment map loading
  • Preloaded assets for faster initialization

Development

This project is built with:

  • React + Vite
  • Three.js
  • React Three Fiber
  • React Three Drei
  • Leva for controls

Available Scripts

  • npm run dev: Start development server
  • npm run build: Build for production
  • npm run preview: Preview production build

ESLint Configuration

For production applications, we recommend:

Assets

Required 3D models and textures:

  • /public/source/head.glb
  • /public/source/shank.glb
  • /public/source/GEM-immersive.hdr
  • /public/source/MTL-immersive.hdr