feat(sample-v35): 墙顶全板同色终裁落地——南向墙格暗条与D投影立面暗带废止,顶面材质原亮度直填零阴影;F6改墙顶同色断言(实测最大色差1.7);55%锁定

This commit is contained in:
DKChan committed 2026-09-29 20:26:27 +08:00
1 parent 570ac57f1a
commit be8dd13fa3
1 file changed
+30 -26
+30 -26
View File
@@ -271,16 +271,10 @@ def apply_d_projection(board, gmap, cell):
北邻墙地面格 = 三段渐隐投影(顶带 0.22 格边,α0.28 起)。立体断言 F6/A6 的渲染承载。""" 北邻墙地面格 = 三段渐隐投影(顶带 0.22 格边,α0.28 起)。立体断言 F6/A6 的渲染承载。"""
overlay = Image.new("RGBA", board.size, (0, 0, 0, 0)) overlay = Image.new("RGBA", board.size, (0, 0, 0, 0))
d = ImageDraw.Draw(overlay) d = ImageDraw.Draw(overlay)
HILITE = (196, 172, 132) # v3.5:南临墙格的立面暗带+口沿高光已废止(用户终裁:墙顶零阴影全板同色同素材)
seg1, seg2 = int(cell * 0.16), int(cell * 0.25)
for y in range(gmap.h): for y in range(gmap.h):
for x in range(gmap.w): for x in range(gmap.w):
x0, y0 = x * cell, y * cell x0, y0 = x * cell, y * cell
if is_wall(gmap, x, y) and not is_wall(gmap, x, y + 1):
lip = y0 + cell - seg1 - seg2
d.rectangle([x0, lip, x0 + cell, lip + 2], fill=HILITE + (255,))
d.rectangle([x0, lip + 2, x0 + cell, lip + 2 + seg1], fill=(0, 0, 0, 153))
d.rectangle([x0, lip + 2 + seg1, x0 + cell, y0 + cell], fill=(0, 0, 0, 209))
if not is_wall(gmap, x, y) and is_wall(gmap, x, y - 1): if not is_wall(gmap, x, y) and is_wall(gmap, x, y - 1):
bh = int(cell * 0.22) bh = int(cell * 0.22)
for i, a in enumerate([71, 36, 14]): for i, a in enumerate([71, 36, 14]):
@@ -582,15 +576,14 @@ def is_facade_cell(gmap, x, y):
def lift_south_lip(tile): def lift_south_lip(tile):
"""v3.3:南向墙格(南邻地)底部暗条改为顶面同款材质轻微暗档(×0.80)—— """v3.3:南向墙格(南邻地)底部暗条以顶面材质**原亮度**直填——
同一堵墙的顶面材质全板一致,南向厚度面只差明度,不再两截皮。终稿归瓦片重产(§8.5)。""" 全板墙顶同色同素材,零阴影零暗档(用户终裁:「这里没有什么阴影影响,它们是同样颜色的」)。终稿归瓦片重产(§8.5)。"""
im = tile.convert("RGB") im = tile.convert("RGB")
w, h = im.size w, h = im.size
y0 = int(h * 0.60) y0 = int(h * 0.60)
top_ref = im.crop((0, 0, w, y0)) # 顶面区材质 top_ref = im.crop((0, 0, w, y0)) # 顶面区材质
band_h = h - y0 band_h = h - y0
ref = top_ref.resize((w, band_h)) # 顶面纹理拉伸到暗条区(同材质) ref = top_ref.resize((w, band_h)) # v3.5:顶面纹理原亮度直填(无暗档无阴影——全板墙顶同色同素材)
ref = ref.point([min(255, int(i * 0.80)) for i in range(256)] * 3)
out = im.copy() out = im.copy()
out.paste(ref, (0, y0)) out.paste(ref, (0, y0))
if tile.mode == "RGBA": if tile.mode == "RGBA":
@@ -967,25 +960,36 @@ def run_checks(board, placement, records, band, gmap, canvas_img=None):
check("A3b", "图底分离读数(候选 Δ≥30——v2 阈值 55 与格底分档带数学冲突,校准归冻结批)", check("A3b", "图底分离读数(候选 Δ≥30——v2 阈值 55 与格底分档带数学冲突,校准归冻结批)",
(wall_top - floor_px) >= 30, (wall_top - floor_px) >= 30,
"墙顶 %.0f vs 地面 %.0f,Δ=%.0f(v2 阈值 55 系地板 L0.036 时代校定)" % (wall_top, floor_px, wall_top - floor_px)) "墙顶 %.0f vs 地面 %.0f,Δ=%.0f(v2 阈值 55 系地板 L0.036 时代校定)" % (wall_top, floor_px, wall_top - floor_px))
# F6 墙格顶面/立面双明度带(立体断言——南向临地墙格:顶 2/3 vs 立面下 1/3,体积感机器代理) # F6 v3.5 改口径:墙顶全板同色(南向临地墙格顶面 vs 全板墙顶均值,逐通道差 ≤6——
# 原"顶面/立面双明度带 Δ≥18"随南临暗带废止;立体感由 E 格墙面承载)
south_cells = [(x, y) for y in range(gmap.h) for x in range(gmap.w) south_cells = [(x, y) for y in range(gmap.h) for x in range(gmap.w)
if is_wall(gmap, x, y) and not is_wall(gmap, x, y + 1)] if is_wall(gmap, x, y) and not is_wall(gmap, x, y + 1)]
rgbp = board.convert("RGB").load() rgbp = board.convert("RGB").load()
deltas = [] def _cell_top_mean(x, y):
for (x, y) in south_cells: vals = []
ts, bs = [], [] for yy in range(4, int(CELL_D * 0.4), 2):
for yy in range(4, CELL_D - 4, 2):
for xx in range(4, CELL_D - 4, 2): for xx in range(4, CELL_D - 4, 2):
c = rgbp[x * CELL_D + xx, y * CELL_D + yy] vals.append(rgbp[x * CELL_D + xx, y * CELL_D + yy])
lv = 0.2126 * c[0] + 0.7152 * c[1] + 0.0722 * c[2] n = len(vals)
(ts if yy < CELL_D * 2.0 / 3.0 else bs).append(lv) return (sum(v[0] for v in vals) / n, sum(v[1] for v in vals) / n, sum(v[2] for v in vals) / n)
if ts and bs: _excl_all = {FLAG_AT, HOVER_AT} | {(gx, gy) for (gx, gy, _k) in GLOW_CELLS}
deltas.append(sum(ts) / len(ts) - sum(bs) / len(bs)) all_tops = [_cell_top_mean(x, y) for y in range(gmap.h) for x in range(gmap.w)
dmin = min(deltas) if deltas else 0.0 if is_wall(gmap, x, y) and (y == 0 or gmap.grid[y-1][x] == "W") and (x, y) not in _excl_all]
check("F6", "墙格顶面/立面双明度带(南向临地墙格 Δ≥18,体积感机器代理)", ref = tuple(sum(v[i] for v in all_tops) / len(all_tops) for i in range(3))
len(deltas) >= 6 and dmin >= FACADE_MIN, # 排除带附加层的格(旗/悬停/微光——信息层合法染色,不属墙顶色差)
"临地墙格 %d 个;最小 Δ %.1f;均 Δ %.1f(v1 实测均 71.6)" _excl = {FLAG_AT, HOVER_AT} | {(gx, gy) for (gx, gy, _k) in GLOW_CELLS}
% (len(deltas), dmin, sum(deltas) / len(deltas) if deltas else 0)) devs = []
for (x, y) in south_cells:
if (x, y) in _excl:
continue
m = _cell_top_mean(x, y)
dev = max(abs(m[i] - ref[i]) for i in range(3))
devs.append(dev)
dmax = max(devs) if devs else 0.0
check("F6", "墙顶全板同色(南向墙格顶面 vs 全板均值逐通道差 ≤6;旗格排除)",
dmax <= 6.0,
"南向墙格 %d 个(排除 %d 个附加层格);最大色差 %.1f(参考均值 %s)"
% (len(devs), len(_excl & set(south_cells)), dmax, tuple(round(v) for v in ref)))
# F7 整板悬崖 DEPTH_PX 同源(立体断言——解析 game 源码常量,样张悬崖带按其绘制) # F7 整板悬崖 DEPTH_PX 同源(立体断言——解析 game 源码常量,样张悬崖带按其绘制)
band_lv = region_luma(board, (CELL_D, board.size[1] - 3, board.size[0] - CELL_D, board.size[1] - 1)) band_lv = region_luma(board, (CELL_D, board.size[1] - 3, board.size[0] - CELL_D, board.size[1] - 1))
cliff_d = int(round(DEPTH_PX or 0)) cliff_d = int(round(DEPTH_PX or 0))