Three Custom Object
A hundred instanced meshes, or anything wiring can't say
- geometry1
- geometry2
- material1
- material2
- object1
- object2
- object
The WAS Three suite is built on wiring: geometry into a mesh, mesh into a group, group into a scene. That model is clean and it breaks the moment you want a hundred copies, a point cloud, or line segments scattered by code. Three Custom Object is the node for everything wiring can't express: a javascript body that returns any Object3D, with THREE in scope. Scatter a hundred copies in a grid, build an InstancedMesh, make a Points cloud - it's all one body of code.
The node's inputs are your building blocks inside that body. Wire up to two geometries, two materials and two objects, and they arrive as geometry1, geometry2, material1, material2, object1 and object2. The default body shows the pattern - it makes a fresh Group and adds object1 to it, which is the minimal "wrap this thing so I can run code around it" case:
const group = new THREE.Group();
if (object1) group.add(object1);
return group;
The canonical step-up is instancing: return new THREE.InstancedMesh(geometry1, material1, 100); gives you a hundred meshes in one draw call, which is how you get a convincing forest or a starfield without melting the GPU - that's precisely the sort of thing you cannot describe with group sockets. The object output then behaves like any other THREE_OBJECT: into Three Group or straight onto Three Scene's root.
Here comes the warning that applies to every custom-JS node in this family, in the author's own words: the code runs in your browser when the viewer loads, with the same reach as any frontend extension. Your browser is the execution environment and the sandbox is essentially the web. Only run workflows carrying custom JavaScript if you trust where they came from. If you downloaded a workflow with a Custom Object node from a stranger, that's not "interesting code," that's a piece of your browser session being handed to code you haven't read.
Installing it
Part of WAS Node Suite v3. Install via ComfyUI Manager (search WAS Node Suite v3) or:
cd ComfyUI/custom_nodes
git clone https://github.com/WASasquatch/was-node-suite-comfyui.git
Restart; needs ComfyUI 0.14.0+ / Python 3.10+. No pip, no downloads. Missing from the menu? Set features.threejs: true in <ComfyUI user dir>/was-node-suite/config.yaml.
If it errors
The body must return an Object3D. Snippets that mutate and don't return give you nothing on the wire. And because execution happens in the viewer, a bug shows up when the page loads - test with the default body first so you know the plumbing works before adding your own code.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| javascript | STRING | const group = new THREE.Group(); if (object1) group.add(object1); return group; | A body returning an Object3D, as `return new THREE.InstancedMesh(geometry1, material1, 100);`. |
| geometry1opt | THREE_GEOMETRY | A shape reachable in the body as `geometry1`. | |
| geometry2opt | THREE_GEOMETRY | A shape reachable in the body as `geometry2`. | |
| material1opt | THREE_MATERIAL | A surface reachable in the body as `material1`. | |
| material2opt | THREE_MATERIAL | A surface reachable in the body as `material2`. | |
| object1opt | THREE_OBJECT | An object reachable in the body as `object1`, to add or to place. | |
| object2opt | THREE_OBJECT | An object reachable in the body as `object2`, to add or to place. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| object | THREE_OBJECT | The object the code returned, for Three Group or Three Scene. |