{"record":{"id":"380d79eeea27b29a","repo":"FyroxEngine/Fyrox","slug":"model-has-triangles-with-repeated-vertices","errorCode":null,"errorMessage":"{}: Model has triangles with repeated vertices: {}","messagePattern":"(.+?): Model has triangles with repeated vertices: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"fyrox-impl/src/resource/gltf/mod.rs","lineNumber":464,"sourceCode":"    Ok(context.io.load_file(&path).await?)\n}\n\nfn import_meshes(\n    gltf: &Document,\n    path: &Path,\n    mats: &[MaterialResource],\n    bufs: &[Vec<u8>],\n) -> Result<Vec<MeshData>> {\n    let mut result: Vec<MeshData> = Vec::with_capacity(gltf.nodes().len());\n    let mut stats = GeometryStatistics::default();\n    for node in gltf.nodes() {\n        if let Some(mesh) = node.mesh() {\n            result.push(import_mesh(mesh, mats, bufs, &mut stats)?);\n        }\n    }\n    if cfg!(feature = \"mesh_analysis\") {\n        if stats.repeated_index_count > 0 {\n            Log::err(format!(\n                \"{}: Model has triangles with repeated vertices: {}\",\n                path.to_string_lossy(),\n                stats.repeated_index_count\n            ));\n        }\n        let min_length = stats.min_edge_length();\n        if min_length == 0.0 {\n            Log::err(format!(\n                \"{}: Mesh has a triangle with a zero-length edge!\",\n                path.to_string_lossy()\n            ));\n        } else if min_length <= f32::EPSILON {\n            Log::err(format!(\n                \"{}: Mesh has a triangle with edge length: {}\",\n                path.to_string_lossy(),\n                min_length\n            ));\n        } else {","sourceCodeStart":446,"sourceCodeEnd":482,"githubUrl":"https://github.com/FyroxEngine/Fyrox/blob/76c91aad8eca488ce527b1af707be8b3b24ad72d/fyrox-impl/src/resource/gltf/mod.rs#L446-L482","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Enable the mesh_analysis feature in development, fix the source mesh in the DCC tool (remove degenerate triangles, weld vertices), then re-export","Re-triangulate/validate the mesh with a mesh-cleanup pass before export","If the repeated indices are intentional (e.g. wide-triangle tricks), suppress/ignore the log after verifying geometry renders correctly","Check which mesh the path points to and inspect its index buffer for duplicate indices within a triangle"],"exampleFix":"// before: degenerate triangles shipped in production asset\n// after: strip degenerate indices at asset build time\nfor tri in indices.chunks_exact(3) {\n    let [a, b, c] = tri else { continue };\n    if a == b || b == c || a == c { continue; } // skip degenerate\n    clean.push(a); clean.push(b); clean.push(c);\n}","handlingStrategy":"validation","validationCode":"// Detect repeated vertex indices per triangle before import\ngltf::import(\"model.glb\")?.0.iter().for_each(|(_, _, m)| {\n    for prim in &m.primitives {\n        if let Some(idx) = &prim.indices {\n            for t in idx.chunks_exact(3) {\n                assert!(t[0] != t[1] && t[1] != t[2] && t[0] != t[2], \"degenerate triangle\");\n            }\n        }\n    }\n});","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run mesh cleanup (weld vertices, remove degenerates) before export","Enable the mesh_analysis feature in dev/CI to catch bad assets","Re-export with 'optimize indices' and without strip-restart quirks","Treat this log as an asset QA failure, not a runtime bug"],"tags":["gltf","mesh","asset-import","geometry"],"backgroundTag":"mesh-degenerate-triangles","analyzedSha":"76c91aad8eca488ce527b1af707be8b3b24ad72d","analyzedAt":"2026-09-10T16:04:01.633Z","contentChangedAt":"2026-09-10T16:04:01.633Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}