Skip to content

像素立绘尺寸与描边规范 ​

在《深空当铺:可能是偷的》中,所有顾客立绘均通过 StoreClientMono.Instance.image(SpriteRenderer)渲染在店铺窗口后方。本节说明标准 288×211 顾客画布的几何参数、头部留白基准线以及深色外轮廓线标准。

顾客立绘画布比例参考


1. 标准顾客立绘几何参数 ​

原版顾客贴图统一采用 288 × 211 画布(100 PPU,中心锚点 (0.5, 0.5),FilterMode.Point):

维度指标trailer_scav1 (比利)serpico_scav (拾荒客)serpico_rev (革命军)自定义立绘标准 (v_normal)
画布总分辨率288 × 211288 × 211288 × 211288 × 211 (RGBA PNG)
水平有效范围 (x)83 .. 205 (宽 123px)65 .. 222 (宽 158px)65 .. 221 (width 157px)55 .. 232 (宽 150 ~ 178px)
垂直有效范围 (y)57 .. 210 (高 154px)47 .. 210 (高 164px)51 .. 210 (高 160px)55 .. 210 (高 154 ~ 162px)
顶部透明留白57 px47 px51 px50 ~ 56 px
外轮廓 1px 描边色深炭紫暗边深炭紫暗边深炭紫暗边RGB(36, 33, 43)

2. 画布对齐与标准描边处理脚本 ​

以下 Python(Pillow + NumPy)脚本可将半身像原图自动缩放至 target_h = 156(底部对齐 y = 210,顶部留白 55px),并将外轮廓 1px 统一设为原版深炭紫描边色 RGB(36, 33, 43):

python
from PIL import Image
import numpy as np

def normalize_portrait_to_vanilla_canvas(src_rgba_path, out_normal_path, target_h=156):
    raw = Image.open(src_rgba_path).convert("RGBA")
    arr = np.array(raw, dtype=np.int32)
    fg = arr[:, :, 3] > 128

    ys, xs = np.where(fg)
    crop = Image.fromarray(arr[ys.min():ys.max()+1, xs.min():xs.max()+1].astype(np.uint8), "RGBA")
    scale = target_h / crop.height
    target_w = int(round(crop.width * scale))
    resized = crop.resize((target_w, target_h), Image.NEAREST)

    canvas = Image.new("RGBA", (288, 211), (0, 0, 0, 0))
    ox = (288 - target_w) // 2
    oy = 211 - target_h
    canvas.paste(resized, (ox, oy), resized)

    c_arr = np.array(canvas, dtype=np.int32)
    c_fg = c_arr[:, :, 3] > 128
    c_arr[~c_fg] = [0, 0, 0, 0]
    c_arr[c_fg, 3] = 255

    pad = np.pad(c_fg, 1, mode="constant", constant_values=False)
    is_outer_contour = c_fg & (~(pad[:-2, 1:-1] & pad[2:, 1:-1] & pad[1:-1, :-2] & pad[1:-1, 2:]))
    is_outer_contour[210, :] = False

    c_arr[is_outer_contour, 0] = 36
    c_arr[is_outer_contour, 1] = 33
    c_arr[is_outer_contour, 2] = 43
    c_arr[is_outer_contour, 3] = 255

    Image.fromarray(c_arr.astype(np.uint8), "RGBA").save(out_normal_path)

Custom NPC Framework Documentation