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 🙏

© 2025 – Pkg Stats / Ryan Hefner

3d-mesh-lib

v3.2.0

Published

A comprehensive, production-ready 3D mesh manipulation library for creating 3D editors, modelers, and CAD applications

Readme

3D Mesh Library - As Easy as Three.js!

The 3D Mesh Library - Making 3D mesh operations as easy as Three.js!

A powerful, TypeScript-first 3D mesh manipulation library that makes complex 3D operations as simple as Three.js. Build 3D applications, games, and tools with minimal code.

Quick Start

TypeScript:

import { createCube, createSphere, scale, translate } from '3d-mesh-lib';

// Create shapes
const cube = createCube(1);
const sphere = createSphere({ radius: 0.5 });

// Transform them
const bigCube = scale(cube, 2);
const movedSphere = translate(sphere, { x: 5, y: 0, z: 0 });

JavaScript:

const { createCube, createSphere, scale, translate } = require('3d-mesh-lib/js');

// Create shapes
const cube = createCube(1);
const sphere = createSphere({ radius: 0.5 });

// Transform them
const bigCube = scale(cube, 2);
const movedSphere = translate(sphere, { x: 5, y: 0, z: 0 });

Features

  • Primitives: Create cubes, spheres, planes, cylinders, torus
  • Modifiers: Scale, translate, rotate, extrude, mirror
  • 3D Editor: Build complete 3D applications in 3 lines
  • Asset Pipeline: Texture baking, UV optimization, mesh optimization
  • Sculpting: Digital sculpting tools, texture painting, retopology
  • File I/O: GLTF, OBJ, STL, JSON, Three.js integration
  • Performance: GPU-friendly data structures, spatial partitioning

Installation

npm install 3d-mesh-lib

Basic Usage

Creating Shapes

TypeScript:

import { createCube, createSphere, createPlane } from '3d-mesh-lib';

const cube = createCube(1);           // 1x1x1 cube
const sphere = createSphere({ radius: 0.5, segments: 16 });
const plane = createPlane(2, 2);      // 2x2 plane

JavaScript:

const { createCube, createSphere, createPlane } = require('3d-mesh-lib/js');

const cube = createCube(1);           // 1x1x1 cube
const sphere = createSphere({ radius: 0.5, segments: 16 });
const plane = createPlane(2, 2);      // 2x2 plane

Transforming Meshes

TypeScript:

import { scale, translate, rotate, extrude } from '3d-mesh-lib';

// Scale a cube
const bigCube = scale(cube, 2);

// Move a sphere
const movedSphere = translate(sphere, { x: 5, y: 0, z: 0 });

// Rotate a plane
const rotatedPlane = rotate(plane, { x: 0, y: Math.PI/4, z: 0 });

// Extrude a plane
const extrudedPlane = extrude(plane, 1);

JavaScript:

const { scale, translate, rotate, extrude } = require('3d-mesh-lib/js');

// Scale a cube
const bigCube = scale(cube, 2);

// Move a sphere
const movedSphere = translate(sphere, { x: 5, y: 0, z: 0 });

// Rotate a plane
const rotatedPlane = rotate(plane, { x: 0, y: Math.PI/4, z: 0 });

// Extrude a plane
const extrudedPlane = extrude(plane, 1);

Advanced Operations

import { subdivide, center, computeBoundingBox, validateMesh } from '3d-mesh-lib';

// Subdivide a mesh
const highResMesh = subdivide(mesh, 2);

// Center a mesh
const centeredMesh = center(mesh);

// Get bounding box
const bounds = computeBoundingBox(mesh);

// Validate mesh integrity
const isValid = validateMesh(mesh);

Build 3D Applications in 3 Lines!

The library includes QuickBuilder - an ultra-simple way to build complete 3D applications:

3D Modeler (3 Lines!)

TypeScript:

import { QuickBuilder } from '3d-mesh-lib';

const builder = new QuickBuilder();
const modeler = builder.buildModeler(); // 3D modeler ready!

JavaScript:

const { QuickBuilder } = require('3d-mesh-lib/js/builder');

const builder = new QuickBuilder();
const modeler = builder.buildModeler(); // 3D modeler ready!

3D Level Editor (3 Lines!)

const builder = new QuickBuilder();
const levelEditor = builder.buildLevelEditor(); // Level editor ready!

3D Game World (3 Lines!)

const builder = new QuickBuilder();
const gameWorld = builder.buildGameWorld(); // Game world ready!

3D Architecture (3 Lines!)

const builder = new QuickBuilder();
const architecture = builder.buildArchitecture(); // Architectural scene ready!

3D Character Creator (3 Lines!)

const builder = new QuickBuilder();
const characterCreator = builder.buildCharacterCreator(); // Character creator ready!

3D Vehicle Designer (3 Lines!)

const builder = new QuickBuilder();
const vehicleDesigner = builder.buildVehicleDesigner(); // Vehicle designer ready!

Custom 3D Scene (3 Lines!)

const builder = new QuickBuilder();
const customScene = builder.buildCustomScene([
  { mesh: createCube(2), name: 'MyCube', position: { x: 0, y: 1, z: 0 } },
  { mesh: createSphere({ radius: 1 }), name: 'MySphere' }
]); // Custom scene ready!

Advanced Editor Features

Each built application includes:

  • Object Management - Add, remove, select objects
  • Transformations - Move, rotate, scale objects
  • Camera Control - Orbit, pan, zoom camera
  • Lighting System - Add, remove, configure lights
  • Undo/Redo - Never lose your work
  • Scene Statistics - Get detailed scene info
  • Export/Import - Save and load scenes

API Comparison: Three.js vs 3D Mesh Library

| Feature | Three.js | 3D Mesh Library | |---------|----------|------------------| | Setup | new THREE.Scene() | new QuickBuilder() | | Create Cube | new THREE.BoxGeometry() | createCube(1) | | Transform | mesh.position.set(x,y,z) | translate(mesh, {x,y,z}) | | 3D App | 50+ lines | 3 lines |

Import Options

The library supports multiple import styles for maximum flexibility:

JavaScript Support

100% JavaScript Support - No TypeScript Required!

The library works perfectly with pure JavaScript. All features are available through JavaScript files:

// Pure JavaScript - no TypeScript compilation needed!
const { createCube, scale } = require('3d-mesh-lib/js');
const { lib } = require('3d-mesh-lib/js/one-liner');
const { QuickBuilder } = require('3d-mesh-lib/js/builder');

// Create and transform meshes
const cube = createCube(1);
const bigCube = scale(cube, 2);
const editor = new QuickBuilder().buildModeler();

JavaScript Import Paths:

  • 3d-mesh-lib/js - Main JavaScript entry point
  • 3d-mesh-lib/js/easy - Easy imports for JavaScript
  • 3d-mesh-lib/js/one-liner - One-liner imports for JavaScript
  • 3d-mesh-lib/js/editor - 3D Editor for JavaScript
  • 3d-mesh-lib/js/builder - QuickBuilder for JavaScript

Perfect for:

  • Node.js applications
  • Browser scripts (with bundler)
  • JavaScript-only projects
  • Quick prototyping
  • Learning 3D graphics

Option 1: Standard Import

TypeScript:

import { createCube, createSphere, scale } from '3d-mesh-lib';

JavaScript:

const { createCube, createSphere, scale } = require('3d-mesh-lib/js');

Option 2: One-Liner Import (Recommended)

TypeScript:

import { lib } from '3d-mesh-lib/one-liner';
const cube = lib.cube(1);
const sphere = lib.sphere({ radius: 0.5 });

JavaScript:

const { lib } = require('3d-mesh-lib/js/one-liner');
const cube = lib.cube(1);
const sphere = lib.sphere({ radius: 0.5 });

Option 3: Easy Imports

TypeScript:

import { primitives, modifiers } from '3d-mesh-lib/easy';
const cube = primitives.cube(1);
const scaledCube = modifiers.scale(cube, 2);

JavaScript:

const { primitives, modifiers } = require('3d-mesh-lib/js/easy');
const cube = primitives.cube(1);
const scaledCube = modifiers.scale(cube, 2);

Option 4: Category Imports

import { QuickBuilder } from '3d-mesh-lib/builder';
import { TextureBaker } from '3d-mesh-lib/assets';

Examples

Check out the examples/ folder for complete working examples:

  • simple-usage.ts - Basic library usage
  • build-3d-apps.ts - Building 3D applications
  • import-options.ts - All import styles
  • sculpting-digital-art.ts - Digital sculpting
  • asset-pipeline-example.ts - Asset pipeline

Documentation

  • API_REFERENCE.md - Complete API documentation
  • ARCHITECTURE.md - Library architecture and design
  • EXAMPLES.md - Detailed examples and tutorials
  • GEOMETRY_OPERATIONS.md - Geometry operation details

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

License

MIT License - see LICENSE file for details.


The 3D Mesh Library makes building 3D applications extremely simple!