{"record":{"id":"ea3f15fcf35a24ea","repo":"FyroxEngine/Fyrox","slug":"mesh-has-a-triangle-with-a-zero-length-edge","errorCode":null,"errorMessage":"{}: Mesh has a triangle with a zero-length edge!","messagePattern":"(.+?): Mesh has a triangle with a zero-length edge!","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"fyrox-impl/src/resource/gltf/mod.rs","lineNumber":472,"sourceCode":") -> 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 {\n            Log::info(format!(\n                \"{}: Smallest triangle edge: {}\",\n                path.to_string_lossy(),\n                min_length\n            ));\n        }\n    }\n    Ok(result)","sourceCodeStart":454,"sourceCodeEnd":490,"githubUrl":"https://github.com/FyroxEngine/Fyrox/blob/76c91aad8eca488ce527b1af707be8b3b24ad72d/fyrox-impl/src/resource/gltf/mod.rs#L454-L490","documentation":"During glTF mesh import, Fyrox computes the minimum edge length across all triangles and logs this error when an edge has exactly zero length, i.e. a triangle has two identical vertices. Such degenerate triangles produce invalid normals and broken rendering, so the importer flags the source asset as defective.","triggerScenarios":"Loading a glTF/GLB file via ResourceManager (import_meshes during import_from_slice) where any triangle in a mesh primitive has two vertices at identical positions (min_edge_length() == 0.0).","commonSituations":"Exporting models from DCC tools (Blender, 3ds Max) with unmerged duplicate vertices, decimated meshes collapsed to zero-area triangles, or procedural geometry generators emitting duplicate vertex indices.","solutions":["Open the model in a DCC tool and remove degenerate faces (e.g. Blender: Select All, Mesh > Clean Up > Degenerate Dissolve).","Run a mesh-cleanup pass in the export pipeline (merge by distance, remove zero-area faces) and re-export the glTF.","If the asset cannot be fixed, use a mesh processing tool (meshoptimizer, Blender's 3D-Print toolbox) to strip degenerate triangles before import."],"exampleFix":"// before: exporting mesh with duplicated vertices\ngltf_primitive indices [0,1,1] // zero-length edge\n\n// after: dissolve degenerate triangles before export\n# Blender: Edit Mode > Select All > Mesh > Clean Up > Degenerate Dissolve","handlingStrategy":"validation","validationCode":"// Before loading, validate mesh triangles in the glTF JSON/asset:\n// ensure no primitive triangle reuses a vertex index within a triangle\n// and no two triangle vertices coincide positionally.\nfn has_degenerate_edges(positions: &[[f32; 3]], indices: &[u32]) -> bool {\n    indices.chunks(3).any(|t| {\n        let (a, b, c) = (positions[t[0] as usize], positions[t[1] as usize], positions[t[2] as usize]);\n        a == b || b == c || a == c\n    })\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run Mesh > Clean Up > Degenerate Dissolve in Blender before every glTF export.","Enable 'Merge by Distance' on decimated/sculpted meshes.","Add automated asset-validation in CI that rejects glTF files containing degenerate triangles."],"tags":["gltf","asset-import","mesh","degenerate-geometry"],"backgroundTag":"invalid-argument-value","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"}