优化脸色发青问题
This commit is contained in:
1 parent
5685a46331
commit
dbe42abf1f
2 files changed
+17
-2
No files matched your search
@@ -800,6 +800,8 @@ bool MeshTexture::ListCameraFaces(FaceDataViewArr& facesDatas, float fOutlierThr
|
|||||||
// scene.mesh.invalidFaces.clear();
|
// scene.mesh.invalidFaces.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<int> faceViewCount(faces.size(), 0);
|
||||||
|
|
||||||
// extract array of faces viewed by each image
|
// extract array of faces viewed by each image
|
||||||
IIndexArr views(_views);
|
IIndexArr views(_views);
|
||||||
if (views.empty()) {
|
if (views.empty()) {
|
||||||
@@ -1105,11 +1107,24 @@ bool MeshTexture::ListCameraFaces(FaceDataViewArr& facesDatas, float fOutlierThr
|
|||||||
const Face& facet = faces[idxFace];
|
const Face& facet = faces[idxFace];
|
||||||
rasterer.idxFace = idxFace;
|
rasterer.idxFace = idxFace;
|
||||||
|
|
||||||
if (scene.is_face_visible(strName.c_str(), idxFace))
|
bool skipVisibilityCheck = false;
|
||||||
|
|
||||||
|
int coverage = faceViewCount[idxFace];
|
||||||
|
|
||||||
|
if (coverage < 5) {
|
||||||
|
skipVisibilityCheck = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (skipVisibilityCheck || scene.is_face_visible(strName.c_str(), idxFace))
|
||||||
{
|
{
|
||||||
rasterer.Project(facet, triangleRasterizer);
|
rasterer.Project(facet, triangleRasterizer);
|
||||||
if (!rasterer.validFace)
|
if (!rasterer.validFace)
|
||||||
rasterer.Project(facet, triangleRasterizer);
|
rasterer.Project(facet, triangleRasterizer);
|
||||||
|
|
||||||
|
// 如果投影成功,增加面片覆盖率计数
|
||||||
|
if (rasterer.validFace) {
|
||||||
|
faceViewCount[idxFace]++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1353,7 +1353,7 @@ class ModelProcessor:
|
|||||||
face_visible = v0_visible | v1_visible | v2_visible
|
face_visible = v0_visible | v1_visible | v2_visible
|
||||||
|
|
||||||
# 使用与CPU版本相同的后续处理
|
# 使用与CPU版本相同的后续处理
|
||||||
shrunk_visibility = self._shrink_face_visibility(face_visible.cpu().numpy(), 6)
|
shrunk_visibility = self._shrink_face_visibility(face_visible.cpu().numpy(), 10)
|
||||||
expanded_visibility = self._expand_face_visibility(face_visible.cpu().numpy(), 30)
|
expanded_visibility = self._expand_face_visibility(face_visible.cpu().numpy(), 30)
|
||||||
shrunk_visibility2 = self._shrink_face_visibility(face_visible.cpu().numpy(), 50)
|
shrunk_visibility2 = self._shrink_face_visibility(face_visible.cpu().numpy(), 50)
|
||||||
expanded_edge = expanded_visibility & ~shrunk_visibility2
|
expanded_edge = expanded_visibility & ~shrunk_visibility2
|
||||||
|
|||||||
Reference in new issue
Block a user