atelier — Bildstudio gesteuert durch kurze Python-Skripte
Installation (Python ≥ 3.11): pip install git+https://github.com/Wexop/atelier (Update: pip install -U git+...)
Prüfen: atelier palette · atelier brushes · atelier fx (Signaturen).
Schleife (immer)
- Wähle den Style-Guide (siehe Styles unten) und lies ihn; keiner passt →
styles/new-style.md. - Schreibe
scene.py(30–80 Zeilen,from atelier import *, baue eine Canvasc, ende mitc.save(__file__[:-3] + ".png")). atelier render scene.py --preview→scene_prev.jpg(512 px, echtes Rendering mit niedriger Auflösung, Speicherung übersprungen). Lies das Bild.atelier inspect scene.py→scene_sheet.jpg: Ansicht, 5-Wert-Studie + Drittel/Brennpunkt, Clip-Map, Histogramm, Palette, 4 automatische Zooms (Aliasing, Banding, Rauschen, Lichter) beschriftet mit--crop x,y,w,h, Metriken + rote Flaggen. Lies es. Zoom:atelier render scene.py --crop x,y,w,h.- ≥3 Anschau- und Korrekturrunden (
atelier compare old.png new.pngfür A/B), dannatelier render scene.py(final;--scale 2,--seed N→SEED). Fehler geben eine Zeile ausscene.py:LINE: Type: message(--debugfür Traceback).
Konventionen
- Zeichenkoordinaten = Canvas-Pixel (y nach unten). Felder verwenden normalisierte x, y ∈ [0,1]. Farben: "#hex", CSS-Namen, (r,g,b) 0–1 oder 0–255.
- Paint-Quelle (fill=, color=, stroke=) = Farbe | Field | f(x,y) | Array H×W×3/4. Masken = Field | Shape | Array | f(x,y).
- Alles Zufällige akzeptiert
seed=. Vorschauen rendern in niedriger Auflösung: das Bild ist identisch, nur schärfer im Final.
Canvas & Ebenen (Kern)
c = Canvas(w, h, bg=None, pixel=False) # pixel=True: kein AA, fester Maßstab, Nearest-Neighbour-Export
L = c.layer(blend="normal", opacity=1, mask=None) # neue Ebene, wird AKTUELL; c.use(L) zum Zurückwechseln
blends: normal multiply screen overlay soft_light hard_light add subtract color_dodge color_burn darken lighten difference hue saturation color luminosity
c.fill(src, mask=None) · c.erase(mask) · c.place(img|path, x=None, y=None, scale=None(cover), rot=0, fit="cover"|"contain", blend, opacity) -> layer
c.apply(*fx, mask=None) # FÜHRT alle Ebenen zusammen, dann Effekte (finale Grading); L.apply(*fx, mask=None) = eine Ebene
c.save(path, quality=92, scale=1, smooth=None) · c.preview(path, width=512) · c.crop_preview(path, x, y, w, h)
c.flatten() -> H×W×4 float · L.rgba (get/set) · c.w c.h (logical) c.W c.H c.s (Raster-Maßstab)
Felder (field) — lazy, zusammensetzbar: + - * / ** > <, np.sin(f), f.ramp() f.warp() f.scale() f.rotate() f.move() f.remap(lo,hi) f.clip() f.within(shape|(x0,y0,x1,y1))
X Y radial(cx,cy) angle(cx,cy) · Field(lambda x, y: ...)
perlin/simplex/value(scale=4, seed) · fbm(scale=4, octaves=5, lacunarity=2, gain=.5, seed, base="perlin")
ridged(scale=3, ...) · turbulence(scale=4, ...) · worley(scale=6, mode="F1"|"F2"|"F2-F1"|"id", seed)
domain_warp(f, strength=.1, scale=2, seed) · aastep(f, edge=.5) · smoothstep(e0, e1, v) · mix(a, b, t)
patterns [0,1]: wood(rings=14, angle) marble() clouds(scale, cover=.5, sharp) terrain_height() water_ripples() fabric(scale=60) paper() stars(density=60, size)
gradient(stops, angle=90 (top→bottom; 0 = left→right), kind="linear"|"radial"|"conic", center, radius)
ramp(f, stops) / f.ramp("sunset") · stops = palette name | ["#..", ...] | [(pos, col), ...] (OKLab-Interpolation)
palette("name") names: sunset night ocean forest desert earth fire ice pastel neon vapor viridis wood marble mono retro16 green4
cosine_palette(a, b, c, d, n=8) · rgb2hsv hsv2rgb rgb2oklab oklab2rgb
shade(height, light=(azimuth, elevation), strength=1, color=None, ambient=.25, spec=0) # kein color → grau, flat=0.5 (auf Overlay-Ebene verwenden)
masks: top(f) bottom(f) left(f) right(f) band(y0, y1) zone(x0, y0, x1, y1) disc(cx, cy, r) (alle soft=)
curves: f.ridge_line(y=.6, amp=.15) / curve(lambda x: y) → c.fill_below(curve, src) / fill_above · curve.below()
Vektoren & Text (vector) — Shape = Skia-Pfad, auch eine Field-Maske; Boolesche | & - ^
rect(x, y, w, h, r=0) ellipse(cx, cy, rx, ry) circle(cx, cy, r) polygon(pts) line(x1,y1,x2,y2 | pts) regular(cx,cy,r,n)
star(cx, cy, r, r2, n=5) arc(cx, cy, r, start, sweep) spline(pts, closed) svg("M .. C .. A .. Z") union(*shapes)
shape.move/rotate(deg)/scale/outline(width, dash)/soft(feather)/points(n)/bounds/length
c.draw(shape, fill="black", stroke=None, width=2, cap="round", join="round", dash=(on, off), feather=0, opacity=1)
c.rect/ellipse/circle/polygon/line/spline/path(d)(..., **gleicher Stil)
c.text(txt, x, y, size=32, fill, font="sans"|"mono"|"serif"|family|path.ttf, weight="regular"|"semibold"|"bold"|int,
align="left"|"center"|"right", valign="baseline"|"top"|"middle"|"bottom", spacing=em, line_height=1.2, italic, fit=width_px, kern=True)
text_shape(...) → Shape · text_size(txt, size) → (width, cap_height) · c.text_on_path(txt, shape|points, size, align, lift, fit, fill)
c.text_box(txt, x, y, w, h=None, size=18, align="left"|"justify"|"center", line_height=1.4, fit=True) # **b** *i* [#c33]Farbe[/]
c.title(txt, x, y, size=96, style="shadow"|"extrude"|"outline"|"inline"|"neon", fill, color2)
Pinsel (brush)
c.stroke(points|Shape, brush="round", size=12, color, pressure=[...]|f(t)|float, opacity, jitter, spacing, taper=(a, b), seed, **params)
pinsel: round round_soft airbrush ink(speed) chalk(tooth) bristle(n, var, gaps) oil(impasto, pickup) watercolor(edge, granulation, bleed)
c.paint_like(ref, brush="oil", sizes=(48,24,12), tol=.08, angle=0, seed) # eine Referenz (Canvas/Field/Bild) mit Strichen neu malen
c.scatter(what, n, region=mask, size=(a, b), color=col|list|palette|Field, color_jitter, rot=(a, b), seed)
what: dot soft star grass leaf petal square person | Shape (Einheitsgröße bei 0,0)
c.hatch(region, angle=45, spacing=8, width=1.2, color, tone=Field (0=dark → thick), cross=False, wobble)
km_mix(a, b, t) pigment-ähnliches Mischen (blau+gelb = grün) · L.relief = 1.0 (Öl-Impasto-Beleuchtungsstärke)
Effekte (fx) — c.apply(...) / L.apply(...); Größen in Canvas-Pixel
blur(r) motion_blur(len, angle) sharpen(amt) bloom(threshold=.75, radius=12, strength=.8, tint) glow(r, strength, color)
drop_shadow(dx, dy, r, color, opacity) inner_shadow(...) vignette(amount=.35, softness=.6) grain(amount=.04, size=1, seed)
chromatic_aberration(px) lens_distortion(k) exposure(stops) contrast(amt) levels(black, white, gamma) curves([(in, out), ...], channel)
hue_sat(hue_deg, sat_mult, light) saturation(x) color_balance(shadows=(r,g,b), mids, highlights) gradient_map(stops) invert()
tone_map("agx"|"filmic"|"reinhard", exposure, look="punchy") displace(field, strength) posterize(levels)
pixelate(size, palette=name|list, colors=N, dither=None|"bayer"|"fs", strength=.6) halftone(size, angle, ink, paper, cmyk=False)
god_rays(x, y, rays=14, length=.9, strength=.45, color, threshold=.7, occlude=True) lens_flare(x, y, strength=.6, color, ghosts=6, streak=.5)
depth_of_field(depth, focus, aperture=8) # depth von r = c.render(scene)
match_palette("ref.jpg", amount) transfer_tone(ref, amount) # Farb-/Tonübertragung von einem Referenzbild
Stilisieren (stylize) — 3D → Illustration + malerische Filter (Effekte für c.apply / L.apply)
r = c.render(s, alpha=True); c.cur.apply(toon(r, bands=3, shadow=.45, colors={id: col}), shadow_dots(r, size=5, lo=.3), outlines(r, width=2.5, inner=1))
gravur: L.fill(PAPER, mask=r.alpha); L.apply(render_hatch(r, s, spacing=4.5, layers=3), outlines(r, width=2)) # Schraffuren folgen 3D-Oberflächen
kuwahara(radius=6) oil · xdog(sigma=1, eps=.9, ink, paper) ink lines · pencil() · linocut(lines=7, angle) · edge_smooth(4)
wasserfarben(bleed=2, edge=1, granulation=.4, ink=0..1) · stained_glass(cell=26, lead=3) · mosaic(tile=10) · shading(r) → (H,W) light
3D (sdf) — y nach oben, Einheiten ≈ Meter, Primitive zentriert am Ursprung
sphere(r) box(w, h, d) round_box(w, h, d, r) cylinder(r, h) capsule(a, b, r) torus(R, r) cone(r1, h, r2) plane(y, normal)
ellipsoid(rx, ry, rz) lathe([(radius, y), ...] bottom→top, thickness=None|shell) extrude([(x, y), ...], depth)
ops: a | b, a & b, a - b, a.union(b, k=smooth) .inter .sub · .move(x,y,z) .rotate(x,y,z deg) .scale(k|(kx,ky,kz))
.onion(t) .round(r) .twist(k) .bend(k) .repeat(period, count) .mirror("x") .elongate() .displace(noise3(scale, octaves, seed), amount)
Mat(color | 2D Field (proj="tri"|"xz"|"xy"|"zy", tex_scale) | f(p, n)->(N,3), rough=.5|Field|f(p,n), metal=0, glass=0, ior=1.45,
sss=0, sss_color, emit=None, power=1, bump=.3, bump_scale=60, local=True (Texturen folgen dem Objekt), sheen=.6,
wear=[smudges(.5), scratches(.5, density=40), dust(.3), edge_wear(.5, width=.01, color)])
s = Scene(); id = s.add(sdf, Mat(...)); s.camera(pos, target, fov=40)
s.sun(dir_toward_sun, color, power=3, soft=.04) · s.point(pos, color, power, radius) · s.area(pos, size=(w,h), normal, color, power, pattern="window"|"softbox", visible)
s.studio(key, target, size, power=45, window=True, fill=.2, bg) · s.sky(zenith, horizon, ground, power) · s.fog(color, density)
r = c.render(s, aa=1|2, exposure=0, look=None|"punchy", alpha=False) # schneller Raymarcher (direktes Licht + AO + 1 Reflexion)
r = c.pathtrace(s, spp=16, bounces=4, denoise=True, aperture=0, focus=None|dist|(x,y), seed=SEED) # fotorealistisch: GI, Mehrfachbrechung Glas, adaptives AA
r.depth r.normal r.id r.mask(id) r.focus_at(x, y, c.s) r.linear r.spp r.time · denoise(img, albedo, normal, depth)
Natur (nature, terrain)
h = terrain(384, kind="alpine"|"hills"|"mesa"|"island"|"dunes", seed, erosion=1, flow=False) # erodierte Höhenkarte [0,1]; erode() thermal()
c.terrain_map(h, style="relief"|"topo"|"shaded", water=.2)
v = c.landscape(h, cam=(x, alt, z), yaw, fov, horizon=.58, sun_elev=10, sun_az=30, haze=1, clouds=.35, water=.1, waves=.02, snow=.7, seed)
v.depth v.water v.project(x, y, z) -> (px, py, px_per_m) v.ground(x, z) # platziere 2D-Bäume auf dem 3D-Gelände
c.sky(sun_elev=8, sun_az=0, horizon=.6, clouds=.3, haze=1) · c.sea(sun_elev=6, waves=.12, wave_len=60, foam=.5, clouds=.25)
c.tree(x, y, height_px, kind="oak"|"pine"|"birch"|"palm"|"bush"|"dead", season="summer"|"spring"|"autumn"|"winter", haze=0..1, seed)
c.grass(x, y, w, h, n) c.flower(x, y, size, kind="daisy"|"poppy"|"tulip"|"bell") c.fern(x, y, size) · tree3d("oak", 4, seed) → (trunk, leaves) SDFs
scene_sky(s, sun_elev, sun_az) # physikalischer Himmel auf einer 3D-Szene
c.anime_cloud(x, y, w, h=.55w, palette="day"|"sunset"|"dusk"|"storm"|(shadow,mid,light,rim), light=(az, elev), bands=3, rim=.7, wisps, edge, bottom, seed) # cel-schattierte Cumuluswolke, flache Basis bei (x, y)
c.anime_tree(x, y, height, kind="round"|"tall"|"umbrella", palette="summer"|"spring"|"autumn"|"sakura"|"dusk"|(sh,mid,lt,rim,trunk), light, width, leafy=.6, seed) # cel-schattierter Baum
c.anime_mountains(y_foot, height, peaks=4, x0, x1, palette="day"|"dusk"|"autumn"|(sh,mid,lt,snow,snow_sh,haze), light, snow=.35, haze=.6, sharp=1, depth=.35, bands=3, seed) # erodiertes Relief, Frontansicht, Cel-Töne
c.sparkles(n, region=mask, size=(6, 16), color, rays=4, glow=.6, seed) # Sternenglitzer (Wasser, Schnee)
Figuren (figure) — Füße bei (x, y), Höhe = stehende Pixel (Tiere: Widerrist)
c.figure(x, y, h, pose="stand", style="flat"|"line"|"silhouette"|"stick"|"ink"|"chalk", kind="human"|"cat"|"dog"|"horse"|"bird", seed)
poses: stand idle walk run sit wave point cheer jump dance think hips phone reach · phase=0-1 (Gehzyklus) view="front"|"3q"|"side"|"back"
body=adult|teen|child|elder build=slim|heavy outfit="tee pants|coat skirt|dress" hair=short|bob|long|bun|curly skin=SKIN name colors={...}
figure_shape(...) → Shape · figure_joints(...) → {"hand_r": (x, y), ...} (Requisiten anbringen) · figure_sdf(pose, height=1.75, style="mannequin")
c.crowd(n, box=(x0, y0, x1, y1), horizon=y, height=near_px, tint=(haze, .5), dogs=.1, seed) # perspektivisch skalierte Menge
Inspizieren (inspect) — beurteile Zahlen, nicht nur die verkleinerte Ansicht
m = metrics(c|path|arr) # noise (<1 clean, >4 grainy) aliasing (% hard steps, >35 jaggy) banding clip_shadows/highlights flags[...]
contact_sheet(c, "sheet.jpg") · compare(a, b, "ab.jpg") · guides(c) / composition(c) → focal, balance, tilt · analyze_reference("ref.jpg")
Styles — lies den passenden Leitfaden, bevor du die Szene schreibst
Leitfäden befinden sich in styles/ neben dieser Datei (falls fehlend: https://raw.githubusercontent.com/Wexop/atelier/main/styles/<name>.md).
Jeder gibt Rezept, Regeln, Fallstricke und ein Beispielskript. Mehrere können gemischt werden (z.B. anime + flat).
anime.md— gemalte Anime-Landschaften: Cel-Wolken, Bäume, Berge, Randlicht, God Rays, Glitzeroil.md— Öl (paint_like) und Aquarell-Lasurenphotoreal.md— path-getracertes Stillleben/Produkt, Geländelandschaften, Meer und Himmelcomic.md— Ligne Claire/Toon aus 3D, Gravur, Tuschefilterflat.md— flache Vektoren, Poster, Typografie, Menschen, Silhouetten-Szenenpixel.md— Pixel-Art mit Paletten und Ditheringabstract.md— generative Abstraktionen aus gewellten Feldernnew-style.md— kein Leitfaden passt: studiere den Look, bilde ihn auf Primitive ab, male, dann speichere einen neuenstyles/<name>.md
Fallstricke
c.layer()ändert das aktuelle Ziel: späterec.text/...gehen auf diese Ebene (schlecht, wenn siemultiplyist). Rufec.layer()oderc.use(L)auf.c.apply()führt alle Ebenen zusammen. VerwendeL.apply(), um Ebenen zu erhalten.shade(strength)hängt von der Feld-Frequenz ab: ≈1 für große Formen, ≈.05 für feine Texturen (Stoff).tone_mapauf 2D-Kunst macht reines Weiß grau — es ist für HDR/3D; verwendecurves/levelsfür Illustrationen.- Harte Schwellen aliassen: verwende
aastep/smoothstep, nichtf > .5, für sichtbare Kanten. - Rauschen
scale= Features pro Canvas-Höhe. Form-Koordinaten = Canvas-Pixel; Field-Koordinaten = 0–1. - Kosten:
pathtrace≈ 30–60 µs/Pfad (1200×800 @ 8 spp ≈ 5 min auf 2 Kernen, Vorschauen 4× weniger spp) — entwerfe mitc.render; niedrige spp erzeugen Funkeln auf glänzendem Metall/Glas (spp erhöhen).aa=2≈ 4×. Viele SDF-Teile (Figuren, tree3d, displace) sind langsam zu tracen. - Glas:
rough=0für klar (Standard rough .5 = matt). Inc.renderwird Glas einmal gebogen; verwendepathtracefür echte Brechung.