Comfy-Org/ComfyUI · error · ValueError

File3DToSplat: unsupported PLY format '{p[1]}' (need binary_

Error message

File3DToSplat: unsupported PLY format '{p[1]}' (need binary_little_endian)

What it means

Raised by _parse_ply_gaussian when the PLY header's format line is not binary_little_endian. The parser uses a single numpy structured read (np.frombuffer with packed little-endian dtypes), so it only supports the binary_little_endian encoding. ASCII PLYs and big-endian binary PLYs are rejected with this message.

Source

Thrown at comfy_extras/nodes_gaussian_splat.py:224

def _norm_quat(q):
    return q / np.linalg.norm(q, axis=1, keepdims=True).clip(1e-12)


def _parse_ply_gaussian(data: bytes):
    end = data.find(b'end_header')
    if end < 0:
        raise ValueError("File3DToSplat: not a PLY (missing end_header)")
    header = data[:end].decode('ascii', 'replace')
    body = end + len(b'end_header')
    body += 2 if data[body:body + 2] == b'\r\n' else 1
    count, props, in_vertex = 0, [], False
    for line in header.splitlines():
        p = line.split()
        if not p:
            continue
        if p[0] == 'format' and p[1] != 'binary_little_endian':
            raise ValueError(f"File3DToSplat: unsupported PLY format '{p[1]}' (need binary_little_endian)")
        if p[0] == 'element':
            in_vertex = p[1] == 'vertex'
            if in_vertex:
                count = int(p[2])
        elif p[0] == 'property' and in_vertex:
            if p[1] == 'list':
                raise ValueError("File3DToSplat: PLY vertex has list properties (unsupported)")
            props.append((p[2], '<' + _PLY_DTYPES[p[1]]))
    arr = np.frombuffer(data, np.dtype(props), count=count, offset=body)
    names = arr.dtype.names
    c = lambda k: arr[k].astype(np.float32)
    n = count

    xyz = np.stack([c('x'), c('y'), c('z')], 1)
    if 'scale_0' in names:
        scale = np.exp(np.stack([c('scale_0'), c('scale_1'), c('scale_2')], 1))   # 3DGS stores log scale
    else:
        scale = np.full((n, 3), 0.01, np.float32)

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Re-export/convert the file to binary_little_endian (e.g., with plyfile in Python or a converter that preserves vertex properties).
  2. If you have the source tool, change its PLY export settings to binary/little-endian.
  3. For ASCII files, convert once via a script: parse ASCII, rewrite binary little-endian with the same vertex properties.

Example fix

# convert ascii ply to binary_little_endian with plyfile
from plyfile import PlyData
ply = PlyData.read('model_ascii.ply')
ply.write('model_bin.ply')  # plyfile defaults to binary little-endian
Defensive patterns

Strategy: validation

Validate before calling

header = data[:data.find(b'end_header')].decode('ascii', 'replace')
if 'format binary_little_endian' not in header:
    raise ValueError('PLY must be binary_little_endian; convert before loading')

Type guard

def is_bile_ply(data: bytes) -> bool:
    end = data.find(b'end_header')
    return end > 0 and 'format binary_little_endian' in data[:end].decode('ascii', 'replace')

Try / catch

try:
    result = _parse_ply_gaussian(data)
except ValueError as e:
    if 'unsupported PLY format' in str(e):
        convert_to_binary_little_endian(path)  # e.g. via plyfile
    else:
        raise

Prevention

When it happens

Trigger: File3DToSplat on a PLY saved as 'format ascii 1.0' (common output of mesh tools like MeshLab exports or hand-edited files) or 'format binary_big_endian 1.0' (rare, some old scanners/Big-endian platforms).

Common situations: Exporting a gaussian PLY from a tool that defaults to ASCII; converting mesh PLYs from CAD/scanner software that writes big-endian; assuming any .ply is 3DGS-compatible when it is a plain mesh export.

Related errors


AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14). Data as JSON: /api/errors/ba8786793e0589ce. Report an issue: GitHub.