Stable Fast 3D's own save node hands back the GLB as base64 in its UI output, which the gate does not read. LLMGWSaveMesh writes each mesh to output/ as a GLB and names it, as a picture's save node does. The prepare node also gives the object's mask now, which SF3D's sampler takes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
b1490dbf30
commit
9b8ec89247
2 files changed
+63
-6
No files matched your search
+19
-1
@@ -1126,7 +1126,8 @@ EU-safe textured path — its ComfyUI node and VRAM need are to be
|
||||
checked), **Direct3D-S2** (MIT, DreamTech; high-detail shape, has a
|
||||
ComfyUI node) if TRELLIS.2's detail falls short. Not in: TripoSR and
|
||||
InstantMesh (permissive but superseded), Stable Fast 3D (Stability's
|
||||
community licence, revenue-capped), SAM 3D Objects (Meta's own licence,
|
||||
community licence, revenue-capped; served all the same since 2026-10-10
|
||||
at the user's request, see G3), SAM 3D Objects (Meta's own licence,
|
||||
to be read before it is considered). Steam's disclosure form (changed
|
||||
2026-01-16) lists pre-generated 3D models as content that must be
|
||||
declared on the store page: the licence notice G3 writes into the GLB is
|
||||
@@ -1201,6 +1202,23 @@ newer). TripoSR (MIT) proves the chain on cuda01: a .glb from a picture
|
||||
in about 30 s. Left: background removal before TripoSR (BiRefNet, MIT,
|
||||
as a node), TRELLIS.2 or Direct3D-S2 on an Ampere card with an ungated
|
||||
encoder, a missing node refusing the replica by name.
|
||||
Added 2026-10-10 at the user's request, beside the order above: **Stable
|
||||
Fast 3D** as `sf3d` (Stability AI Community License: free under US$1 M
|
||||
annual revenue, an enterprise licence above, "Powered by Stability AI"),
|
||||
the textured mesh that runs on Turing: about 1 s a mesh warm in fp16,
|
||||
UV-mapped GLB with its texture, 18 GB of the card at peak. Its weights are
|
||||
gated, so they were fetched once with the user's token into
|
||||
/srv/llmgw-comfy/stable-fast-3d and linked into the engine user's
|
||||
Hugging Face cache, which its loader node reads by repository name; no
|
||||
token is on the machine at runtime. Its own save node returns the GLB as
|
||||
base64, which the gate cannot fetch, so `LLMGWSaveMesh` writes the file;
|
||||
`LLMGWPrepareForMesh` now also gives the object's mask. Left: its two
|
||||
CUDA extensions (texture_baker, uv_unwrapper) are not on PyPI, so they
|
||||
were built on cuda01 and installed into the engine's venv by hand; a
|
||||
custom node's requirements need a way to name a local build, or the
|
||||
engine install must carry them, before a customer site gets this. And
|
||||
rembg's default session now fetches BRIA RMBG-2.0 (non-commercial):
|
||||
every workflow must name its rembg model (ours say u2net).
|
||||
- Catalog: a model makes `pictures` or `meshes` (`MakesImages` becomes an
|
||||
output kind; `ServesComfyUI` stays). 3D weight folders in the gate's
|
||||
`modelFolders`; the workflow's placeholders gain `image` (the input
|
||||
|
||||
@@ -55,7 +55,8 @@ class LLMGWPrepareForMesh:
|
||||
"optional": {"mask": ("MASK",)},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("IMAGE",)
|
||||
RETURN_TYPES = ("IMAGE", "MASK")
|
||||
RETURN_NAMES = ("image", "mask")
|
||||
FUNCTION = "prepare"
|
||||
CATEGORY = "llmgw"
|
||||
|
||||
@@ -80,14 +81,52 @@ class LLMGWPrepareForMesh:
|
||||
sq = _fit(rgba, foreground_ratio).astype(np.float32) / 255.0
|
||||
a = sq[..., 3:4]
|
||||
img = sq[..., :3] * a + (1.0 - a) * background
|
||||
out.append(torch.from_numpy(img))
|
||||
out.append(torch.from_numpy(np.dstack([img, a])))
|
||||
# One size for the batch: the first picture's.
|
||||
side = out[0].shape[0]
|
||||
out = [o if o.shape[0] == side else torch.from_numpy(
|
||||
np.array(Image.fromarray((o.numpy() * 255).astype(np.uint8)).resize((side, side)))).float() / 255.0
|
||||
for o in out]
|
||||
return (torch.stack(out),)
|
||||
both = torch.stack(out)
|
||||
# The picture on its background, and the object's alpha as a mask
|
||||
# (1 where the object is) for a model that wants it, as Stable Fast
|
||||
# 3D's sampler does.
|
||||
return (both[..., :3].contiguous(), both[..., 3].contiguous())
|
||||
|
||||
|
||||
NODE_CLASS_MAPPINGS = {"LLMGWPrepareForMesh": LLMGWPrepareForMesh}
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {"LLMGWPrepareForMesh": "Prepare a picture for a 3D model (llmgw)"}
|
||||
class LLMGWSaveMesh:
|
||||
"""Writes each mesh a 3D node made to output/ as a GLB and names the
|
||||
files, which is how the gate finds a result. A model's own save node
|
||||
may return the mesh as base64 (Stable Fast 3D's does) or as an OBJ
|
||||
without its texture, and the gate reads neither."""
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {"required": {"mesh": ("MESH",), "filename_prefix": ("STRING", {"default": "mesh"})}}
|
||||
|
||||
RETURN_TYPES = ()
|
||||
OUTPUT_NODE = True
|
||||
FUNCTION = "save"
|
||||
CATEGORY = "llmgw"
|
||||
|
||||
def save(self, mesh, filename_prefix="mesh"):
|
||||
import os
|
||||
import folder_paths
|
||||
import trimesh
|
||||
from trimesh.exchange import gltf
|
||||
|
||||
folder, name, counter, subfolder, _ = folder_paths.get_save_image_path(
|
||||
filename_prefix, folder_paths.get_output_directory())
|
||||
saved = []
|
||||
for i, m in enumerate(mesh if isinstance(mesh, (list, tuple)) else [mesh]):
|
||||
file = f"{name.replace('%batch_num%', str(i))}_{counter + i:05}_.glb"
|
||||
scene = m if isinstance(m, trimesh.Scene) else trimesh.Scene(m)
|
||||
with open(os.path.join(folder, file), "wb") as f:
|
||||
f.write(gltf.export_glb(scene, include_normals=True))
|
||||
saved.append({"filename": file, "type": "output", "subfolder": subfolder})
|
||||
return {"ui": {"mesh": saved}}
|
||||
|
||||
|
||||
NODE_CLASS_MAPPINGS = {"LLMGWPrepareForMesh": LLMGWPrepareForMesh, "LLMGWSaveMesh": LLMGWSaveMesh}
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {"LLMGWPrepareForMesh": "Prepare a picture for a 3D model (llmgw)",
|
||||
"LLMGWSaveMesh": "Save a mesh as GLB (llmgw)"}
|
||||
Reference in new issue
Block a user