进一步整理finalPatch逻辑
This commit is contained in:
1 parent
209fe6a260
commit
875f0c5be5
1 file changed
+14
-14
+14
-14
@@ -16695,12 +16695,12 @@ bool MeshTexture::RasterizeVirtualFaces(
|
|||||||
|
|
||||||
cv::Mat highFreq = highFreqAccum;
|
cv::Mat highFreq = highFreqAccum;
|
||||||
|
|
||||||
// ========== 每个顶点独立判断可见性(增强版)==========
|
// ========== 每个顶点独立判断可见性(增强版)==========
|
||||||
bool vertexVisible[3] = {false, false, false};
|
bool vertexVisible[3] = {false, false, false};
|
||||||
cv::Vec3f vertexBestColor[3] = {cv::Vec3f(0,0,0), cv::Vec3f(0,0,0), cv::Vec3f(0,0,0)};
|
cv::Vec3f vertexBestColor[3] = {cv::Vec3f(0,0,0), cv::Vec3f(0,0,0), cv::Vec3f(0,0,0)};
|
||||||
|
|
||||||
// 检查主视图
|
// 检查主视图
|
||||||
for (int j = 0; j < 3; ++j) {
|
for (int j = 0; j < 3; ++j) {
|
||||||
int vx = (int)(uv[j].x * textureSize) - minX;
|
int vx = (int)(uv[j].x * textureSize) - minX;
|
||||||
int vy = (int)(uv[j].y * textureSize) - minY;
|
int vy = (int)(uv[j].y * textureSize) - minY;
|
||||||
if (vx >= 0 && vx < patchW && vy >= 0 && vy < patchH) {
|
if (vx >= 0 && vx < patchW && vy >= 0 && vy < patchH) {
|
||||||
@@ -16710,10 +16710,10 @@ for (int j = 0; j < 3; ++j) {
|
|||||||
vertexBestColor[j] = color;
|
vertexBestColor[j] = color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果主视图不可见,检查辅助视图
|
// 如果主视图不可见,检查辅助视图
|
||||||
if (hasLowFreqViews && (!vertexVisible[0] || !vertexVisible[1] || !vertexVisible[2])) {
|
if (hasLowFreqViews && (!vertexVisible[0] || !vertexVisible[1] || !vertexVisible[2])) {
|
||||||
for (const auto& lfv : lowFreqViews) {
|
for (const auto& lfv : lowFreqViews) {
|
||||||
if (lfv.viewId >= (IIndex)images.size() || images[lfv.viewId].image.empty()) continue;
|
if (lfv.viewId >= (IIndex)images.size() || images[lfv.viewId].image.empty()) continue;
|
||||||
|
|
||||||
@@ -16760,10 +16760,10 @@ if (hasLowFreqViews && (!vertexVisible[0] || !vertexVisible[1] || !vertexVisible
|
|||||||
if (vertexVisible[0] && vertexVisible[1] && vertexVisible[2])
|
if (vertexVisible[0] && vertexVisible[1] && vertexVisible[2])
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma omp critical (vertex_visibility)
|
#pragma omp critical (vertex_visibility)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < 3; ++j) {
|
for (int j = 0; j < 3; ++j) {
|
||||||
VIndex vi = face[j];
|
VIndex vi = face[j];
|
||||||
if (vi < m_vertexColors.size() && vertexVisible[j]) {
|
if (vi < m_vertexColors.size() && vertexVisible[j]) {
|
||||||
@@ -16771,7 +16771,7 @@ if (hasLowFreqViews && (!vertexVisible[0] || !vertexVisible[1] || !vertexVisible
|
|||||||
m_vertexColors[vi].mainColor = vertexBestColor[j];
|
m_vertexColors[vi].mainColor = vertexBestColor[j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========== 空洞填充与合成 ==========
|
// ========== 空洞填充与合成 ==========
|
||||||
cv::Mat filledLowFreq = lowFreqPatch.clone();
|
cv::Mat filledLowFreq = lowFreqPatch.clone();
|
||||||
@@ -16784,8 +16784,8 @@ if (hasLowFreqViews && (!vertexVisible[0] || !vertexVisible[1] || !vertexVisible
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cv::Mat finalPatch = filledLowFreq * 0.7f + mainFloat * 0.3f;
|
cv::Mat finalPatch = filledLowFreq * 0.2f + mainFloat * 0.8f;
|
||||||
// cv::Mat finalPatch = filledLowFreq;
|
// cv::Mat finalPatch = mainFloat;
|
||||||
|
|
||||||
// 钳制到 [0, 1]
|
// 钳制到 [0, 1]
|
||||||
cv::Mat clampedPatch;
|
cv::Mat clampedPatch;
|
||||||
|
|||||||
Reference in new issue
Block a user