Wed, 10/18/2023 - 05:38
I suspect it's an issue with the UVs in the shape. With the code below, I see that the UV coordinates are very large (shouldn't they be between 0-1?),
TopExp_Explorer exp(s, TopAbs_FACE);
while (exp.More())
{
TopoDS_Face face = TopoDS::Face(exp.Current());
TopLoc_Location loc;
auto triangulation = BRep_Tool::Triangulation(face, loc);
for (size_t i = 1; i <= triangulation->NbNodes(); i++)
{
// uv seems wrong.(720,0),(-12,0)...
auto uv = triangulation->UVNode(i);
}
exp.Next();
}
but I don't know how to fix the issue with the UV coordinates in the shape.
Attachments:
Thu, 10/19/2023 - 06:41
Here is the code to reproduce
Thu, 10/19/2023 - 17:23
UV coordinates in
Poly_Triangulation
define points within underlying analytical surface - so that you may use these parameters to fetch 3D point, surface normals and compute derivatives. Their range could be normalized to[0..1]
, but there is no such a requirement in B-Rep definition.In this way, these UV coordinates could be used for texture mapping, but strictly speaking they are not specifically designed for this task. To handle your specific issue, you may consider modifying
Poly_Triangulation
before export (normalize or rescale UV coordinates), change/override glTF export routines or perform postprocessing (change generated glTF file externally).Note that after modification of UV coordinates in
Poly_Triangulation
, OCCT algorithms expecting parameters to original surface might produce incorrect results. Hence, make sure to make face copies or something like that before export, if you would like to go this way.Thu, 11/09/2023 - 04:53
Thank you, It worked fine.
Fri, 03/15/2024 - 13:15
Hi,
I meet another issue, I copy the shape since the original shape has other useage, the Brep_Tool::Triangulation return null.
Fri, 03/15/2024 - 13:58
Hi, by default BRepBuilderAPI_Copy has no copid of mesh. You need to use parameters BRepBuilderAPI_Copy(aShape, true, true)
Best regards, Dmitrii.