Parametric Mesh Generator V2
Spheres, tori, Klein bottles — parametric 3D meshes with the knobs V1 was missing
- preview_image
- obj_path
ParametricMeshGenV2 is the grown-up version of the pack's mesh generator. Where V1 could only make a wavy sphere from a fixed angle, V2 adds real surface types - sphere, torus, Klein bottle, Möbius strip - plus a second deformation wave, twist, and full control over the preview camera. If you want to generate interesting 3D geometry to drop into a render or a depth-mapping workflow, this is the version you actually keep.
It's still pure math to .obj: no models, no GPU, no downloads. You're writing parametric surfaces with a few sliders and getting a standard Wavefront file plus a matplotlib preview image, all inside the ComfyUI graph. The vibe is "the Shadertoy of mesh generation," and it's a genuinely fun node to fiddle with.
How it works
Pick a surface_type and the node evaluates the corresponding parametric equations over a resolution-by-resolution grid:
- SPHERE - the classic, with a primary wave ripple via
amplitude/frequency/phase. - TORUS - a donut, and the place where the new secondary_amplitude / secondary_frequency / secondary_phase controls shine: a second wave wrapped around the tube makes interesting ridged donuts.
- KLEIN_BOTTLE - a one-sided surface that's the "look what I can generate" option.
- MOBIUS - a Möbius strip, the classic twisty band.
On top of the wave controls, twist (−2 to 2) warps the whole surface like a spiral, and smoothness (0–3) refines the surface. The preview half is new and welcome: preview_elevation and preview_azimuth set the camera angle, mesh_color picks a render color, and edge_visibility (0–1) controls how strongly the mesh edges show in the preview - so you can finally inspect a shape from the angle you care about.
The inputs that matter
- surface_type - the shape. This is the whole point of upgrading.
- resolution (10–200) - grid density. Higher is smoother but slower and produces a bigger
.obj; 200 is genuinely heavy, start at 30–50. - amplitude / frequency / phase - the primary deformation wave.
- secondary_amplitude / secondary_frequency / secondary_phase - the second wave. Zero by default; this is what makes a torus interesting.
- twist - global spiral warp. Subtle values (0.2–0.5) are where it gets good.
- preview_elevation / preview_azimuth / mesh_color / edge_visibility - all preview-only, no effect on the actual mesh file.
Outputs: preview_image (IMAGE) and obj_path (STRING, the absolute path to the new .obj in ComfyUI/output/OBJ/).
Installing it
Same pack install as everything else here: ComfyUI Manager → Install Custom Nodes → search DJZ-Nodes → install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/MushroomFleet/DJZ-Nodes
cd DJZ-Nodes
pip install -r requirements.txt
Needs matplotlib for the preview (in the pack's requirements) and nothing else beyond numpy/torch. The .obj writing is stdlib.
Common issues
The preview is matplotlib's shaded surface, not a faithful wireframe - edge_visibility at 1 gets you closer to the mesh lines, but if you need to inspect topology precisely, open the .obj in a real viewer. Resolution is the hidden cost: resolution squares the vertex count, so 200 on a torus is a chunky file and a slow preview; keep it low while experimenting and only bump it for the final export. And every run writes a fresh timestamped .obj, so output/OBJ/ fills up fast - worth a periodic cleanup. Klein bottles and Möbius strips render fine but look like topology puzzles in a flat preview; if one looks "broken," it's probably correct, it's just a weird surface.
Inputs (15)
| Name | Type | Default | Description |
|---|---|---|---|
| surface_type | COMBO | SPHERE | 4 options: SPHERE, TORUS, KLEIN_BOTTLE, MOBIUS |
| resolution | INT | 3010–200 | — |
| scale | FLOAT | 1.000.1–10 | — |
| amplitude | FLOAT | 0.500–2 | — |
| frequency | FLOAT | 1.000.1–5 | — |
| phase | FLOAT | 0.00-3.14159–3.14159 | — |
| secondary_amplitude | FLOAT | 0.000–2 | — |
| secondary_frequency | FLOAT | 2.000.1–5 | — |
| secondary_phase | FLOAT | 0.00-3.14159–3.14159 | — |
| smoothness | INT | 10–3 | — |
| twist | FLOAT | 0.00-2–2 | — |
| preview_elevation | INT | 300–90 | — |
| preview_azimuth | INT | 450–360 | — |
| mesh_color | COMBO | CYAN | 6 options: CYAN, RED, GREEN, BLUE, PURPLE, ORANGE |
| edge_visibility | FLOAT | 0.300–1 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| preview_image | IMAGE | — |
| obj_path | STRING | — |