参数和逻辑微调

This commit is contained in:
hesuicong committed 2026-10-19 11:19:42 +08:00
1 parent c5f93374f4
commit f7fccb2ae9
1 file changed
+9 -5
+9 -5
View File
@@ -16623,6 +16623,8 @@ bool MeshTexture::RasterizeVirtualFaces(
// 计算重心坐标 // 计算重心坐标
float b0, b1, b2; float b0, b1, b2;
bool inside = ComputeBarycentric(u, v_coord, uv[0], uv[1], uv[2], b0, b1, b2); bool inside = ComputeBarycentric(u, v_coord, uv[0], uv[1], uv[2], b0, b1, b2);
if (!inside)
continue;
// // 统一用宽松容差判断 // // 统一用宽松容差判断
// const float EPS_BARY = 1e-2f; // const float EPS_BARY = 1e-2f;
@@ -16733,7 +16735,7 @@ bool MeshTexture::RasterizeVirtualFaces(
} }
// 再与 mainFloat 混合(低频占主导,主视图补充细节) // 再与 mainFloat 混合(低频占主导,主视图补充细节)
// cv::Mat finalPatch = filledLowFreq * 0.7f + mainFloat * 0.3f; cv::Mat finalPatch = filledLowFreq * 0.7f + mainFloat * 0.3f;
// cv::Mat finalPatch = filledLowFreq * 0.85f + highFreq * 0.15f; // cv::Mat finalPatch = filledLowFreq * 0.85f + highFreq * 0.15f;
// 对高频做 soft clamp,防止个别极端值拉白发白 // 对高频做 soft clamp,防止个别极端值拉白发白
@@ -16741,7 +16743,7 @@ bool MeshTexture::RasterizeVirtualFaces(
cv::max(highFreq, -0.2f, highFreqClamped); cv::max(highFreq, -0.2f, highFreqClamped);
cv::min(highFreqClamped, 0.2f, highFreqClamped); cv::min(highFreqClamped, 0.2f, highFreqClamped);
cv::Mat finalPatch = filledLowFreq * 0.8f + highFreqClamped * 0.2f; // cv::Mat finalPatch = filledLowFreq * 0.8f + highFreqClamped * 0.2f;
// cv::Mat finalPatch = mainFloat; // cv::Mat finalPatch = mainFloat;
// cv::Mat finalPatch = lowFreqPatch; // cv::Mat finalPatch = lowFreqPatch;
@@ -16761,9 +16763,11 @@ bool MeshTexture::RasterizeVirtualFaces(
for (int x = 0; x < patchW; ++x) { for (int x = 0; x < patchW; ++x) {
cv::Vec3b color = finalPatch8U.at<cv::Vec3b>(y, x); cv::Vec3b color = finalPatch8U.at<cv::Vec3b>(y, x);
float mx = mapX.at<float>(y, x); // float mx = mapX.at<float>(y, x);
float my = mapY.at<float>(y, x); // float my = mapY.at<float>(y, x);
if (mx < 0 || my < 0) continue; // 真正的空洞才跳过 // if (mx < 0 || my < 0) continue; // 真正的空洞才跳过
if (color[0] == 0 && color[1] == 0 && color[2] == 0) continue;
int atlasX = x + minX, atlasY = y + minY; int atlasX = x + minX, atlasY = y + minY;
if (atlasX<0||atlasX>=textureSize||atlasY<0||atlasY>=textureSize) continue; if (atlasX<0||atlasX>=textureSize||atlasY<0||atlasY>=textureSize) continue;