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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@polygonjs/polygonjs

v1.5.94

Published

node-based WebGL 3D engine https://polygonjs.com

Downloads

893

Readme

Polygonjs

NPM package Twitter Discord Forum

Polygonjs is a node-based 3D WebGL design tool.

--- Home Page --- Documentation --- Try Demo ---

Polygonjs helps creating 3D interactives experiences for the web, without having to code.

A 3D scene is built by creating and connecting nodes. This gives you a non-destructive worflow, where you can try different ideas quickly, without fearing of breaking anything.

Polygonjs is also designed to be extended. This means that if it does not have a feature you need, you can add it, either by using its API, or by reading in this repository how the existing nodes are implemented and using that as a starting point.

The editor can be used both from the web or locally. The web version is convenient to discover the editor, but the local version is recommended for production, since it has the following advantages:

  • quick access to models and textures on your computer
  • tree shaked exports: It exports only the nodes you use.
  • git integration: Every files is saved as text, either json or javascript.
  • version tracking: It is an npm module, and has its version in package.json just like other dependencies
  • integration to any web project (such as threejs, vuejs, react, vanilla)

Inside Polygonjs node-based Editor

Start a project:

The easiest way to start a project is by using the cli tool:

npm create polygonjs@latest

or

yarn create polygonjs

You'll then be able to choose one of the templates for vanilla js, threejs, vuejs, react or react-three-fiber.

Add to an existing project:

If you already have an npm project, you can easily add it with:

npm add polygonjs-editor

or

yarn add polygonjs-editor

And you can then start the editor with:

npm run polygonjs-editor

or

yarn polygonjs-editor

Node-based

The nodes are grouped in contexts, each for a specific type of task:

  • ANIM nodes create animations.
  • AUDIO nodes generate and modify audio.
  • COP nodes import and update textures.
  • EVENT nodes trigger or react to scene events.
  • GL nodes create GLSL shaders.
  • JS nodes add state & events to scene objects.
  • MAT nodes create materials.
  • OBJ nodes add objects to your scene.
  • POST nodes set up post processing.
  • ROP nodes set up the renderers.
  • SOP nodes handle procedural modelling.

Plugins

Polygonjs is designed to be extensible. You can create your own plugins to add custom nodes. There are currently 4 official plugins:

  • Mapbox to add 3D objects to Mapbox maps.
  • Occlusion to calculate occlusion on a geometry and get more pleasant lighting.
  • Mediapipe Facemesh to track a face from a webcam feed
  • Physics to create and simulate rigid bodies.

Based on Threejs

Polygonjs is based on the powerful webgl library Threejs. While Polygonjs offers many nodes for many different types of 3D scenes, there are times where you may want to dig deeper and update the scenes in specific ways.

For this, you can directly access the threejs objects. There are 2 ways to do so:

  • From the scene
const scene = new PolyScene(); // this is the polygonjs scene
const threejsScene = scene.threejsScene(); // and it contains the threejs scene
  • From any node
const scene = new PolyScene();
const rootNode = scene.root();
const geo = rootNode.createNode('geo');
const plane = geo.createNode('plane');

// now let's get the content of the plane node
const container = await plane.compute();
// the container is an envelope that contains a coreGroup
const coreGroup = container.coreContent();
// and we can now get an array of THREE.Object3D:
const objects = coreGroup.threejsObjects();
// and we can use threejs API:
const object = objects[0];
object.position.set(0, 1, 0);
object.updateMatrix();