ThreeKingdomsSlingshot/Tools/make_skill_custom_textures.py

193 lines
8.9 KiB
Python

# -*- coding: utf-8 -*-
"""스킬 자체 제작 이펙트용 그림(2026-11-11 · 팩에 맞는 것이 없어 직접 그린 것) → Assets/VFX/TKS2D/
sk_arrow_down.png = 아래로 떨어지는 화살(촉 = 아래 · 손권 화살비) — 게임 그림처럼 굵은 먹선 + 단색 면
sk_arrow.png = 날아가는 화살(촉 = 오른쪽 · 화면에 작게 그려도 먹선이 보이게 굵고 짧은 비례)
sk_arrow_stuck.png = 몸에 박힌 화살(촉은 몸속 = 안 그림 · 오른쪽 끝 = 박힌 자리의 검은 구멍 · 깃 쪽이 굵음 = 보는 쪽으로 튀어나온 원근)
sk_dagger.png = 날아가는 비도(날 끝 = 오른쪽 · 날 위아래 2단 = 능선)
sk_dagger_stuck.png = 몸에 박힌 비도(날 절반은 몸속 · 손잡이 쪽이 굵음)
sk_hit_pop.png = 박히는 순간의 타격 별
sk_streak.png = 속도 줄기(흰 · 먹선 없음)
sk_chip.png = 튀는 나무 조각
실행: python -I -X utf8 Tools/make_skill_custom_textures.py → 그 뒤 unity … script eval --file Tools/build_skill_custom_fx.cs
"""
import math
import os
from PIL import Image, ImageDraw, ImageFilter
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
OUT = os.path.join(ROOT, 'Assets', 'VFX', 'TKS2D')
S = 4 # 크게 그려 줄임(가장자리 매끈)
INK = (30, 22, 16, 255)
WOOD = (150, 98, 52, 255)
WOOD_LIGHT = (192, 138, 80, 255)
WOOD_DARK = (104, 64, 34, 255)
STEEL_SHADE = (112, 124, 138, 255)
FEATHER = (245, 238, 220, 255)
RED = (214, 72, 52, 255)
STEEL = (206, 212, 216, 255)
STEEL_LIGHT = (242, 245, 246, 255)
STEEL_DARK = (150, 162, 174, 255)
GOLD = (226, 176, 60, 255)
GRIP = (140, 44, 40, 255)
GRIP_DARK = (96, 28, 28, 255)
def P(pts):
return [(x * S, y * S) for x, y in pts]
def canvas(w, h):
col = Image.new('RGBA', (w * S, h * S), (0, 0, 0, 0))
return col, ImageDraw.Draw(col)
def finish(col, w, h, name, outline=4, post=None):
"""먹선 = 불투명 부분을 outline 픽셀(완성 크기 기준) 넓혀 뒤에 깔기 · post = 먹선을 깐 뒤 그 위에 덧그릴 것(먹선이 붙지 않는 구멍 · 금)."""
if outline > 0:
a = col.split()[3]
grow = a.filter(ImageFilter.MaxFilter(2 * outline * S + 1))
out = Image.new('RGBA', col.size, (0, 0, 0, 0))
out.paste(Image.new('RGBA', col.size, INK), (0, 0), grow)
out.alpha_composite(col)
else:
out = col
if post:
post(ImageDraw.Draw(out))
out.resize((w, h), Image.LANCZOS).save(os.path.join(OUT, name))
def arrow_down(w=64, h=224):
W, H = w * S, h * S
col = Image.new('RGBA', (W, H), (0, 0, 0, 0))
d = ImageDraw.Draw(col)
cx = W // 2
# 깃(위) — 흰 깃 + 붉은 띠
d.polygon([(cx, 6 * S), (cx - 16 * S, 34 * S), (cx - 16 * S, 70 * S), (cx, 52 * S), (cx + 16 * S, 70 * S), (cx + 16 * S, 34 * S)], fill=FEATHER)
d.polygon([(cx - 16 * S, 46 * S), (cx - 16 * S, 58 * S), (cx, 42 * S), (cx + 16 * S, 58 * S), (cx + 16 * S, 46 * S), (cx, 30 * S)], fill=RED)
# 대
d.rectangle([cx - 4 * S, 40 * S, cx + 4 * S, 176 * S], fill=WOOD)
# 촉(아래)
d.polygon([(cx, 218 * S), (cx - 15 * S, 170 * S), (cx, 180 * S), (cx + 15 * S, 170 * S)], fill=(222, 224, 214, 255))
a = col.split()[3]
grow = a.filter(ImageFilter.MaxFilter(4 * S + 1))
out = Image.new('RGBA', (W, H), (0, 0, 0, 0))
out.paste(Image.new('RGBA', (W, H), INK), (0, 0), grow)
out.alpha_composite(col)
out = out.resize((w, h), Image.LANCZOS)
out.save(os.path.join(OUT, 'sk_arrow_down.png'))
def feather(d, cy, nock, front, back, notch, hw):
"""깃 = 오늬 끝(nock)에서 벌어져 촉 쪽으로 V 자로 파인 모양 + 붉은 띠."""
d.polygon(P([(nock, cy), (front, cy - hw), (back, cy - hw), (notch, cy), (back, cy + hw), (front, cy + hw)]), fill=FEATHER)
b0 = front + (back - front) * 0.38
b1 = front + (back - front) * 0.72
off = (back - notch) * 0.9
d.polygon(P([(b0, cy - hw), (b1, cy - hw), (b1 - off, cy), (b1, cy + hw), (b0, cy + hw), (b0 - off, cy)]), fill=RED)
def arrow(w=192, h=64):
"""날아가는 화살(촉 = 오른쪽) — 길이 192 가 화면 60~75 픽셀로 줄어도 먹선 1.5 픽셀이 남는 굵기."""
col, d = canvas(w, h)
cy = h / 2
feather(d, cy, 6, 24, 56, 42, 17)
d.polygon(P([(30, cy - 4.5), (160, cy - 4.5), (160, cy + 4.5), (30, cy + 4.5)]), fill=WOOD)
d.polygon(P([(30, cy - 4.5), (160, cy - 4.5), (160, cy - 1.5), (30, cy - 1.5)]), fill=WOOD_LIGHT)
d.polygon(P([(186, cy), (150, cy - 14), (158, cy), (150, cy + 14)]), fill=STEEL)
d.polygon(P([(186, cy), (150, cy - 14), (158, cy)]), fill=STEEL_LIGHT)
finish(col, w, h, 'sk_arrow.png')
def hole(d, x, cy, rx, ry):
"""박힌 자리 = 대와 직각인 납작한 검은 구멍 + 가는 금 4줄(몸을 뚫고 들어간 자리 · 먹선을 깐 뒤에 그려 덩어리가 되지 않게)."""
d.ellipse([(x - rx) * S, (cy - ry) * S, (x + rx) * S, (cy + ry) * S], fill=INK)
for ang, ln in ((-68, 6), (-24, 8), (22, 7), (66, 6)):
r = math.radians(ang)
x0, y0 = x + math.cos(r) * rx * 0.7, cy + math.sin(r) * ry * 0.85
x1, y1 = x + math.cos(r) * (rx + ln), cy + math.sin(r) * (ry * 0.85 + ln)
d.line(P([(x0, y0), (x1, y1)]), fill=INK, width=int(2.2 * S))
def arrow_stuck(w=128, h=64):
"""몸에 박힌 화살(오른쪽 끝 = 박힌 자리 · 중심점 = 그 구멍). 대가 깃 쪽으로 갈수록 굵음 = 보는 쪽으로 튀어나온 원근."""
col, d = canvas(w, h)
cy = h / 2
ex = 112 # 박힌 자리
feather(d, cy, 6, 24, 56, 41, 18)
d.polygon(P([(30, cy - 5.2), (ex, cy - 3.2), (ex, cy + 3.2), (30, cy + 5.2)]), fill=WOOD)
d.polygon(P([(30, cy - 5.2), (ex, cy - 3.2), (ex, cy - 1.0), (30, cy - 1.8)]), fill=WOOD_LIGHT)
d.polygon(P([(ex - 17, cy - 3.6), (ex, cy - 3.2), (ex, cy + 3.2), (ex - 17, cy + 3.6)]), fill=WOOD_DARK) # 박힌 자리 가까이는 몸 그늘(어두운 면)
finish(col, w, h, 'sk_arrow_stuck.png', post=lambda dd: hole(dd, ex, cy, 6.5, 11))
return ex / w
def dagger(w=144, h=56):
"""날아가는 비도(날 끝 = 오른쪽) — 날 위 = 밝은 면 · 아래 = 어두운 면(능선) · 금빛 코등이 · 붉은 손잡이."""
col, d = canvas(w, h)
cy = h / 2
d.polygon(P([(58, cy - 9), (116, cy - 8), (138, cy), (116, cy + 8), (58, cy + 9)]), fill=STEEL_DARK)
d.polygon(P([(58, cy - 9), (116, cy - 8), (138, cy), (58, cy)]), fill=STEEL_LIGHT)
d.rectangle([18 * S, (cy - 6) * S, 52 * S, (cy + 6) * S], fill=GRIP)
for x in (26, 36, 46):
d.rectangle([(x - 1.5) * S, (cy - 6) * S, (x + 1.5) * S, (cy + 6) * S], fill=GRIP_DARK)
d.rectangle([50 * S, (cy - 15) * S, 59 * S, (cy + 15) * S], fill=GOLD)
d.ellipse([6 * S, (cy - 7.5) * S, 21 * S, (cy + 7.5) * S], fill=GOLD)
finish(col, w, h, 'sk_dagger.png')
def dagger_stuck(w=104, h=56):
"""몸에 박힌 비도(날 절반은 몸속 · 오른쪽 끝 = 박힌 자리 · 손잡이 쪽이 굵음)."""
col, d = canvas(w, h)
cy = h / 2
ex = 88
d.polygon(P([(58, cy - 9.5), (ex, cy - 7.5), (ex, cy + 7.5), (58, cy + 9.5)]), fill=STEEL_DARK)
d.polygon(P([(58, cy - 9.5), (ex, cy - 7.5), (ex, cy), (58, cy)]), fill=STEEL_LIGHT)
d.polygon(P([(ex - 11, cy - 8.3), (ex, cy - 7.5), (ex, cy + 7.5), (ex - 11, cy + 8.3)]), fill=STEEL_SHADE) # 박힌 자리 가까이는 몸 그늘
d.rectangle([18 * S, (cy - 7) * S, 52 * S, (cy + 7) * S], fill=GRIP)
for x in (26, 36, 46):
d.rectangle([(x - 1.6) * S, (cy - 7) * S, (x + 1.6) * S, (cy + 7) * S], fill=GRIP_DARK)
d.rectangle([50 * S, (cy - 16) * S, 59 * S, (cy + 16) * S], fill=GOLD)
d.ellipse([5 * S, (cy - 8.5) * S, 22 * S, (cy + 8.5) * S], fill=GOLD)
finish(col, w, h, 'sk_dagger_stuck.png', post=lambda dd: hole(dd, ex, cy, 6.5, 14))
return ex / w
def star(d, cx, cy, r_out, r_in, n, fill, rot=0.0, alt=0.72):
pts = []
for i in range(n * 2):
a = rot + math.pi * i / n
r = r_in if i % 2 else (r_out if (i // 2) % 2 == 0 else r_out * alt)
pts.append((cx + math.cos(a) * r, cy + math.sin(a) * r))
d.polygon(P(pts), fill=fill)
def hit_pop(w=96, h=96):
"""박히는 순간의 타격 별(뾰족한 가시 8개 · 긴 것과 짧은 것 번갈아 · 주황 테 + 크림색 속)."""
col, d = canvas(w, h)
star(d, w / 2, h / 2, 42, 15, 8, (255, 190, 60, 255), rot=math.radians(11))
star(d, w / 2, h / 2, 27, 10, 8, (255, 248, 224, 255), rot=math.radians(11))
finish(col, w, h, 'sk_hit_pop.png')
def streak(w=96, h=12):
col, d = canvas(w, h)
d.polygon(P([(0, h / 2), (62, 1.5), (w, h / 2), (62, h - 1.5)]), fill=(255, 255, 255, 255))
finish(col, w, h, 'sk_streak.png', outline=0)
def chip(w=28, h=16):
col, d = canvas(w, h)
d.polygon(P([(5, 9), (13, 5), (23, 7), (15, 11)]), fill=WOOD_LIGHT)
finish(col, w, h, 'sk_chip.png', outline=2)
arrow_down()
arrow()
print('arrow_stuck pivot x', arrow_stuck())
dagger()
print('dagger_stuck pivot x', dagger_stuck())
hit_pop()
streak()
chip()
print('ok', OUT)