Nodes/DJZ-Nodes/Parametric Mesh Generator
ComfyUI Node

Parametric Mesh Generator

Generate a 3D mesh from math and get an .obj out, without a 3D app

By MushroomFleet·Created 2 years ago·Updated 5 months ago· 80
Parametric Mesh Generator
    • preview_image
    • obj_path
    resolution30
    scale1.00
    amplitude0.50
    frequency1.00
    phase0.00

    ParametricMeshGen is the odd one out in the DJZ pack in the best way: instead of processing images, it makes 3D geometry. You give it a handful of math parameters and it generates a parametric surface mesh, writes it to an .obj file in ComfyUI's output folder, and returns a rendered preview image so you can see what you built. It's a procedural 3D-model generator hiding inside an image tool.

    Why would you want this in ComfyUI? Because it's the fastest way to get a test mesh into a workflow that's about images of 3D things - think generating geometry to render, to feed into a depth or normal map pipeline, or to use as a starting shape for something like the pack's 3D-adjacent work. And it needs no Blender, no GPU, no model download - just math.

    How it works

    Under the hood it's refreshingly straightforward. It builds a grid of resolution × resolution points and evaluates a parametric surface - a sphere with a ripple wave overlaid on the Z axis:

    • scale sets overall size,
    • amplitude controls how tall the ripple gets,
    • frequency controls how many waves wrap around,
    • phase shifts where they start.

    The vertices are written to an .obj file (triangulated faces, standard format - opens in Blender, Unity, or anything else), and matplotlib renders a 3D preview (preview_image) so you don't have to open the mesh to check it.

    The inputs that matter

    • resolution (10–100) - grid density. Higher = smoother surface, bigger file, slower. 30 is fine to start.
    • scale - overall size.
    • amplitude - ripple height. 0 = plain sphere, 0.5+ = clearly wavy.
    • frequency - waves per circumference.
    • phase - rotation of the wave pattern.

    Outputs: two of them. preview_image - an IMAGE you can preview or save directly in the graph. obj_path - the absolute path to the generated .obj file (it lands in ComfyUI/output/OBJ/), which you can pass to a Save Text/display node or just copy out of the console.

    Installing it

    It's a DJZ-Nodes pack node. 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
    

    This is one of the nodes that actually uses a "heavy" pack dependency - matplotlib for the 3D preview. It's in requirements.txt, so the standard install covers it, but if you see a matplotlib import error, that's the one to confirm. The .obj writing itself is pure Python.

    Common issues

    Few failure modes, but a couple of quirks. First, the preview is only a matplotlib rendering - what you see is a shaded surface, not the actual mesh wireframe, so trust the .obj file, not the pretty picture. Second, every run writes a new timestamped file, so your output/OBJ/ folder accumulates meshes; clean it out or you'll be digging through hundreds of parametric_model_YYYYMMDDHHMMSS.obj files. And remember the preview is a fixed 30°-elevation/45°-azimuth angle - if the shape looks off, it's the viewing angle, not necessarily the geometry. V2 fixes the fixed-view thing and adds real surface types if the plain wavy sphere gets boring.

    CategoryDJZ-Nodes

    Inputs (5)

    NameTypeDefaultDescription
    resolutionINT3010–100
    scaleFLOAT1.000.1–10
    amplitudeFLOAT0.500–2
    frequencyFLOAT1.000.1–5
    phaseFLOAT0.00-3.14159–3.14159

    Outputs (2)

    NameTypeDescription
    preview_imageIMAGE
    obj_pathSTRING