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

threejs-vox-loader

v2.0.0

Published

Improved three.js loader for MagicaVoxel .vox files

Readme

threejs-vox-loader

A Three.js loader for .vox files (from MagicaVoxel), designed for realistic rendering and correct voxel scene orientation.

Comparison

Features

  • 🔧 Optimized Meshes – Builds efficient geometry for faster rendering and lower memory usage.
  • 🌐 PBR Materials – Automatically applies roughness and metalness values from the .vox file for realistic surfaces.
  • 💡 Emissive Voxels with Lighting – Converts emissive voxels into real-time PointLights for dynamic scene illumination.
  • 🎯 Accurate Orientation and Positioning – Ensures models are correctly aligned in the Three.js coordinate system.
  • 🧩 Easy Integration – Minimal setup required; simply load and add to your Three.js scene.
  • 🏗️ Multi-Object Scene Support – Fully supports MagicaVoxel scenes composed of multiple models.
  • 🧊 Glass & Transparency Support – Handles transparent voxels with proper material rendering.

Positioning

The objects of a MagicaVoxel scene are anchored around their center and have a position in the scene relativ to the origin. The loader outputs a VoxScene object which is a three.js Group anchored around the origin in the MagicaVoxel scene.

Positioning

By default a newly created MagicaVoxel project is a 40 x 40 x 40 cube with the position x 0 y 0 z 20 which means the cube is placed "ontop" of the origin (the center of the bottom face is at the origin, it is the anchor of the object).

If you want the scene to be anchored at its center, call voxScene.center()

Coordinate-System

MagicaVoxel and Three.js use different coordinate-systems:

Coordinates

The loader automatically converts to the threejs coordinate system.

Installation

npm threejs-vox-loader

npm install threejs-vox-loader

Usage

import { VOXLoader } from 'threejs-vox-loader';

const loader = new VOXLoader();
loader.load('path/to/model.vox', function (voxScene) {
    scene.add(voxScene);
});

Options

Be aware that the material properties like roughness or metalness of MagicaVoxel behave differently in three.js

new VOXLoader({
    defaultMaterialOptions: {
        flatShading: true,
        roughness: 0,
        metalness: 0
    },
    enableMetalness: true,
    enableRoughness: true,
    enableGlass: true,
    enableEmissive: true,
    lightIntensity: 10,
    lightDistance: 3,
    lightDecay: 2,
    useRectLights: false
});

| Property | Type | Default Value | Description | |--------------------------------------|---------|-----------------------------------------------------|-----------------------------------------------------------------| | defaultMaterialOptions | Object | { flatShading: true, roughness: 0, metalness: 0 } | Default material settings for rendering. | | defaultMaterialOptions.flatShading | Boolean | true | Enables flat shading. | | defaultMaterialOptions.roughness | Number | 0 | Sets the surface roughness (0 = smooth, 1 = rough). | | defaultMaterialOptions.metalness | Number | 0 | Sets the surface metalness (0 = non-metal, 1 = fully metallic). | | enableMetalness | Boolean | true | Allows control over metalness property in materials. | | enableRoughness | Boolean | true | Allows control over roughness property in materials. | | enableGlass | Boolean | true | Enables glass-like material effects. | | enableEmissive | Boolean | true | Enables emissive (self-illuminating) material properties. | | lightIntensity | Number | 10 | Intensity of the scene's light source. | | lightDistance | Number | 3 | Distance at which the light has effect. | | lightDecay | Number | 2 | Light decay rate over distance. | | useRectLights | Boolean | false | Use RectLights, see three.js docs |