หลายคนอยากทำภาพ 3D สวยแบบหนัง แต่ติดตรงที่ต้องปั้นโมเดลเป็น ต้องจัดไฟเป็น และต้องเรียนโปรแกรม 3D ที่ปุ่มเยอะมาก
บทความนี้แจกโค้ดหนังสั้น 3D ทั้งเรื่องที่ Claude Code เขียนให้ Blender สร้างขึ้นมา ไม่มีการปั้นโมเดลหรือโหลดรูปจากที่อื่นเลยสักชิ้น โค้ดเปิดให้ใช้ฟรีแบบ MIT เราลองรันจริงบนเครื่องของเราแล้ว ทำช็อตน็อตของอู่สกิลขึ้นมาเองด้วยวิธีเดียวกัน และแนบคำสั่งภาษาไทยไว้ให้ก๊อปไปใช้
หนังเรื่องนี้คืออะไร
หนังสั้นยาว 36 วินาที ผู้สร้างคือ Leon Lin ทำบนโน้ตบุ๊กที่ไม่มีการ์ดจอแยก เขาสั่ง Claude Code คำสั่งเดียว แล้วให้ความเห็นอีกไม่กี่รอบ Claude เขียนโค้ด Python ให้ Blender สร้างทุกอย่างขึ้นมา ทั้งเฟือง รถ ไฟ กล้อง ไปจนถึงตัดต่อและมิกซ์เสียง

เคล็ดลับอยู่ที่วิธีทำงาน
ส่วนที่น่าเอาไปใช้ที่สุดคือวิธีที่เขาแบ่งงานให้ AI:
มีคัมภีร์ของหนัง
ไฟล์ BRIEF.md บอกเรื่องทั้งหมด แต่ละองก์ต้องมีอะไร ภาพต้องโทนไหน ต้องส่งต่อกันยังไง และกฎที่ห้ามพลาด
หนึ่งเอเจนต์ต่อหนึ่งองก์
แบ่งหนังเป็น 5 องก์ ให้เอเจนต์ 5 ตัวทำพร้อมกัน แต่ละตัวมีสคริปต์ของตัวเอง
มีเอเจนต์ผู้กำกับ
เอเจนต์อีกตัวดูภาพของทุกองก์แล้วติ จากนั้นให้แก้อีกรอบ บันทึกการแก้แต่ละรอบอยู่ในโฟลเดอร์ notes
วัดด้วยตัวเลข ไม่ใช้แค่ตาดู
สคริปต์ exposure_check.py ให้คะแนนทุกภาพนิ่ง ว่าสว่างจ้าเกินไหม มืดหม่นไหม สีจืดไหม
ต้องมีอะไรบ้าง
- Blender 5.2 โปรแกรม 3D ฟรี ดาวน์โหลดจาก blender.org (เราใช้ 5.2.4)
- ffmpeg ไว้รวมเฟรมเป็นวิดีโอ
- git ไว้ดาวน์โหลดโค้ด
- Claude Code ถ้าอยากให้ Claude สร้างช็อตใหม่ให้
- โค้ดเขียนมาสำหรับ Windows (ใช้คำสั่ง tasklist ของ Windows) บนเครื่องอื่นอาจต้องแก้เล็กน้อย
ขั้นตอนลองรัน
- ดาวน์โหลดโค้ด: เปิด Terminal แล้วพิมพ์
git clone https://github.com/Leonxlnx/escapementแล้วcd escapement - บอกที่อยู่ Blender: ตั้งค่า
BLENDERให้ชี้ไปที่blender.exeของเครื่องคุณ เช่นใน PowerShell พิมพ์$env:BLENDER="C:\Program Files\Blender Foundation\Blender 5.2\blender.exe" - ลองภาพนิ่งภาพแรก:
python tools/rb.py shots/act1_gears.py -- --shot 1A --stills 30 --pct 50ได้ไฟล์tests/1A_f0030.jpg - เรนเดอร์เป็นวิดีโอ:
python tools/rb.py shots/act1_gears.py -- --shot 1E --anim --pct 50ได้ภาพทุกเฟรมในrenders/1E/แล้วรวมเป็นวิดีโอด้วยffmpeg -framerate 24 -i renders/1E/%04d.png -pix_fmt yuv420p 1E.mp4 - ลองช็อตอื่น: ดูชื่อช็อตทั้งหมดใน
shotlist.jsonเช่นshots/act2_car.py -- --shot 2Bคือรถประกอบตัวเอง
ที่เราลองรันเอง
บนการ์ดจอ RTX 5070 Ti ที่ครึ่งความละเอียด (960x540) เรนเดอร์ได้ราวหนึ่งวินาทีต่อเฟรม ช็อตบินผ่านเฟือง (1E) มี 68 เฟรม รถประกอบตัวเอง (2B) มี 84 เฟรม แต่ละช็อตเสร็จในไม่กี่นาที

ให้ Claude สร้างช็อตใหม่ด้วยวิธีเดียวกัน
เราลองสั่งช็อตของเราเอง: น็อตหกเหลี่ยมสีเหลืองของอู่สกิลหมุนลงเกลียวในโลกเฟือง โดยใช้ฟังก์ชันใน lib/common.py ของหนัง แล้ววนแบบเดียวกับที่เขาทำ คือเรนเดอร์ภาพนิ่ง เปิดดู วัดแสงด้วย exposure_check.py แล้วแก้

- รอบ 1: กล้องใกล้เกินไปจนน็อตล้นจอ ผิวดูเหมือนไม้อัด และเฟรมท้ายมืด
- รอบ 2: ถอยกล้องและลบมุมน็อต แต่ตั้งกรวยที่ใช้ลบมุมผิด น็อตเลยกลายเป็นกรวยสองหัว
- รอบ 3: แก้มุมให้ลบแค่ขอบ ได้น็อตหกเหลี่ยมจริง แต่ฝุ่นในอากาศสว่างเกินจนดูเหมือนดาว
- รอบ 4: ลดฝุ่น ทำผิวให้เนียนขึ้น แต่หน้าน็อตยังมืด ตัววัดแสงขึ้นว่าคอนทราสต์ต่ำ
- รอบ 5: เพิ่มแสงที่กวาดผ่านหน้าน็อต (โลหะเงาจะสว่างเฉพาะตรงที่สะท้อนแสง) ตัววัดแสงผ่าน 4 จาก 5 เฟรมที่ลองวัด เฟรมสุดท้ายยังมืดไปนิด
สคริปต์ช็อตนี้อยู่ท้ายบทความ (หัวข้อ "สคริปต์น็อตอู่สกิล") บันทึกเป็น shots/oo_nut.py ในโฟลเดอร์หนัง แล้วรันด้วย python tools/rb.py shots/oo_nut.py -- --round 5 --anim --pct 50
เปิดโฟลเดอร์หนัง escapement นี้ อ่าน README.md, BRIEF.md และ lib/common.py ก่อน แล้วสร้างช็อตใหม่ 1 ช็อต ตอบเป็นภาษาไทย
ช็อตที่อยากได้: ... (เช่น โลโก้ร้านทำจากทองเหลืองหมุนอยู่กลางเฟือง / แก้วกาแฟมีไอร้อนบนโต๊ะไม้ตอนเช้า)
ความยาว: ... วินาที (24 เฟรมต่อวินาที)
อารมณ์และสี: ... (เช่น มืด ไฟอุ่นตัดฟ้าเย็น แบบหนังโฆษณา)
กล้อง: ... (เช่น ซูมเข้าช้าๆ / บินผ่าน / หมุนรอบ)
ข้อกำหนด:
- สร้างทุกอย่างด้วยโค้ด Python ใน shots/<ชื่อ>.py ใช้ฟังก์ชันใน lib/common.py ห้ามโหลดโมเดลหรือรูปจากที่อื่น
- รันผ่าน tools/rb.py เท่านั้น (ทีละตัว)
- ทำเป็นรอบ: เรนเดอร์ภาพนิ่ง 3 เฟรม (--stills 1,ครึ่งช็อต,สุดท้าย --pct 50) เปิดดูเอง รัน tools/exposure_check.py แล้วแก้ อย่างน้อย 3 รอบ
- ทุกรอบบอกว่าเห็นปัญหาอะไรในภาพ และแก้อะไร
- พอภาพผ่าน ให้เรนเดอร์ --anim --pct 50 แล้วรวมเป็น mp4 ด้วย ffmpegคำสั่งที่ใช้ต่อได้
- "ช็อตนี้สว่างไป ให้เหลือแสงเฉพาะขอบโลหะ ที่เหลือมืด"
- "เพิ่มฝุ่นในลำแสง แต่ให้น้อยและเบลอ ไม่ใช่จุดขาวเต็มจอ"
- "ทำช็อตต่อจากนี้ให้ภาพสุดท้ายแมตช์คัตไปเป็นล้อรถ แบบในหนัง"
- "เรนเดอร์ช็อตเดิมเป็นแนวตั้ง 1080x1920 ไว้ลง Reels"
ข้อควรรู้
- หนังและโค้ดเป็นของ Leon Lin ใช้สัญญาอนุญาต MIT (ใช้ฟรี รวมถึงเชิงพาณิชย์ แต่ต้องเก็บไฟล์ LICENSE ไว้) อู่สกิลไม่ได้เป็นคนทำ เราแค่ลองใช้และเขียนวิธีใช้เป็นภาษาไทย
- MIT ครอบคลุมโค้ด เพลงและเสียงในหนังเป็นของ Mixkit และ Freesound ตามสัญญาของแต่ละไฟล์ใน
audio/manifest.json - README บอกว่าช็อตวัด (act 4) ส่วนที่ทำใหม่หนักเกินกว่าโน้ตบุ๊กของเขาจะเรนเดอร์ได้ และช็อตเร็วบางช็อตเรนเดอร์ที่ 83% แล้วขยาย
- เวลาและค่าแสงจูนมาสำหรับเครื่องของผู้สร้าง เครื่องคุณอาจต้องปรับ samples และค่าหมอก
สคริปต์น็อตอู่สกิล
สคริปต์ที่ใช้ทำน็อตด้านบน (--round 1 ถึง 5 เปิดดูผลแต่ละรอบได้) ใช้ฟังก์ชันจาก lib/common.py ของหนัง แจกฟรีเหมือนกัน
"""OOSKILL demo shot (made with the escapement method: brief -> build -> still -> look -> fix).
One line: macro, out of darkness a chunky yellow hex nut spins down a steel bolt, a warm key light
sweeps across its chamfered edges, a soft gear train turns behind in cool cyan haze, dust motes.
python tools/rb.py shots/oo_nut.py -- --shot OO --stills 1,36,72 --pct 50
python tools/rb.py shots/oo_nut.py -- --shot OO --anim --pct 50
"""
import sys, os, math
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "lib"))
from common import *
N = 72 # 3 s at 24 fps
NUT_R = 1.0 # across corners / 2
BOLT_R = 0.42
PITCH = 0.16 # metres the nut drops per turn
ROUND = int(arg('--round', 3, int))
def key(o, path, pairs, index=-1):
for f, v in pairs:
if index < 0:
setattr(o, path, v)
o.keyframe_insert(path, frame=f)
else:
getattr(o, path)[index] = v
o.keyframe_insert(path, index=index, frame=f)
def nut(coll, mat):
o = prim('cylinder', 'Nut', loc=(0, 0, 0), coll=coll, segments=6, r=NUT_R, depth=0.8)
# the classic curved chamfer: intersect with a double cone
if ROUND >= 2:
if ROUND >= 3: # round 2's cones ate the whole nut (a double cone, no flats): a 30 deg chamfer that only trims the corners
cone = prim('cone', 'Chamfer', loc=(0, 0, -0.04), coll=coll, segments=128, r1=3.32, r2=0.0, depth=1.92)
cone2 = prim('cone', 'Chamfer2', loc=(0, 0, 0.04), rot=(math.pi, 0, 0), coll=coll, segments=128, r1=3.32, r2=0.0, depth=1.92)
else:
cone = prim('cone', 'Chamfer', loc=(0, 0, 0), coll=coll, segments=96, r1=NUT_R * 1.55, r2=0.0, depth=NUT_R * 1.9)
cone2 = prim('cone', 'Chamfer2', loc=(0, 0, 0), rot=(math.pi, 0, 0), coll=coll, segments=96, r1=NUT_R * 1.55, r2=0.0, depth=NUT_R * 1.9)
for c in (cone, cone2):
m = o.modifiers.new('ch', 'BOOLEAN'); m.operation = 'INTERSECT'; m.object = c; m.solver = 'EXACT'
c.hide_render = True; c.hide_viewport = True
hole = prim('cylinder', 'Hole', loc=(0, 0, 0), coll=coll, segments=64, r=BOLT_R * 1.04, depth=2.0)
m = o.modifiers.new('hole', 'BOOLEAN'); m.operation = 'DIFFERENCE'; m.object = hole; m.solver = 'EXACT'
hole.hide_render = True; hole.hide_viewport = True
apply_mods(o)
bevel(o, width=0.035 if ROUND >= 2 else 0.01, segments=3, angle=30)
shade(o, 35)
set_mat(o, mat)
return o
def bolt(coll, mat):
# a real helical thread: a triangle profile swept by the Screw modifier
import bmesh
bm = bmesh.new()
h = PITCH * 0.5
a = bm.verts.new((BOLT_R * 0.86, 0, -h)); b = bm.verts.new((BOLT_R, 0, 0)); c = bm.verts.new((BOLT_R * 0.86, 0, h))
bm.edges.new((a, b)); bm.edges.new((b, c))
o = from_bmesh('Thread', bm, coll, smooth=True)
turns = 26
s = o.modifiers.new('screw', 'SCREW')
s.axis = 'Z'; s.screw_offset = PITCH; s.iterations = turns; s.steps = 48; s.render_steps = 48
s.use_merge_vertices = True
o.location = (0, 0, -turns * PITCH + 0.9)
set_mat(o, mat)
core = prim('cylinder', 'Core', loc=(0, 0, -turns * PITCH / 2 + 0.9), coll=coll, segments=64, r=BOLT_R * 0.87, depth=turns * PITCH)
set_mat(core, mat)
return o
def shot_OO():
reset()
sc = setup_render(1, N, samples=48, shutter=0.6)
compositor(bloom=0.08, dispersion=0.004)
w = world_color((0.004, 0.006, 0.009), 1.0)
C = collection('OO')
# OOSKILL yellow (#fbcf2a) as worn, polished metal: pale gold to deep amber
if ROUND >= 4: # round 3's faces were blotchy like plywood: finer, lighter wear and a more polished finish
nut_mat = mat_brass('NutBrass', base=(0.98, 0.72, 0.10), dark=(0.70, 0.42, 0.04), rough=(0.10, 0.28), worn=0.15, scale=5.0)
else:
nut_mat = mat_brass('NutBrass', base=(0.98, 0.70, 0.08), dark=(0.55, 0.30, 0.02), rough=(0.14, 0.42), worn=0.35, scale=1.4)
steel = mat_metal('BoltSteel', base=(0.30, 0.31, 0.33), rough=(0.22, 0.45), scale=2.0)
gear_mat = mat_brass('GearBrass', base=(0.60, 0.40, 0.18), dark=(0.22, 0.13, 0.05), rough=(0.25, 0.55))
n = nut(C, nut_mat)
bolt(C, steel)
# the nut spins down the thread: 1.5 turns over the shot, eased in from a stop
pv = empty('NutPivot', (0, 0, 0), C)
parent(n, pv)
turns = 1.5
pv.rotation_mode = 'XYZ'
key(pv, 'rotation_euler', [(1, 0.0), (N, -turns * 2 * math.pi)], index=2)
key(pv, 'location', [(1, PITCH * turns * 0.5 + 0.25), (N, -PITCH * turns * 0.5 + 0.25)], index=2)
# gear train behind, turning slowly, well out of focus
if ROUND >= 1:
gears = [(-3.6, 6.5, 1.2, 2.2, 40), (1.9, 7.5, -0.6, 2.8, 52), (4.8, 9.0, 2.4, 1.6, 30), (-1.0, 10.5, 3.0, 2.0, 36),
(6.5, 6.0, -2.4, 1.4, 26)]
for i, (x, y, z, r, t) in enumerate(gears):
g = make_gear(f'G{i}', teeth=t, r=r, thick=0.22, spokes=5 + (i % 2), mat=gear_mat)
g.location = (x, y, z); g.rotation_euler = (math.pi / 2, 0, 0)
g.rotation_mode = 'XYZ'
key(g, 'rotation_euler', [(1, 0.0), (N, (0.35 if i % 2 else -0.35) * (2.2 / r))], index=2)
# light: a warm key sweeps across the faces, a cool rim from behind, a cyan haze behind the nut
k = light('AREA', 'Key', (-3.0, -2.5, 1.6), energy=0, color=(1.0, 0.66, 0.34), size=1.0, size_y=3.0, coll=C, target=(0, 0, 0.2))
k.data.keyframe_insert('energy', frame=1)
for f, e in ((1, 0.0), (14, 260.0 if ROUND < 3 else 340.0), (N, 260.0 if ROUND < 3 else 340.0)):
k.data.energy = e; k.data.keyframe_insert('energy', frame=f)
key(k, 'location', [(1, Vector((-3.4, -2.2, 1.6))), (N, Vector((2.6, -2.6, 1.8)) if ROUND < 2 else Vector((1.2, -3.6, 2.2)))])
rim = light('AREA', 'Rim', (1.5, 2.5, 2.2), energy=180 if ROUND < 3 else 160, color=(0.45, 0.75, 1.0), size=2.0, coll=C, target=(0, 0, 0.3))
if ROUND >= 1:
gk = light('SPOT', 'GearKey', (-4.0, 5.0, 4.0), energy=900, color=(1.0, 0.58, 0.27), spot=55, blend=0.6, coll=C, target=(1.0, 8.0, 0.0))
haze = mat_volume('Haze', density=0.05, color=(0.5, 0.75, 1.0), anisotropy=0.5, noise_scale=0.6)
volume_box('HazeBox', (0, 6.0, 0.5), (9.0, 2.2, 5.0), haze, C)
hz = light('SPOT', 'HazeShaft', (6.0, 6.0, 6.0), energy=30000, color=(0.5, 0.78, 1.0), spot=34, blend=0.5, coll=C, target=(-1.0, 6.0, 0.0))
hz.data.diffuse_factor = 0.0; hz.data.specular_factor = 0.0
if ROUND >= 3:
# a mirror card so the flat faces show their finish (escapement's sheen card trick), at low power
sh = light('AREA', 'Sheen', (0.0, -4.0, 2.4), energy=90.0, color=(1.0, 0.85, 0.6), size=3.0, coll=C, target=(0, 0, 0))
if ROUND >= 5:
# round 4's faces stayed dark: polished metal only shows what it mirrors, so a tall warm card behind
# the camera travels left to right and its reflection sweeps across the nut's faces (the light sweep)
sw = light('AREA', 'Sweep', (-5.0, -15.0, 2.0), energy=0.0, color=(1.0, 0.74, 0.42), size=1.6, size_y=5.0, coll=C, target=(0, 0, 0.3))
for f, e in ((1, 0.0), (8, 0.0), (20, 2600.0), (60, 2600.0), (72, 900.0)):
sw.data.energy = e; sw.data.keyframe_insert('energy', frame=f)
key(sw, 'location', [(1, Vector((-6.0, -15.0, 2.2))), (N, Vector((6.0, -15.0, 2.2)))])
sw.constraints.clear(); track_to(sw, empty('SweepTarget', (0, 0, 0.3), C))
# a few dust motes in the key light, tiny and mostly out of focus
import random
rnd = random.Random(7)
# round 4: round 3's 26 bright motes read as a starfield (escapement's own act-1 log hit the same thing)
mote = mat_emission('Mote', (1.0, 0.8, 0.55), 1.5 if ROUND < 4 else 0.5)
for i in range(26 if ROUND < 4 else 10):
p = prim('ico', f'm{i}', loc=(rnd.uniform(-2.5, 2.5), rnd.uniform(-2.2, 1.5), rnd.uniform(-1.2, 1.8)), coll=C, r=rnd.uniform(0.006, 0.014), sub=1)
set_mat(p, mote)
key(p, 'location', [(1, Vector(p.location)), (N, Vector(p.location) + Vector((rnd.uniform(-.15, .15), rnd.uniform(-.1, .1), rnd.uniform(.05, .25))))])
# camera: 100 mm, slow push and a little orbit, focus held on the nut
cam = camera('Cam', (0.9, -6.4, 0.75), target=(0, 0, 0.25), lens=100, fstop=1.8 if ROUND >= 2 else 4.0, focus=pv)
if ROUND >= 3: # round 3: a touch closer so the chamfered nut is the clear hero
key(cam, 'location', [(1, Vector((1.9, -10.6, 2.1))), (N, Vector((-0.5, -9.2, 1.3)))])
elif ROUND >= 2: # round 1 framed the nut far too tight: pull back so the nut, thread and gears all read
key(cam, 'location', [(1, Vector((2.4, -12.5, 2.4))), (N, Vector((-0.6, -10.8, 1.5)))])
else:
key(cam, 'location', [(1, Vector((1.2, -6.8, 0.85))), (N, Vector((-0.2, -5.6, 0.55)))])
tgt = empty('CamTarget', (0, 0, 0.25), C)
track_to(cam, tgt)
shake(cam, amp=0.004, rot_amp=0.0015, seed=3)
sc.camera = cam
SHOTS = {'OO': shot_OO}
if __name__ == '__main__':
SHOTS[arg('--shot', 'OO')]()
finish(f"OO_r{ROUND}")
แหล่งข้อมูล
- escapement บน GitHub (README, BRIEF.md, LICENSE, notes/ เวอร์ชันที่เราใช้: commit 02cf7a4, 8 พ.ย. 2569)
- ดาวน์โหลด Blender



