Three Import Material
Hand out module-built surfaces without the code sprawl
- module
- material
If your scene wants five different materials built in JavaScript, you have a choice: five Three Custom Material nodes each hiding its own code blob, or one Three Script Module that builds all five in a single body, plus a Three Import Material per surface you want on the wire. This node is the adapter for the organised route - it takes one material out of a module by name and puts it on a normal material wire, so Three Mesh treats it like any other surface and never knows JavaScript was involved.
Mechanically it's a lookup. The module input takes a THREE_MODULE from a Three Script Module, export_name names the key - the module's default body returns a gold standard material (metallic, low roughness), so export_name: gold hands it to you on the material output. Two rules govern it, stated plainly in the node's description: the name must match a key the module returned, and the value behind that key has to actually be a material. Break either and the viewer reports the problem by name, so you get told "that key isn't a material" rather than staring at a grey void.
The payoff for the extra hop is maintainability. A palette module runs once per viewer load - "so a palette of materials shared across many meshes is built once rather than per node," in the pack's own words. Wire the same module into five Import Material nodes with different export names, apply each to a mesh, and a later tweak to the module's gold material updates every mesh that uses it from one place. When a client says "make the gold warmer," you change one hex value instead of hunting through five copies of the same code.
This is also the nicest way to use the unusual material classes without scattering code through your graph. Build a toon material and a matcap in the module once, import each where it's needed, and your scene stays readable. For a single throwaway surface, skip the ceremony and use Three Custom Material directly - the module-plus-import pattern earns its keep when the same materials show up across many meshes or you're sharing the graph with people who shouldn't need to read JavaScript.
The standing trust note applies at one remove, same as every Import node: the material's code runs in your browser when the viewer loads, with the reach of any frontend extension. Only import from modules whose code you trust.
Installing it
Part of WAS Node Suite v3. 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+. Nothing installs. If the Three menu's missing, set features.threejs: true in <ComfyUI user dir>/was-node-suite/config.yaml.
If it reports an error
The viewer names the failure: a key that isn't in the module, or a key whose value isn't a material. And if every Import fed by a module comes up empty at once, the module's own JavaScript failed to load - check the browser console, since that's where the module's error lives.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| module | THREE_MODULE | The named resources to pick from, from Three Script Module. | |
| export_name | STRING | gold | Which key to take, as `gold`. It must match a key the module returned. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| material | THREE_MATERIAL | The named material, for the material socket on Three Mesh. |