So, I have created some meshes with UProceduralMeshComponent, it seems to be correctly connected, but it has this noise mainly on sides of the mesh, is it normal? or there is a way to get rid of them?

void ADungeonMesh::Initialize(UShape* Shape, float Height, float ZOffset)
{
const auto NormalVerts = CreateVertices(Shape, Height, ZOffset);
TArray<FVector> Normals = {};
TArray<int> Triangles = {};
for (const auto Direction : Direction3DFunctions::GetDirections())
{
switch (Direction)
{
case EDirection3D::Top:
{
Triangles.Append({
FNamedVertices::GetTopDownRight(),
FNamedVertices::GetTopDownLeft(),
FNamedVertices::GetTopUpLeft(),
FNamedVertices::GetTopDownRight(),
FNamedVertices::GetTopUpLeft(),
FNamedVertices::GetTopUpRight(),
});
break;
}
case EDirection3D::Right:
{
Triangles.Append({
FNamedVertices::GetRightDownLeft(),
FNamedVertices::GetRightUpLeft(),
FNamedVertices::GetRightDownRight(),
FNamedVertices::GetRightDownRight(),
FNamedVertices::GetRightUpLeft(),
FNamedVertices::GetRightUpRight(),
});
break;
}
case EDirection3D::Bottom:
{
Triangles.Append({
FNamedVertices::GetBottomDownLeft(),
FNamedVertices::GetBottomDownRight(),
FNamedVertices::GetBottomUpLeft(),
FNamedVertices::GetBottomDownRight(),
FNamedVertices::GetBottomUpRight(),
FNamedVertices::GetBottomUpLeft(),
});
break;
}
case EDirection3D::Left:
{
Triangles.Append({
FNamedVertices::GetLeftDownLeft(),
FNamedVertices::GetLeftUpLeft(),
FNamedVertices::GetLeftDownRight(),
FNamedVertices::GetLeftDownRight(),
FNamedVertices::GetLeftUpLeft(),
FNamedVertices::GetLeftUpRight(),
});
break;
}
case EDirection3D::Back:
{
Triangles.Append({
FNamedVertices::GetBackDownLeft(),
FNamedVertices::GetBackUpLeft(),
FNamedVertices::GetBackDownRight(),
FNamedVertices::GetBackDownRight(),
FNamedVertices::GetBackUpLeft(),
FNamedVertices::GetBackUpRight(),
});
break;
}
case EDirection3D::Front:
{
Triangles.Append({
FNamedVertices::GetFrontBottomLeft(),
FNamedVertices::GetFrontTopLeft(),
FNamedVertices::GetFrontBottomRight(),
FNamedVertices::GetFrontBottomRight(),
FNamedVertices::GetFrontTopLeft(),
FNamedVertices::GetFrontTopRight(),
});
break;
}
}
}
Mesh->CreateMeshSection(0, NormalVerts.Vertices, Triangles, NormalVerts.Normals
, {}, {},
TArray<FProcMeshTangent>(),
true);
}
FNormalVertices ADungeonMesh::CreateVertices(const UShape* Shape, const float Height,
const float ZOffset
)
{
TArray<FVector> Vertices = {};
TArray<FVector> Normals = {};
// Bottom
Vertices.Append({
FVector(Shape->Position.X, Shape->Position.Y, 0 + ZOffset),
FVector(Shape->Position.X + Shape->Size.X, Shape->Position.Y, 0 + ZOffset),
FVector(Shape->Position.X, Shape->Position.Y + Shape->Size.Y, 0 + ZOffset),
FVector(Shape->Position.X + Shape->Size.X, Shape->Position.Y + Shape->Size.Y,
0 + ZOffset),
});
Normals.Append({
FVector::DownVector,
FVector::DownVector,
FVector::DownVector,
FVector::DownVector
});
// Front
Vertices.Append({
FVector(Shape->Position.X, Shape->Position.Y, 0 + ZOffset),
FVector(Shape->Position.X + Shape->Size.X, Shape->Position.Y, 0 + ZOffset),
FVector(Shape->Position.X, Shape->Position.Y, Height + ZOffset),
FVector(Shape->Position.X + Shape->Size.X, Shape->Position.Y, Height + ZOffset),
});
Normals.Append({
FVector::BackwardVector,
FVector::BackwardVector,
FVector::BackwardVector,
FVector::BackwardVector,
});
// Left
Vertices.Append({
FVector(Shape->Position.X, Shape->Position.Y + Shape->Size.Y, 0 + ZOffset),
FVector(Shape->Position.X, Shape->Position.Y, 0 + ZOffset),
FVector(Shape->Position.X, Shape->Position.Y + Shape->Size.Y, Height + ZOffset),
FVector(Shape->Position.X, Shape->Position.Y, Height + ZOffset),
});
Normals.Append({
FVector::LeftVector,
FVector::LeftVector,
FVector::LeftVector,
FVector::LeftVector
});
// Back
Vertices.Append({
FVector(Shape->Position.X + Shape->Size.X, Shape->Position.Y + Shape->Size.Y, 0 + ZOffset),
FVector(Shape->Position.X, Shape->Position.Y + Shape->Size.Y, 0 + ZOffset),
FVector(Shape->Position.X + Shape->Size.X, Shape->Position.Y + Shape->Size.Y,
Height + ZOffset),
FVector(Shape->Position.X, Shape->Position.Y + Shape->Size.Y, Height + ZOffset),
});
Normals.Append({
FVector::ForwardVector,
FVector::ForwardVector,
FVector::ForwardVector,
FVector::ForwardVector,
});
// Right
Vertices.Append({
FVector(Shape->Position.X + Shape->Size.X, Shape->Position.Y, 0 + ZOffset),
FVector(Shape->Position.X + Shape->Size.X, Shape->Position.Y + Shape->Size.Y, 0 + ZOffset),
FVector(Shape->Position.X + Shape->Size.X, Shape->Position.Y, Height + ZOffset),
FVector(Shape->Position.X + Shape->Size.X, Shape->Position.Y + Shape->Size.Y,
Height + ZOffset),
});
Normals.Append({
FVector::RightVector,
FVector::RightVector,
FVector::RightVector,
FVector::RightVector,
});
// Top
Vertices.Append({
FVector(Shape->Position.X, Shape->Position.Y, Height + ZOffset),
FVector(Shape->Position.X + Shape->Size.X, Shape->Position.Y, Height + ZOffset),
FVector(Shape->Position.X, Shape->Position.Y + Shape->Size.Y, Height + ZOffset),
FVector(Shape->Position.X + Shape->Size.X, Shape->Position.Y + Shape->Size.Y,
Height + ZOffset),
});
Normals.Append({
FVector::UpVector,
FVector::UpVector,
FVector::UpVector,
FVector::UpVector,
});
return FNormalVertices{Normals, Vertices};
}





