Nodes/WAS Node Suite v3/Three Custom Geometry
ComfyUI Node Runs on cloud

Three Custom Geometry

Any Three.js shape the pack forgot, in one line of JS

By WASasquatch·Created 3 years ago·Updated 4 days ago· 1,844
Three Custom Geometry
    • geometry
    javascriptreturn new THREE.TorusKnotGeometry(1, 0.3, 128, 24);

    The WAS Three suite ships box, sphere, cylinder and friends - and then it stops, because you can't node-ify every constructor three.js has ever shipped. Three Custom Geometry is the escape hatch: a javascript field where you write a short body that returns a geometry, with THREE in scope. Want a torus knot? return new THREE.TorusKnotGeometry(1, 0.3, 128, 24); That's the whole node. A lathe, a tube, a hand-built BufferGeometry - they're all one line away.

    What you're really doing is handing a snippet of code to the browser-side renderer, which is the deep quirk of this entire suite. The default body is exactly that torus-knot one-liner, so you can wire the node up and see it working before you write anything of your own. Type a body, hit run, and the geometry output behaves like any other THREE_GEOMETRY - feed it to the geometry socket on Three Mesh and carry on with the normal graph.

    That browser-side execution is the thing to internalise, because it has a real consequence. The code runs in your browser when the viewer loads, "with the same reach as any frontend extension," in the node's own words. Your browser is the sandbox, and the sandbox is the whole browser. If you're loading a workflow from someone you don't trust, a Custom Geometry node is a place where their code could do things to your machine's browser session. Treat these nodes the way you'd treat opening an unfamiliar HTML file, and only run custom JavaScript you know where it came from. If that makes you nervous, it should - the pack says the same thing in its description for exactly this reason.

    For the honest trade-off: for the 90% of scenes built from standard boxes and cylinders, this node is overkill and its security posture is a liability you don't need. Reach for it when you genuinely need a shape class the pack doesn't cover, and keep those workflows to code you wrote. It's the geometry half of a family that also includes Three Custom Material and Three Custom Object for surfaces and whole scene objects.

    Installing it

    Ships in WAS Node Suite v3. Install via ComfyUI Manager (search WAS Node Suite v3) or clone:

    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 packages, no downloads. If the menu's missing, set features.threejs: true in <ComfyUI user dir>/was-node-suite/config.yaml.

    If it errors

    The body has to actually return a geometry - a body that runs but returns nothing gives you an empty output. And remember the code runs in the browser, so a syntax error appears when the viewer loads, not at queue time. Keep bodies short and test one at a time.

    CategoryWAS Suite/Three

    Inputs (1)

    NameTypeDefaultDescription
    javascriptSTRINGreturn new THREE.TorusKnotGeometry(1, 0.3, 128, 24);A body returning a geometry, as `return new THREE.LatheGeometry(points);`. `THREE` is in scope.

    Outputs (1)

    NameTypeDescription
    geometryTHREE_GEOMETRYThe shape the code returned, for the geometry socket on Three Mesh.