Nodes/ComfyUI-LLaMA-Mesh/Apply Gradient Color
ComfyUI Node

Apply Gradient Color

Turn a bare OBJ into a colored GLB you can actually see

By Yuan-ManX·Created 2 years ago·Updated 2 years ago· 5
Apply Gradient Color
    • STRING
    mesh_text

    The tiny helper that makes generated meshes legible

    A raw OBJ has no colors, no textures, no shading - it's a ghost of triangles floating in space, and in a plain viewer it's genuinely hard to tell a blob from a chair. Apply Gradient Color fixes the worst of that in one step: it takes the mesh_text (OBJ) that the pack's Chat LLaMa Mesh node produces, paints a blue-to-red gradient across the vertices based on their height, and exports a GLB file you can open anywhere.

    This is a utility node from the ComfyUI-LLaMA-Mesh pack, and it's honest about being one - a single input, a single output, thirty lines of code. Don't expect it to be more than it is: it's the "make the mesh visible enough to judge" step, not a renderer.

    How it works

    Under the hood it hands the OBJ string to trimesh, grabs the vertex coordinates, and normalizes the Y-axis (up/down) into a 0–1 range. That value drives the red channel, its inverse drives blue, and alpha is set to fully opaque - so the lowest point is blue, the highest is red, and everything between is a ramp of purple. It then writes the colored mesh out as a GLB and returns the file path to you.

    That Y-gradient is doing more work than it looks like. It's effectively a cheap heightmap visualization: dips and bumps in your mesh become instantly obvious as color shifts. For the lumpy, low-poly output LLaMA-Mesh actually produces, it's the difference between squinting at a white silhouette and actually seeing your geometry's shape.

    The one input and one output

    • mesh_text - the OBJ as a string. The multiline field is there precisely so you can paste in whatever mesh_text (or the response text) from Chat LLaMa Mesh spat out.
    • Output - a single STRING that is the path to the exported .glb file on disk.

    There are no optional inputs, no tuning knobs, no color choices. What you get is the path to a temp .glb - and "viewing" it is on you: open it in Blender, Windows' built-in 3D Viewer, or any GLB-capable viewer. ComfyUI itself won't pop a preview, because what you're getting is a file location, not a rendered image.

    Installing

    Same pack as everything else in here:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Yuan-ManX/ComfyUI-LLaMA-Mesh.git
    cd ComfyUI-LLaMA-Mesh
    pip install -r requirements.txt
    

    or search LLaMA-Mesh in ComfyUI Manager. The dependencies that matter for this node are trimesh and numpy, both in the pack's requirements.

    Where people get burned

    The output is a path, and people habitually assume they'll see something on screen. You won't - grab the returned string and open the file yourself. The node also writes to a fresh temp file each run, so the disk fills quietly if you batch a hundred generations. And since it normalizes by max - min of the Y values, a degenerate mesh where every vertex sits at the same height will throw a divide-by-zero - which is rare with real LLaMA-Mesh output, but possible with something you hand-wrote. Mostly, this node just works, and does exactly the one boring thing it promises.

    CategoryLLaMA-Mesh

    Inputs (1)

    NameTypeDefaultDescription
    mesh_textSTRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING