|
|
|
|
@ -10320,6 +10320,13 @@ void MeshTexture::GlobalSeamLeveling3()
@@ -10320,6 +10320,13 @@ void MeshTexture::GlobalSeamLeveling3()
|
|
|
|
|
const MatIdx col1(vertpatch2row.at(idxPatch1)); |
|
|
|
|
ASSERT(idxPatch0 < idxPatch1); |
|
|
|
|
const MatIdx rowA((MatIdx)coeffB.size()); |
|
|
|
|
|
|
|
|
|
// ★ 新增:如果亮度差太大,说明一个是高光一个是暗区,跳过这个约束
|
|
|
|
|
const float lum0 = GetLuminance(color0); // 或者用 Y 通道
|
|
|
|
|
const float lum1 = GetLuminance(color1); |
|
|
|
|
if (std::abs(lum0 - lum1) > 50.0f) // 阈值可调
|
|
|
|
|
continue; // 不添加这个接缝约束,避免传播高光
|
|
|
|
|
|
|
|
|
|
coeffB.Insert(color1 - color0); |
|
|
|
|
ASSERT(ISFINITE(coeffB.back())); |
|
|
|
|
rows.emplace_back(rowA, col0, 1.f); |
|
|
|
|
@ -10428,6 +10435,17 @@ void MeshTexture::GlobalSeamLeveling3()
@@ -10428,6 +10435,17 @@ void MeshTexture::GlobalSeamLeveling3()
|
|
|
|
|
clamped_a[2] = CLAMP(a[2], -maxAdjC, maxAdjC); |
|
|
|
|
|
|
|
|
|
const Color col(RGB2YCBCR(Color(v))); |
|
|
|
|
|
|
|
|
|
// ★ 新增:如果已经很亮且调整量是正向的,跳过提亮
|
|
|
|
|
if (col[0] > 210.0f && a[0] > 0.0f) { |
|
|
|
|
// 已经够亮了,不再加亮度(但允许降亮度,也允许调色度)
|
|
|
|
|
clamped_a[0] = 0.0f; |
|
|
|
|
} else { |
|
|
|
|
clamped_a[0] = CLAMP(a[0], -maxAdjY, maxAdjY); |
|
|
|
|
} |
|
|
|
|
clamped_a[1] = CLAMP(a[1], -maxAdjC, maxAdjC); |
|
|
|
|
clamped_a[2] = CLAMP(a[2], -maxAdjC, maxAdjC); |
|
|
|
|
|
|
|
|
|
const Color acol(YCBCR2RGB(Color(col + clamped_a))); |
|
|
|
|
for (int p = 0; p < 3; ++p) |
|
|
|
|
v[p] = (uint8_t)CLAMP(ROUND2INT(acol[p]), 0, 255); |
|
|
|
|
|