FyroxEngine/Fyrox · error

: Model has triangles with repeated vertices

Error message

{}: Model has triangles with repeated vertices: {}

What it means

Under the mesh_analysis feature, glTF mesh import collects statistics on triangle indices and detects triangles whose vertices repeat (degenerate/wrapped triangles, e.g. fans reusing a vertex). If any are found, this error is logged with the model path and count. It does not abort import; it indicates potentially malformed index data that can break normals/physics.

Solutions

  1. Enable the mesh_analysis feature in development, fix the source mesh in the DCC tool (remove degenerate triangles, weld vertices), then re-export
  2. Re-triangulate/validate the mesh with a mesh-cleanup pass before export
  3. If the repeated indices are intentional (e.g. wide-triangle tricks), suppress/ignore the log after verifying geometry renders correctly
  4. Check which mesh the path points to and inspect its index buffer for duplicate indices within a triangle

Example fix

// before: degenerate triangles shipped in production asset
// after: strip degenerate indices at asset build time
for tri in indices.chunks_exact(3) {
    let [a, b, c] = tri else { continue };
    if a == b || b == c || a == c { continue; } // skip degenerate
    clean.push(a); clean.push(b); clean.push(c);
}
Defensive patterns

Strategy: validation

Validate before calling

// Detect repeated vertex indices per triangle before import
gltf::import("model.glb")?.0.iter().for_each(|(_, _, m)| {
    for prim in &m.primitives {
        if let Some(idx) = &prim.indices {
            for t in idx.chunks_exact(3) {
                assert!(t[0] != t[1] && t[1] != t[2] && t[0] != t[2], "degenerate triangle");
            }
        }
    }
});

Prevention

When it happens

Trigger: import_from_slice with feature "mesh_analysis" enabled, importing a glTF whose mesh primitive indices form triangles with repeated vertex indices (i == j, j == k, or i == k), counted in stats.repeated_index_count.

Common situations: Assets exported with 'write degenerate triangles' or stitch seams, triangulated strips converted poorly, or meshes with duplicated vertices that should be welded; typically caught during asset QA.

Related errors


AI-assisted analysis of FyroxEngine/Fyrox@76c91aad8e (2026-09-10). Data as JSON: /api/errors/380d79eeea27b29a. Report an issue: GitHub.

Appendix: source

Thrown at fyrox-impl/src/resource/gltf/mod.rs:464

    Ok(context.io.load_file(&path).await?)
}

fn import_meshes(
    gltf: &Document,
    path: &Path,
    mats: &[MaterialResource],
    bufs: &[Vec<u8>],
) -> Result<Vec<MeshData>> {
    let mut result: Vec<MeshData> = Vec::with_capacity(gltf.nodes().len());
    let mut stats = GeometryStatistics::default();
    for node in gltf.nodes() {
        if let Some(mesh) = node.mesh() {
            result.push(import_mesh(mesh, mats, bufs, &mut stats)?);
        }
    }
    if cfg!(feature = "mesh_analysis") {
        if stats.repeated_index_count > 0 {
            Log::err(format!(
                "{}: Model has triangles with repeated vertices: {}",
                path.to_string_lossy(),
                stats.repeated_index_count
            ));
        }
        let min_length = stats.min_edge_length();
        if min_length == 0.0 {
            Log::err(format!(
                "{}: Mesh has a triangle with a zero-length edge!",
                path.to_string_lossy()
            ));
        } else if min_length <= f32::EPSILON {
            Log::err(format!(
                "{}: Mesh has a triangle with edge length: {}",
                path.to_string_lossy(),
                min_length
            ));
        } else {

View on GitHub (pinned to 76c91aad8e)