Cracks in tesselation

I want to mesh a brep object for rendering. I use BRepMesh::Mesh(Face,Deflection), and I get "T junction" ie a vertex is on another triangle's edge. Of course this leads in unnaceptable cracks in tesselation for a quality render.

Those bad junction arise only between different TopoDS_Faces : even if I use the same deflection for 2 faces, I don't have the same "tesselation level" (due to different curvatures of the TopoDS_Faces), hence a different number of vertices on the edge hence my bad junctions...

Anyone noticed this problem ? Is there an other (better) meshing algorithm ? is there a way to provide a deflection for edges' curvature of face instead of face's curvature ? Is there a workaround for this problem ?

Thanks in advance,

Francois Lauzon's picture

Hi Eric,
If you put your faces in a shell, you won't have this problem and everything will be nicely shaded. Of course, your face must be connectable in a shell.


Jawa's picture

thanks, i'll try this...

Vasiliy Radostev's picture

Hi Francois,

Which tool should be used for creation of shell from faces?
Can you show code which demonstrates how is it possible to collect faces?

Thank you very much.

Francois Lauzon's picture

Hi Vasiliy,
I'm using BRepTools_Sewing, then I took the result and try to upgrade it using ShapeUpgrade_ShellSewing, then I took the result and try to fix problems using ShapeFix_Shape.

Good Luck,

Anonymous's picture

Use BRepOffsetAPI_Sewing (or directly BRepAlgo_Sewing) instead of BRepTools_Sewing.

Vasiliy Radostev's picture

I tried this:

Standard_Integer num = reader.NbShapes(); // Number of shapes in scene

// For each shape
for (int i = 1; i <= num; i++)
// Get i-th shape
TopoDS_Shape shape = reader.Shape(i);

// Get all the faces of the shape and create sewed shape
BRepOffsetAPI_Sewing sewing(precision, FALSE);

// Create explorer to browse shape
TopExp_Explorer ex;
// For each face
for (ex.Init(shape, TopAbs_FACE); ex.More(); ex.Next())

TopoDS_Shape new_shape = sewing.SewedShape();

BRepMesh::Mesh(new_shape, precision);

// For each face
for (ex.Init(new_shape, TopAbs_FACE); ex.More(); ex.Next())
// Get face
TopoDS_Face face = TopoDS::Face(ex.Current());
TopLoc_Location loc;
// Get triagulation of the face
Handle(Poly_Triangulation) facing = BRep_Tool::Triangulation(face, loc);

// Handlimg of triangulation

But it doesn't solve the problem: if precision is small, no changes in geometry. But if precision is large - shape is seriously damaged.
Maybe I used wrong approach for mesh creation?