进一步优化
This commit is contained in:
1 parent
2d1f6a13e5
commit
974095dafa
1 file changed
+26
-3
@@ -15826,6 +15826,21 @@ void MeshTexture::ApplyGlobalSeamLevelingOnRCPatches(
|
||||
scene.mesh.ListIncidenteFaceFaces();
|
||||
|
||||
seamEdges.clear(); seamVertices.clear();
|
||||
|
||||
// // 填充 faceToPatchID
|
||||
// faceToPatchID.assign(scene.mesh.faces.size(), NO_ID);
|
||||
// for (size_t pi = 0; pi < rcPatches.size(); ++pi) {
|
||||
// if (rcToTexPatch[pi] == NO_ID) continue;
|
||||
// uint32_t texPatchID = rcToTexPatch[pi];
|
||||
// for (FIndex vfID : rcPatches[pi].faces) {
|
||||
// if (vfID >= virtualFaceMap.size()) continue;
|
||||
// for (FIndex fid : virtualFaceMap[vfID].faces) {
|
||||
// if (fid < faceToPatchID.size())
|
||||
// faceToPatchID[fid] = texPatchID;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
BuildSeamEdgesFromFaceToPatchID();
|
||||
CreateSeamVertices();
|
||||
|
||||
@@ -15845,6 +15860,7 @@ void MeshTexture::ApplyGlobalSeamLevelingOnRCPatches(
|
||||
}
|
||||
}
|
||||
}
|
||||
// faceTexcoords = localFaceTexcoords;
|
||||
|
||||
DEBUG_EXTRA("Bridge done: %zu texturePatches ready, calling GlobalSeamLeveling4...", numValidPatches);
|
||||
|
||||
@@ -16344,6 +16360,12 @@ bool MeshTexture::RasterizeVirtualFaces(
|
||||
cv::Mat patch;
|
||||
cv::remap(srcImg.image, patch, mapX, mapY, cv::INTER_NEAREST, cv::BORDER_CONSTANT, cv::Scalar(0,0,0));
|
||||
|
||||
// ============================================================
|
||||
// ★ 光度校正:光栅化阶段不再应用 gain
|
||||
// GSL4 会统一做全局颜色优化,这里乘了会导致双重校正
|
||||
// 如果后续不走 GSL4 流程,可以把下面 false 改为 true 恢复
|
||||
// ============================================================
|
||||
#if 0 // ← 改为 1 可临时恢复光栅化时乘 gain
|
||||
// 应用光度校正
|
||||
const cv::Vec3f& gain = (viewID < (IIndex)m_imageGains.size()) ? m_imageGains[viewID] : cv::Vec3f(1,1,1);
|
||||
const bool applyGain = (gain != cv::Vec3f(1,1,1));
|
||||
@@ -16358,6 +16380,7 @@ bool MeshTexture::RasterizeVirtualFaces(
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// 写入 atlas(最高分胜出)
|
||||
#pragma omp critical (atlas_write)
|
||||
@@ -16376,9 +16399,9 @@ bool MeshTexture::RasterizeVirtualFaces(
|
||||
// ★ 已删除错误放在这里的 m_texelPatchID.assign(...)
|
||||
|
||||
if (currentScore > m_texelScores[idx].score) {
|
||||
color[0] = cv::saturate_cast<uchar>(std::min(255.0f, color[0] * 1.05f));
|
||||
color[1] = cv::saturate_cast<uchar>(std::min(255.0f, color[1] * 1.05f));
|
||||
color[2] = cv::saturate_cast<uchar>(std::min(255.0f, color[2] * 1.05f));
|
||||
color[0] = cv::saturate_cast<uchar>(std::min(255.0f, color[0] * 1.0f));
|
||||
color[1] = cv::saturate_cast<uchar>(std::min(255.0f, color[1] * 1.0f));
|
||||
color[2] = cv::saturate_cast<uchar>(std::min(255.0f, color[2] * 1.0f));
|
||||
|
||||
// atlas(atlasY, atlasX) = Pixel8U{color[2], color[1], color[0]};
|
||||
if (atlasY >= 0 && atlasY < atlas.rows && atlasX >= 0 && atlasX < atlas.cols) {
|
||||
|
||||
Reference in new issue
Block a user