Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

feat: add PreviewGaussianSplat + PreviewPointCloud nodes (#14194)

Terry Jia2ef2cf1a7cfc
diff --git a/comfy_api/latest/_io.py b/comfy_api/latest/_io.py
index a3aa508ce..37614a4c3 100644
--- a/comfy_api/latest/_io.py
+++ b/comfy_api/latest/_io.py
@@ -755,6 +755,18 @@ class File3DKSPLAT(ComfyTypeIO):
Type = File3D
+@comfytype(io_type="FILE_3D_SPLAT_ANY")
+class File3DSplatAny(ComfyTypeIO):
+ """General 3D Gaussian splat file type - accepts any supported splat container (.ply / .spz / .splat / .ksplat)."""
+ Type = File3D
+
+
+@comfytype(io_type="FILE_3D_POINT_CLOUD_ANY")
+class File3DPointCloudAny(ComfyTypeIO):
+ """General point cloud file type - accepts any supported point cloud container (currently .ply)."""
+ Type = File3D
+
+
@comfytype(io_type="HOOKS")
class Hooks(ComfyTypeIO):
if TYPE_CHECKING:
@@ -2336,6 +2348,8 @@ __all__ = [
"File3DSPLAT",
"File3DSPZ",
"File3DKSPLAT",
+ "File3DSplatAny",
+ "File3DPointCloudAny",
"Hooks",
"HookKeyframes",
"TimestepsRange",
diff --git a/comfy_extras/nodes_gaussian_splat.py b/comfy_extras/nodes_gaussian_splat.py
index 2ba3a3820..116c14fde 100644
--- a/comfy_extras/nodes_gaussian_splat.py
+++ b/comfy_extras/nodes_gaussian_splat.py
@@ -488,7 +488,7 @@ class SplatToFile3D(IO.ComfyNode):
"spz: Niantic gzip-compressed (~10x smaller), base color only "
),
],
- outputs=[IO.File3DAny.Output(display_name="model_3d")],
+ outputs=[IO.File3DSplatAny.Output(display_name="model_3d")],
)
@classmethod
@@ -516,7 +516,7 @@ class File3DToSplat(IO.ComfyNode):
inputs=[
IO.MultiType.Input(
IO.File3DAny.Input("model_3d"),
- types=[IO.File3DPLY, IO.File3DSPLAT, IO.File3DKSPLAT, IO.File3DSPZ],
+ types=[IO.File3DSplatAny, IO.File3DPLY, IO.File3DSPLAT, IO.File3DKSPLAT, IO.File3DSPZ],
tooltip="A gaussian splat 3D file",
),
],
diff --git a/comfy_extras/nodes_load_3d.py b/comfy_extras/nodes_load_3d.py
index b339dc4ff..77dd1173b 100644
--- a/comfy_extras/nodes_load_3d.py
+++ b/comfy_extras/nodes_load_3d.py
@@ -136,7 +136,7 @@ class Preview3DAdvanced(IO.ComfyNode):
is_output_node=True,
inputs=[
IO.MultiType.Input(
- "model_file",
+ "model_3d",
types=[
IO.File3DGLB,
IO.File3DGLTF,
@@ -155,7 +155,134 @@ class Preview3DAdvanced(IO.ComfyNode):
IO.Int.Input("height", default=1024, min=1, max=4096, step=1),
],
outputs=[
- IO.File3DAny.Output(display_name="model_file"),
+ IO.File3DAny.Output(display_name="model_3d"),
+ IO.Load3DCamera.Output(display_name="camera_info"),
+ IO.Load3DModelInfo.Output(display_name="model_3d_info"),
+ IO.Int.Output(display_name="width"),
+ IO.Int.Output(display_name="height"),
+ ],
+ )
+
+ @classmethod
+ def execute(cls, model_3d: Types.File3D, image, width: int, height: int, **kwargs) -> IO.NodeOutput:
+ filename = f"preview3d_advanced_{uuid.uuid4().hex}.{model_3d.format}"
+ model_3d.save_to(os.path.join(folder_paths.get_output_directory(), filename))
+
+ camera_info_input = kwargs.get("camera_info", None)
+ camera_info = camera_info_input if camera_info_input is not None else image['camera_info']
+ model_3d_info_input = kwargs.get("model_3d_info", None)
+ model_3d_info = model_3d_info_input if model_3d_info_input is not None else image.get('model_3d_info', [])
+ return IO.NodeOutput(
+ model_3d,
+ camera_info,
+ model_3d_info,
+ width,
+ height,
+ ui=UI.PreviewUI3DAdvanced(filename, camera_info, model_3d_info),
+ )
+
+
+class PreviewGaussianSplat(IO.ComfyNode):
+ @classmethod
+ def define_schema(cls):
+ return IO.Schema(
+ node_id="PreviewGaussianSplat",
+ display_name="Preview Splat",
+ category="3d",
+ is_experimental=True,
+ is_output_node=True,
+ search_aliases=[
+ "view splat",
+ "view gaussian",
+ "view gaussian splat",
+ "preview gaussian",
+ "preview gaussian splat",
+ "view 3dgs",
+ "preview 3dgs",
+ "preview ply",
+ "preview spz",
+ "preview splat",
+ "preview ksplat",
+ ],
+ inputs=[
+ IO.MultiType.Input(
+ "model_3d",
+ types=[
+ IO.File3DSplatAny,
+ IO.File3DPLY,
+ IO.File3DSPLAT,
+ IO.File3DSPZ,
+ IO.File3DKSPLAT,
+ ],
+ tooltip="A gaussian splat 3D file.",
+ ),
+ IO.Load3D.Input("image"),
+ IO.Load3DCamera.Input("camera_info", optional=True, advanced=True),
+ IO.Load3DModelInfo.Input("model_3d_info", optional=True, advanced=True),
+ IO.Int.Input("width", default=1024, min=1, max=4096, step=1),
+ IO.Int.Input("height", default=1024, min=1, max=4096, step=1),
+ ],
+ outputs=[
+ IO.File3DSplatAny.Output(display_name="model_3d"),
+ IO.Load3DCamera.Output(display_name="camera_info"),
+ IO.Load3DModelInfo.Output(display_name="model_3d_info"),
+ IO.Int.Output(display_name="width"),
+ IO.Int.Output(display_name="height"),
+ ],
+ )
+
+ @classmethod
+ def execute(cls, model_3d: Types.File3D, image, width: int, height: int, **kwargs) -> IO.NodeOutput:
+ filename = f"preview_splat_{uuid.uuid4().hex}.{model_3d.format}"
+ model_3d.save_to(os.path.join(folder_paths.get_output_directory(), filename))
+
+ camera_info_input = kwargs.get("camera_info", None)
+ camera_info = camera_info_input if camera_info_input is not None else image['camera_info']
+ model_3d_info_input = kwargs.get("model_3d_info", None)
+ model_3d_info = model_3d_info_input if model_3d_info_input is not None else image.get('model_3d_info', [])
+ return IO.NodeOutput(
+ model_3d,
+ camera_info,
+ model_3d_info,
+ width,
+ height,
+ ui=UI.PreviewUI3DAdvanced(filename, camera_info, model_3d_info),
+ )
+
+
+class PreviewPointCloud(IO.ComfyNode):
+ @classmethod
+ def define_schema(cls):
+ return IO.Schema(
+ node_id="PreviewPointCloud",
+ display_name="Preview Point Cloud",
+ category="3d",
+ is_experimental=True,
+ is_output_node=True,
+ search_aliases=[
+ "view point cloud",
+ "view pointcloud",
+ "preview point cloud",
+ "preview pointcloud",
+ "preview ply",
+ ],
+ inputs=[
+ IO.MultiType.Input(
+ "model_3d",
+ types=[
+ IO.File3DPointCloudAny,
+ IO.File3DPLY,
+ ],
+ tooltip="Point cloud file (.ply)",
+ ),
+ IO.Load3D.Input("image"),
+ IO.Load3DCamera.Input("camera_info", optional=True, advanced=True),
+ IO.Load3DModelInfo.Input("model_3d_info", optional=True, advanced=True),
+ IO.Int.Input("width", default=1024, min=1, max=4096, step=1),
+ IO.Int.Input("height", default=1024, min=1, max=4096, step=1),
+ ],
+ outputs=[
+ IO.File3DPointCloudAny.Output(display_name="model_3d"),
IO.Load3DCamera.Output(display_name="camera_info"),
IO.Load3DModelInfo.Output(display_name="model_3d_info"),
IO.Int.Output(display_name="width"),
@@ -164,16 +291,16 @@ class Preview3DAdvanced(IO.ComfyNode):
)
@classmethod
- def execute(cls, model_file: Types.File3D, image, width: int, height: int, **kwargs) -> IO.NodeOutput:
- filename = f"preview3d_advanced_{uuid.uuid4().hex}.{model_file.format}"
- model_file.save_to(os.path.join(folder_paths.get_output_directory(), filename))
+ def execute(cls, model_3d: Types.File3D, image, width: int, height: int, **kwargs) -> IO.NodeOutput:
+ filename = f"preview_pointcloud_{uuid.uuid4().hex}.{model_3d.format}"
+ model_3d.save_to(os.path.join(folder_paths.get_output_directory(), filename))
camera_info_input = kwargs.get("camera_info", None)
camera_info = camera_info_input if camera_info_input is not None else image['camera_info']
model_3d_info_input = kwargs.get("model_3d_info", None)
model_3d_info = model_3d_info_input if model_3d_info_input is not None else image.get('model_3d_info', [])
return IO.NodeOutput(
- model_file,
+ model_3d,
camera_info,
model_3d_info,
width,
@@ -189,6 +316,8 @@ class Load3DExtension(ComfyExtension):
Load3D,
Preview3D,
Preview3DAdvanced,
+ PreviewGaussianSplat,
+ PreviewPointCloud,
]
diff --git a/comfy_extras/nodes_save_3d.py b/comfy_extras/nodes_save_3d.py
index a91549e7f..1b6592bb2 100644
--- a/comfy_extras/nodes_save_3d.py
+++ b/comfy_extras/nodes_save_3d.py
@@ -337,6 +337,12 @@ class SaveGLB(IO.ComfyNode):
IO.File3DFBX,
IO.File3DSTL,
IO.File3DUSDZ,
+ IO.File3DPLY,
+ IO.File3DSPLAT,
+ IO.File3DSPZ,
+ IO.File3DKSPLAT,
+ IO.File3DSplatAny,
+ IO.File3DPointCloudAny,
IO.File3DAny,
],
tooltip="Mesh or 3D file to save",