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

@metafold/threejs

v0.3.0

Published

Metafold three.js addon

Readme

Metafold three.js addons

npm

Installation

Include the following imports in the HTML head element, adjusting version numbers as appropriate:

<head>
  <!-- ... -->
  <script type="importmap">
    {
      "imports": {
        "three": "https://unpkg.com/[email protected]/build/three.module.js",
        "three/addons/": "https://unpkg.com/[email protected]/examples/jsm/",
        "@metafold/threejs": "https://unpkg.com/@metafold/[email protected]/dist/main.js"
      }
    }
  </script>
</head>

Usage

As with the three.js post-processing guide, start by importing the required passes:

import { EffectComposer } from "three/addons/postprocessing/EffectComposer.js"
import { RenderPass } from "three/addons/postprocessing/RenderPass.js"
import { OutputPass } from "three/addons/postprocessing/OutputPass.js"
import { VolumeRenderPass } from "@metafold/threejs/VolumeRenderPass.js"

In this example we include a standard scene RenderPass and the VolumeRenderPass introduced by this addon.

const renderTarget = new THREE.WebGLRenderTarget(width, height)
renderTarget.depthTexture = new THREE.DepthTexture()

const composer = new EffectComposer(renderer, renderTarget)

Note the EffectComposer should be initialized with a render target that includes a depth texture to make the depth of previous passes available to the VolumeRenderPass. This enables the VolumeRenderPass to composite the rendered shape with any geometry from previous passes.

const renderPass = new RenderPass(scene, camera)
composer.addPass(renderPass)

// Dummy data to initialize volume render pass
const volumeData = new Int8Array(64 * 64 * 64)
volumeData.fill(127)

const volumeRenderPass = new VolumeRenderPass(camera, width, height, volumeData, {
  size: new THREE.Vector3(2.0, 2.0, 2.0),
  // The resolution *must* match the volume data length
  resolution: new THREE.Vector3(64, 64, 64),
})
composer.addPass(volumeRenderPass)

const outputPass = new OutputPass()
composer.addPass(outputPass)

Initializing the VolumeRenderPass is simple as that!

After receiving volume data from the Metafold API, set the data on the pass as an Int8Array and provide the corresponding patch parameters (size and resolution):

const volumeData = new Int8Array(buffer)
volumeRenderPass.setVolume(volumeData, { size, resolution })

See examples/lattice_infill for a complete example (including Metafold SDK for Node.js usage)!