Nodes/DJZ-Nodes/Parametric Mesh Generator V2
ComfyUI Node

Parametric Mesh Generator V2

Spheres, tori, Klein bottles — parametric 3D meshes with the knobs V1 was missing

By MushroomFleet·Created 2 years ago·Updated 5 months ago· 78
Parametric Mesh Generator V2
    • preview_image
    • obj_path
    surface_typeSPHERE
    resolution30
    scale1.00
    amplitude0.50
    frequency1.00
    phase0.00
    secondary_amplitude0.00
    secondary_frequency2.00
    secondary_phase0.00
    smoothness1
    twist0.00
    preview_elevation30
    preview_azimuth45
    mesh_colorCYAN
    edge_visibility0.30

    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.

    CategoryDJZ-Nodes

    Inputs (15)

    NameTypeDefaultDescription
    surface_typeCOMBOSPHERE4 options: SPHERE, TORUS, KLEIN_BOTTLE, MOBIUS
    resolutionINT3010–200
    scaleFLOAT1.000.1–10
    amplitudeFLOAT0.500–2
    frequencyFLOAT1.000.1–5
    phaseFLOAT0.00-3.14159–3.14159
    secondary_amplitudeFLOAT0.000–2
    secondary_frequencyFLOAT2.000.1–5
    secondary_phaseFLOAT0.00-3.14159–3.14159
    smoothnessINT10–3
    twistFLOAT0.00-2–2
    preview_elevationINT300–90
    preview_azimuthINT450–360
    mesh_colorCOMBOCYAN6 options: CYAN, RED, GREEN, BLUE, PURPLE, ORANGE
    edge_visibilityFLOAT0.300–1

    Outputs (2)

    NameTypeDescription
    preview_imageIMAGE
    obj_pathSTRING