FyroxEngine/Fyrox · error
: Mesh has a triangle with a zero-length edge!
Error message
{}: Mesh has a triangle with a zero-length edge! What it means
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.
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.
Example fix
// before: exporting mesh with duplicated vertices gltf_primitive indices [0,1,1] // zero-length edge // after: dissolve degenerate triangles before export # Blender: Edit Mode > Select All > Mesh > Clean Up > Degenerate Dissolve
Defensive patterns
Strategy: validation
Validate before calling
// Before loading, validate mesh triangles in the glTF JSON/asset:
// ensure no primitive triangle reuses a vertex index within a triangle
// and no two triangle vertices coincide positionally.
fn has_degenerate_edges(positions: &[[f32; 3]], indices: &[u32]) -> bool {
indices.chunks(3).any(|t| {
let (a, b, c) = (positions[t[0] as usize], positions[t[1] as usize], positions[t[2] as usize]);
a == b || b == c || a == c
})
} Prevention
- 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.
When it happens
Trigger: 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).
Common situations: 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.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- : Model has triangles with repeated vertices
- : Mesh has a triangle with edge length
- Failed to import animation
- glTF material failed to import. Reason
- A node with existing name
AI-assisted analysis of FyroxEngine/Fyrox@76c91aad8e (2026-09-10).
Data as JSON: /api/errors/ea3f15fcf35a24ea.
Report an issue: GitHub.
Appendix: source
Thrown at fyrox-impl/src/resource/gltf/mod.rs:472
) -> 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 {
Log::info(format!(
"{}: Smallest triangle edge: {}",
path.to_string_lossy(),
min_length
));
}
}
Ok(result)View on GitHub (pinned to 76c91aad8e)