Content is user-generated and unverified.
""" ╔══════════════════════════════════════════════════════════════════════════════╗ ║ RENAISSANCE AI — Ultimate Art Generation System ║ ║ Synthesized from PRIMARY SOURCES of the Italian and Northern Renaissance ║ ╚══════════════════════════════════════════════════════════════════════════════╝ PRIMARY SOURCES (all principles encoded herein derive directly from): [CENNINI] Cennino Cennini, Il Libro dell'Arte, c.1390 [ALBERTI] Leon Battista Alberti, De Pictura / Della Pittura, 1435 [VINCI] Leonardo da Vinci, Trattato della Pittura, c.1490–1510 [VITRUV] Vitruvius, De Architectura Libri Decem, c.25 BC (foundational for all Renaissance theory via Alberti & Ghiberti) [DURER] Albrecht Dürer, Vier Bücher von menschlicher Proportion, 1528 [GHIBERTI] Lorenzo Ghiberti, Commentarii, c.1447–55 via Bartoli, L., "Arte e scrittura nella Firenze del Quattrocento", PhD diss., University of Toronto, 1996 [VASARI] Giorgio Vasari, Le Vite de' più eccellenti pittori..., 1550 WHY EXISTING MODELS FAIL: SDXL and Flux.1 generate "Italian Renaissance vibes" at best. They have zero understanding of: • Pigment limitation (no Prussian blue, no cadmium, no modern hues) • Tempera cross-hatching texture vs oil glazing vs fresco mat quality • Burnished gold leaf with tooled (punched) haloes • Verdaccio underpaint shining through warm flesh glazes • Sfumato: smoke-like softening at ALL contours, not just faces • The specific warm–cool temperature battle in flesh (rose lights, grey shadows) • Gesso bole preparation texture on wood panels • Craquelure patterns of aging paint layers • Regional styles: Sienese gold vs Florentine disegno vs Venetian colore • Proper Vitruvian architectural orders behind figures • Correct period fabric (wool, silk, brocade) with heavy, gravity-bound folds • Halos: flat gold, punched (pastiglia) border, no glow effect • The absent background: lapis-lazuli blue or gold, not photographic sky This system encodes ALL of the above as structured generation logic. """ from __future__ import annotations import json import random import textwrap from dataclasses import dataclass, field from enum import Enum, auto from typing import List, Optional, Dict, Tuple, Union from pathlib import Path import hashlib # ═══════════════════════════════════════════════════════════════════ # SECTION I: TAXONOMIES # Every enum here corresponds directly to a distinction in the sources. # ═══════════════════════════════════════════════════════════════════ class Period(Enum): """ [VASARI] Three ages of art: primitive, second, third. Extended here with Northern and Late-phase subdivisions. """ # Proto-Renaissance / Dugento / Trecento PROTO_RENAISSANCE = "proto_renaissance" # Cimabue, Duccio, Giotto (c.1260–1370) INTERNATIONAL_GOTHIC = "gothic" # Gentile da Fabriano, Pisanello (c.1370–1430) # Vasari's Second Age — Quattrocento EARLY_FLORENTINE = "early_florentine" # Masaccio, Donatello, Uccello (1420–1470) EARLY_SIENESE = "early_sienese" # Sassetta, Giovanni di Paolo (1420–1490) EARLY_VENETIAN = "early_venetian" # Bellini, Mantegna (1440–1500) EARLY_NORTHERN = "early_northern" # van Eyck, Rogier, Memling (1420–1500) QUATTROCENTO = "quattrocento" # General 1400s # Vasari's Third Age — Cinquecento / High Renaissance HIGH_RENAISSANCE = "high_renaissance" # Leonardo, Raphael, Michelangelo (1490–1530) HIGH_VENETIAN = "high_venetian" # Titian, Giorgione, Veronese (1500–1580) NORTHERN_HIGH = "northern_high" # Dürer, Holbein, Cranach (1490–1550) # Mannerism / Late Renaissance MANNERIST = "mannerist" # Pontormo, Rosso, Parmigianino (1520–1600) class Region(Enum): """ [VASARI] Regional styles are decisive: Florentines prize disegno; Venetians prize colore; Sienese prize gold and linearity. """ FLORENCE = "florence" SIENA = "siena" VENICE = "venice" ROME = "rome" UMBRIA = "umbria" # Perugino, early Raphael PADUA = "padua" # Mantegna, Squarcione workshop MILAN = "milan" # Leonardo's mature style NAPLES = "naples" NETHERLANDS = "netherlands" # Flemish: van Eyck, Rogier GERMANY = "germany" # Dürer, Cranach SPAIN = "spain" # El Greco (late) class Medium(Enum): """ [CENNINI] The medium determines EVERYTHING about texture, layering, color saturation, finish quality, and aging appearance. """ # [CENNINI Ch.67-104] Egg tempera on gessoed wood panel EGG_TEMPERA_PANEL = "egg_tempera_panel" # [CENNINI Ch.67] Egg tempera on stretched linen (rare) EGG_TEMPERA_CANVAS = "egg_tempera_canvas" # [CENNINI Ch.151-165] True fresco (buon fresco) on wet lime plaster BUON_FRESCO = "buon_fresco" # Fresco secco — applied to dry plaster, less saturated, prone to flaking FRESCO_SECCO = "fresco_secco" # [VINCI Tr.230] Oil on wood panel — Flemish-derived technique OIL_ON_PANEL = "oil_on_panel" # Oil on canvas — primarily Venetian from c.1490 OIL_ON_CANVAS = "oil_on_canvas" # Mixed: tempera underpainting + oil glazes (Leonardo's method) TEMPERA_OIL_MIXED = "tempera_oil_mixed" # Manuscript illumination on vellum ILLUMINATION = "illumination" # Mosaic (gold tesserae + glass) MOSAIC = "mosaic" class Subject(Enum): """ [ALBERTI De Pictura] History painting (historia) is the highest. [VASARI] Subject determines decorum, figure count, and emotional register. """ # Sacred subjects MADONNA_CHILD = "madonna_child" ANNUNCIATION = "annunciation" NATIVITY = "nativity" CRUCIFIXION = "crucifixion" DEPOSITION = "deposition" LAST_SUPPER = "last_supper" ALTARPIECE = "altarpiece" DEVOTIONAL_IMAGE = "devotional_image" # Single saint, half-length SACRED_NARRATIVE = "sacred_narrative" # Multi-figure biblical scene # Secular / Mythological PORTRAIT = "portrait" MYTHOLOGICAL = "mythological" ALLEGORY = "allegory" HISTORY_PAINTING = "history_painting" LANDSCAPE_STUDY = "landscape_study" # Architectural subjects ARCHITECTURAL = "architectural" # Intarsia, perspective veduta # ═══════════════════════════════════════════════════════════════════ # SECTION II: PIGMENT PALETTES # [CENNINI] [VINCI Tr.Ch.226-229] Only these pigments existed. # NO modern synthetic colors. This is a primary source of model failure. # ═══════════════════════════════════════════════════════════════════ @dataclass class PigmentPalette: """ [CENNINI] Chapter-by-chapter breakdown of available pigments. Colors generated must be constructable from these specific pigments — this eliminates the "oversaturated digital" look entirely. """ name: str period: Period pigments: Dict[str, str] # name -> description for prompt use forbidden: List[str] # colors/properties explicitly impossible characteristic_combination: str # what makes this palette distinctive PALETTES: Dict[str, PigmentPalette] = { "trecento_sienese": PigmentPalette( name="Sienese Trecento", period=Period.PROTO_RENAISSANCE, pigments={ "ultramarine": "precious lapis lazuli, intense deep blue, granular", "azurite": "copper-based medium blue, slightly green, powdery", "lead_white": "dense, cool, chalky white with slight blue cast", "vermilion": "mercury sulphide, warm orange-red, dense", "red_lake": "organic, transparent, cooler red-violet", "terre_verde": "grey-green earth, used as flesh undermodelling", "yellow_ochre":"iron oxide, warm golden-yellow earth", "raw_sienna": "transparent warm orange-brown earth", "burnt_sienna":"deep orange-red, from heated raw sienna", "raw_umber": "cool grey-brown earth", "ivory_black": "deep warm black from charred bone", "gold_leaf": "burnished 23-carat gold, highly reflective", }, forbidden=[ "Prussian blue", "cobalt blue", "cadmium", "chrome", "zinc white", "titanium white", "phthalo", "quinacridone", "fluorescent", "neon", "electric", "saturated lime green", "pure cyan", "pure magenta" ], characteristic_combination=( "gold background, ultramarine drapery with azurite in lights, " "terre verde flesh underpainting with vermilion-ochre modeling, " "red lake shadows in drapery, ivory black outlines" ), ), "early_florentine": PigmentPalette( name="Early Florentine Quattrocento", period=Period.EARLY_FLORENTINE, pigments={ "ultramarine": "deep saturated blue-violet, expensive, reserved for Virgin's mantle", "azurite": "workday blue, slightly green, used for skies and secondary blues", "lead_white": "cool chalky white, makes flesh chalky in highlights", "vermilion": "brilliant warm red, stable, used for drapery", "red_lake": "transparent carmine-violet glaze over vermilion", "terre_verde": "grey-sage green, critical underpainting for all flesh", "lead_tin_yellow":"warm, slightly greenish-yellow, unavailable after c.1750", "massicot": "pale warm yellow, lead-based", "yellow_ochre": "mid-tone warm earth", "raw_umber": "cool grey-brown for shadows", "burnt_umber": "warm brown for shadows and darks", "ivory_black": "with lead white makes blue-grey", "malachite": "vivid green, copper-based, used in foliage and brocade", "verdigris": "blue-green copper, unstable but brilliant", "gold_leaf": "burnished, with punched (pastiglia) halo borders", }, forbidden=[ "pure black backgrounds", "photographic sky", "Prussian blue", "cadmium yellow", "cadmium red", "cerulean", "any color that appears luminescent or glowing" ], characteristic_combination=( "white or blue sky, architectural backdrop, ultramarine Virgin's mantle, " "terre verde flesh underpaint giving grey-green shadows, " "malachite foliage, gold haloes with punched border patterns" ), ), "high_florentine": PigmentPalette( name="High Renaissance Florentine (Leonardo)", period=Period.HIGH_RENAISSANCE, pigments={ "ultramarine": "very thinly glazed, deep atmospheric blue", "smalt": "potassium glass blue, slightly grey, for distant landscape", "lead_white": "with subtle warm tint in lights", "vermilion": "rarely used pure, usually glazed", "red_lake": "multiple glazing layers for deep shadows", "terre_verde": "pervasive in flesh — creates grey-green penumbra (sfumato key)", "lead_tin_yellow": "used in foliage, brocade highlights", "yellow_ochre": "all flesh midtones", "raw_umber": "atmospheric distance layers", "ivory_black": "never used pure in shadows — always mixed", "walnut_oil": "vehicle giving slower-drying, more blendable paint", }, forbidden=[ "hard outlines", "pure unmixed black", "flat gold backgrounds", "high contrast without transition zones", "fully saturated primary colors", "sharp edge definition" ], characteristic_combination=( "sfumato transitions at ALL edges, not just faces, " "golden-brown atmospheric haze in all distant passages, " "grey-green (terre verte) shadow zones in flesh, " "no true darks — all shadows have reflected light, " "thick impasto NEVER — all paint is thinly layered" ), ), "venetian_oil": PigmentPalette( name="High Venetian (Titian–Giorgione)", period=Period.HIGH_VENETIAN, pigments={ "ultramarine": "rich, deeply saturated in thick passages", "azurite": "used in sky underpainting", "lead_white": "warm-tinted highlights, impasto in lights", "vermilion": "warm red drapery, strong", "red_lake": "deep transparent glazes — Venetian red shadow specialty", "yellow_ochre": "flesh, warm highlights", "raw_sienna": "warm imprimatura and flesh glazes", "burnt_sienna": "shadows and hair", "umber": "deep warm underpainting", "ivory_black": "warmer shadows than Florentine", "verdigris_oil": "glazed over darks for depth", "lead_tin_yellow": "light passages in foliage and highlights", }, forbidden=[ "cool grey shadows", "flat linear outlines", "terre verte underpaint (replaced by warm toning ground)", "fully frontal lighting", "architectural backgrounds without atmospheric haze" ], characteristic_combination=( "warm toned red-brown imprimatura ground showing through mid-tones, " "rich impasto in lights, deep glowing transparent darks, " "saturated color in everything, warm shadows rather than cool, " "canvas texture visible in final surface" ), ), "northern_oil": PigmentPalette( name="Northern Renaissance (Flemish–German)", period=Period.EARLY_NORTHERN, pigments={ "ultramarine": "very deep, polished", "azurite": "mixed with lead white for lighter blues", "lead_white": "very cool, bright, highly polished finish", "vermilion": "brilliant in fabric", "red_lake": "multiple cool crimson glazes", "smalt": "grey-blue for sky gradations", "orpiment": "warm golden yellow (arsenic-based, toxic)", "copper_green": "malachite and verdigris for foliage", "ivory_black": "used more boldly than Italian practice", "silver_point": "for underdrawing (transfers to paint surface)", "gold_leaf": "still present but less dominant than Italian", }, forbidden=[ "sfumato (opposite: sharp, jewel-like focus at ALL distances)", "atmospheric haze", "loose brushwork", "visible canvas" ], characteristic_combination=( "hyper-sharp definition at all focal distances, " "oil-polished enamel-like surface quality, " "meticulous surface detail (fabric, fur, hair), " "cool brilliant lighting rather than warm Italian glow, " "detailed landscape visible through windows" ), ), } # ═══════════════════════════════════════════════════════════════════ # SECTION III: LIGHT AND SHADOW SYSTEMS # [VINCI Tr.Ch.175-221] The most detailed treatment in any source. # [CENNINI Ch.8-9] Practical instructions for modeling forms. # ═══════════════════════════════════════════════════════════════════ @dataclass class LightingSystem: """ [VINCI Tr.Ch.183,186,191] The quality, angle, and color of light is determined by the subject type and the architectural setting. """ name: str source_description: str light_quality: str # hard/soft/diffused shadow_quality: str # sharp/soft/penumbra color_temperature: str flesh_modeling: str # how light models human flesh specifically prompt_fragment: str negative_fragment: str LIGHTING_SYSTEMS: Dict[str, LightingSystem] = { "north_window": LightingSystem( # [VINCI Tr.Ch.183,186] "the light from on high, and not too powerful" # [VITRUV Bk.I Ch.2 §7] "northern light for picture galleries... # grows neither light nor dark with the course of the sun" name="North Window (Leonardo's Preferred)", source_description="single high north-facing window, soft diffused daylight", light_quality="soft, directional but not harsh, steady", shadow_quality="soft penumbra transitions, no cast shadow lines", color_temperature="cool neutral, slightly blue-grey", flesh_modeling=( "strong side-light modeling, bright areas warm lead-white+ochre, " "shadow areas cool grey-green (terre verte showing through), " "half-tone transition zone is critical sfumato region" ), prompt_fragment=( "illuminated by soft diffused north window light, single light source " "from upper left, gentle chiaroscuro modeling, no harsh shadows, " "sfumato transitions between light and shadow on all forms" ), negative_fragment=( "direct sunlight, multiple light sources, bright outdoor lighting, " "hard cast shadows, overexposed highlights, rim lighting, backlit" ), ), "gold_background": LightingSystem( # [CENNINI] Flat gold background: no atmospheric perspective, no cast shadows # Gold is luminous itself — figures read against it without cast shadow name="Gold Ground (Byzantine-derived, Early Italian)", source_description="burnished gold leaf background, no environmental light source", light_quality="self-luminous gold field, non-atmospheric", shadow_quality="minimal — shadows are symbolic/schematic not optical", color_temperature="warm gold surrounds all forms", flesh_modeling=( "modeled with warm ochre lights and red-brown darks against gold, " "no cast shadows onto background, " "highlight strokes are parallel hatch lines of lead white" ), prompt_fragment=( "flat burnished gold leaf background, iconic Byzantine-influenced lighting, " "figures self-lit against gold ground, no cast shadows on background, " "decorative punchwork border on haloes, hieratic frontal composition" ), negative_fragment=( "realistic sky, atmospheric perspective, cast shadows on background, " "deep space recession, naturalistic setting" ), ), "architectural_interior": LightingSystem( # [VINCI Tr.Ch.193] figures within a room, light from window # [ALBERTI] Mathematical perspective space with coffered ceiling name="Architectural Interior (Quattrocento/High Renaissance)", source_description=( "interior architectural space, light entering from side window or " "loggia opening, secondary reflected light from walls and floor" ), light_quality="moderate, directional, with significant reflected fill", shadow_quality="soft cast shadows with colored reflections (blue from sky)", color_temperature="warm daylight primary, cool blue-grey reflected", flesh_modeling=( "lit side: warm rose-ochre; shadow side: cool grey-green; " "reflected light from floor warms bottom of chin and nose; " "no pure black shadow — all have reflected luminosity" ), prompt_fragment=( "interior architectural setting with columns and coffered ceiling, " "directional side lighting from arched window, " "architectural recession in mathematically correct perspective, " "secondary reflected light fills shadow areas with warm ambient glow" ), negative_fragment=( "outdoor sunlight, HDR photography, studio lighting, " "dark featureless background, flat even illumination" ), ), "landscape_diffused": LightingSystem( # [VINCI Tr.Ch.190] "if the object be in the open country, you need not # let your figures be illumined by the sun; but may suppose some transparent # clouds interposed" name="Overcast Outdoor (Leonardo's Recommended for Portraits)", source_description="overcast sky, thin clouds, diffused omnidirectional", light_quality="extremely soft, almost no directionality", shadow_quality="near-invisible cast shadows, very soft penumbra", color_temperature="cool neutral grey-blue overall", flesh_modeling=( "very subtle modeling, almost all tonal variation from form alone, " "shadows are barely darker than half-tones, " "highest degree of sfumato — edges vanish into background" ), prompt_fragment=( "overcast soft natural light, thin clouds diffusing sunlight, " "very soft shadows without hard edges, sfumato atmospheric quality, " "flesh tones softly modeled with imperceptible transitions" ), negative_fragment=( "direct sun, strong contrast, deep dark shadows, golden hour, " "dramatic cinematic lighting, sharp shadow lines" ), ), } # ═══════════════════════════════════════════════════════════════════ # SECTION IV: PROPORTION AND ANATOMY SYSTEMS # [VINCI Tr.Ch.1-11, 26-59] [DURER Four Books] [VITRUV Bk.III Ch.1] # ═══════════════════════════════════════════════════════════════════ @dataclass class ProportionSystem: """ [DURER] "We call that figure beautiful which is in due proportion." [VINCI] "The human body is so designed by nature that the face, from the chin to the top of the forehead... is a tenth part of the whole height." [VITRUV Bk.III Ch.1] Complete Vitruvian body proportion system. """ canonical_ratios: Dict[str, str] age_variations: Dict[str, str] gender_notes: str durer_type: str # Dürer's different proportion types A-F prompt_guidance: str VITRUVIAN_PROPORTION = ProportionSystem( # [VITRUV Bk.III Ch.1 §2] verbatim proportional system canonical_ratios={ "face_to_height": "1:10 (face = 1/10 of total height)", "hand_to_height": "1:10 (hand = 1/10, same as face)", "head_to_height": "1:8 (head with neck and shoulder to top = 1/6)", "foot_to_height": "1:6 (foot = 1/6 of height)", "forearm_to_height": "1:4", "shoulder_breadth": "1/4 of height", "navel_position": "center of body circle (umbilicus as radius center)", "fingertip_span": "= total height (outstretched arms equal height)", }, age_variations={ # [VINCI Tr.Ch.9] "A man has the length of two heads from the # extremity of one shoulder to the other... but the child has only one" "infant": "head = 1/5 to 1/4 of height, very large head relative to body", "child": "head = 1/6 to 1/7 of height, limbs short relative to torso", "adolescent": "head = 1/7 to 1/8, transitional proportions", "adult_male": "head = 1/8 to 1/10 (heroic), shoulders twice head-width", "adult_female": "similar but shoulders narrower, hips relatively wider", "old_age": "slight stooping, proportions similar to adult but compressed", }, gender_notes=( # [VINCI Tr.Ch.107,169] "Women to be represented in modest and reserved attitudes" # [VITRUV Bk.IV Ch.1 §7] Doric = masculine, Ionic = feminine "Female: softer contours, no visible straining muscles, " "rounder forms, narrower shoulders, closed modest postures. " "Male: can show straining muscle groups, wider shoulders, " "more pronounced bone structure." ), durer_type="Type A (average, ideal — based on Vitruvian canon)", prompt_guidance=( "figure with anatomically correct Renaissance proportions: " "head one-tenth total height, navel at center of body, " "shoulders two head-widths, feet one-sixth of height, " "forearms one-quarter height" ), ) # ═══════════════════════════════════════════════════════════════════ # SECTION V: COMPOSITION PRINCIPLES # [ALBERTI De Pictura Bk.II] The foundation of historia painting. # [VINCI Tr.Ch.128-164] Arrangement, gesture, variety. # [VITRUV Bk.I Ch.2] Order, arrangement, eurythmy, symmetry. # ═══════════════════════════════════════════════════════════════════ @dataclass class CompositionPrinciple: """ [ALBERTI] "I call historia the greatest work of the painter... the historia will move the soul of the beholder when each man painted there clearly shows the movement of his own soul." """ name: str source_reference: str description: str spatial_organization: str figure_arrangement: str prompt_guidance: str COMPOSITION_PRINCIPLES: List[CompositionPrinciple] = [ CompositionPrinciple( name="Sacra Conversazione", source_reference="[ALBERTI] symmetric devotional arrangement", description=( "Central sacred figure (Madonna or Christ) enthroned or standing " "on central axis, saints and donors arranged symmetrically on either side. " "Architectural setting provides geometric framing." ), spatial_organization=( "Single-point perspective converging behind central figure, " "architectural apse or loggia frames the group, " "ground plane tilted toward viewer (medieval inheritance)" ), figure_arrangement=( "Central figure highest and largest, flanking figures step inward, " "donor portraits at edges kneeling or smaller, " "angels at feet or frame edges" ), prompt_guidance=( "sacra conversazione altarpiece composition, central enthroned Madonna " "flanked by standing saints, symmetrical arrangement, " "classical architectural apse backdrop, hierarchical scale" ), ), CompositionPrinciple( name="Narrative Historia", source_reference="[ALBERTI De Pictura II] Historia with variety and action", description=( "[ALBERTI] 'I am pleased, in a historia, if I see a certain " "copious variety... old men, young men, maidens, children.' " "Multiple figures in dramatic interaction expressing unified emotion." ), spatial_organization=( "Deep architectural or landscape setting with clear recession, " "figures in middleground, distant landscape or cityscape behind, " "mathematical one-point perspective" ), figure_arrangement=( "[VINCI Tr.Ch.158] Maximum variety of attitude, age, expression, " "each figure's body language narrates their inner state, " "no two figures with same gesture or posture" ), prompt_guidance=( "multi-figure historical composition with narrative action, " "variety of ages expressions and gestures, figures in dramatic interaction, " "architectural or landscape setting with deep perspective recession, " "unified expressive emotion across all figures" ), ), CompositionPrinciple( name="Three-Quarter Portrait", source_reference="[VINCI] [DURER] The ideal portrait view", description=( "[VINCI Tr.Ch.22] Face slightly turned from full front. " "[DURER] Three-quarter view preferred for revealing form. " "Bust or half-length, hands often included." ), spatial_organization=( "Figure placed slightly off-center, facing 3/4 toward viewer, " "neutral or landscape background, " "parapetto (parapet ledge) sometimes at bottom edge" ), figure_arrangement=( "Single figure, head turned 30-45° from frontal, " "shoulder line not parallel to picture plane, " "near shoulder slightly forward, far shoulder back" ), prompt_guidance=( "three-quarter portrait view, face turned thirty degrees from frontal, " "near shoulder forward, soft background with atmospheric haze, " "half-length composition with hands visible if possible" ), ), CompositionPrinciple( name="Annunciation", source_reference="[CENNINI] [ALBERTI] Standard sacred subject", description=( "Two-figure composition: Angel Gabriel entering from left, " "Virgin Mary at right before lectern or prie-dieu. " "Architectural interior with garden or courtyard visible." ), spatial_organization=( "Interior loggia with arched opening to garden, " "two figures in separate spatial zones linked by gesture, " "dove of Holy Spirit descending diagonally" ), figure_arrangement=( "Gabriel kneeling/bowing at left, Mary at right standing or kneeling, " "both turning toward each other, hands gesturing, " "lily symbolically between them" ), prompt_guidance=( "annunciation scene, angel Gabriel entering from left with lily, " "Virgin Mary at right before book-stand, interior architectural setting, " "garden visible through arcade, dove descending" ), ), ] # ═══════════════════════════════════════════════════════════════════ # SECTION VI: TECHNIQUE DESCRIPTORS # [CENNINI] The most specific technical source. Every brush mark described. # ═══════════════════════════════════════════════════════════════════ @dataclass class TechniqueDescriptor: """ [CENNINI] Each medium has a completely different physical appearance. This is lost in ALL current AI models which blend them indiscriminately. """ medium: Medium surface_appearance: str brushwork_character: str color_saturation: str edge_quality: str texture_of_support: str aging_characteristics: str prompt_terms: List[str] anti_terms: List[str] # terms that signal wrong medium TECHNIQUE_DESCRIPTORS: Dict[Medium, TechniqueDescriptor] = { Medium.EGG_TEMPERA_PANEL: TechniqueDescriptor( medium=Medium.EGG_TEMPERA_PANEL, # [CENNINI Ch.67-104] "Take the yolk of an egg" # Tempera: fast drying, cross-hatching mandatory, no blending surface_appearance=( "flat, slightly chalky, matte surface, " "no impasto or thick paint, " "forms built through cross-hatched parallel strokes, " "ground (gesso) slightly visible through thin paint layers" ), brushwork_character=( "[CENNINI Ch.67] Fine sable brush, 'little parallel strokes', " "cannot blend wet paint — each layer must dry before next, " "hatching visible at all transitions, " "highlights done last with pure lead white parallel strokes" ), color_saturation=( "High chroma in lights (egg vehicle makes colors bright), " "shadows thin and transparent, " "never thick dark passages — darkness from layered glazes" ), edge_quality=( "Crisp defined edges where brushstrokes end, " "no true blending or sfumato, " "forms described by accumulated strokes not washes" ), texture_of_support=( "Poplar or linden wood panel, " "gesso ground (chalk in rabbit-skin glue) visible as white substrate, " "panel grain may influence surface texture" ), aging_characteristics=( "fine craquelure network following panel wood grain, " "slightly yellowed but less than oil, " "gold leaf abrasion at highest points" ), prompt_terms=[ "egg tempera on gessoed wood panel", "fifteenth century Italian panel painting", "parallel hatching brushstrokes", "matte chalky surface quality", "poplar panel support", "cross-hatched modeling of forms", "gesso bole ground", ], anti_terms=[ "oil paint impasto", "blended sfumato edges", "thick paint texture", "canvas weave", "wet-into-wet blending", ], ), Medium.BUON_FRESCO: TechniqueDescriptor( medium=Medium.BUON_FRESCO, # [CENNINI Ch.151-165] "You must plaster the wall freshly" surface_appearance=( "flat, absolutely matte, no reflections ever, " "plaster wall texture slightly visible, " "no glazing or transparency in shadows, " "colors fully integrated into plaster surface" ), brushwork_character=( "[CENNINI Ch.152] Must complete each giornata (day's work area) " "before plaster dries — no reworking possible. " "Broader looser strokes than tempera. " "Sinopia (underdrawing) on rough plaster layer visible in some places." ), color_saturation=( "Lime chemistry limits palette: no lead pigments (turn black), " "no orpiment, no verdigris. " "Colors: ultramarines must be applied a secco. " "Overall slightly chalky and desaturated compared to oil" ), edge_quality=( "Softer edges than tempera, " "giornata joins sometimes visible as slight color differences, " "no true impasto or raised surface" ), texture_of_support=( "Rough plaster arriccio underneath smooth intonaco, " "plaster grain visible at close range, " "wall-bound: stone or brick structure behind" ), aging_characteristics=( "salt efflorescence (white spots), " "paint loss at giornata seams, " "blue areas often repainted a secco (often fallen off), " "overall cooler, more muted tones than original" ), prompt_terms=[ "buon fresco on lime plaster wall", "mural painting fresco technique", "matte chalky wall surface", "fresco plaster texture", "monumental wall painting", "lime intonaco surface", ], anti_terms=[ "glossy surface", "canvas", "oil paint sheen", "transparent glazes", "impasto", "thick brushwork", ], ), Medium.OIL_ON_PANEL: TechniqueDescriptor( medium=Medium.OIL_ON_PANEL, # Primarily Flemish technique. [CENNINI Ch.92] notes oil painting # [VINCI] adopted mixed method on panel surface_appearance=( "enamel-like, glass-smooth surface especially Flemish works, " "slight depth and luminosity from layered glazes, " "impasto possible in lights (raised paint texture), " "translucent depth in shadows from multiple dark glazes" ), brushwork_character=( "Flemish: microscopically fine, invisible brushwork, jewel-like finish. " "Italian oil: broader, more evident brushwork than Flemish. " "Leonardo: imperceptible transitions, no visible strokes in flesh areas" ), color_saturation=( "Very high saturation possible in both lights and darks, " "transparent darks glow with inner depth, " "broader palette than tempera (more oil-stable pigments)" ), edge_quality=( "Flemish: hyper-sharp at all distances. " "Leonardo: sfumato even at near objects. " "Venetian: soft atmospheric at edges, impasto in lights" ), texture_of_support=( "Oak panel (Flemish) or poplar/walnut (Italian), " "very fine gesso ground, often tinted warm (Venetian: red-brown imprimatura)" ), aging_characteristics=( "yellowed amber tone from oil oxidation, " "oil craquelure more pronounced than tempera, " "dark passages may have sunk (oil absorbed into ground)" ), prompt_terms=[ "oil on wood panel", "Flemish technique glazed oil painting", "luminous glazed depths", "enamel-like painted surface", ], anti_terms=[ "canvas texture", "impressionist brushwork", "modern art gallery", "20th century" ], ), Medium.OIL_ON_CANVAS: TechniqueDescriptor( medium=Medium.OIL_ON_CANVAS, # Venetian innovation c.1490. [VINCI Tr.Ch.231] notes canvas surface_appearance=( "canvas weave visible especially in thin passages and aging, " "more textured than panel paintings, " "impasto in lights can be pronounced (Titian), " "warm red-brown ground (imprimatura) showing in mid-tones" ), brushwork_character=( "Titian: broad loaded brushes, paint dragged and pushed, " "fingers used directly on wet paint (historical accounts), " "looser more gestural than Flemish panel work, " "visible pentimento (changes) in complex compositions" ), color_saturation=( "Very rich warm saturated color, " "reds especially deep and luminous, " "warm shadows (not cool grey), " "highlights with thick lead white impasto" ), edge_quality=( "Softer than Flemish, atmospheric edges, " "figures merge with background at edges in late Titian, " "impasto lights stand proud against glazed darks" ), texture_of_support=( "Hemp or linen canvas, " "visible warp and weft in thin areas, " "warm orange-red or red-brown imprimatura ground" ), aging_characteristics=( "canvas age-wrinkles and bulges, " "deep amber yellowing of oil, " "canvas weave very pronounced with age, " "warm overall tone" ), prompt_terms=[ "Venetian oil on canvas", "Titian technique", "warm red-brown imprimatura ground", "visible canvas texture", "rich impasto highlights", "glazed warm shadows", ], anti_terms=[ "cool shadows", "flat even texture", "modern photographic quality", "HDR" ], ), } # ═══════════════════════════════════════════════════════════════════ # SECTION VII: ARCHITECTURAL SYSTEMS # [VITRUV Bk.III-IV] Column orders and their symbolic/visual meanings. # [ALBERTI De Re Aedificatoria] Renaissance application of Vitruvius. # ═══════════════════════════════════════════════════════════════════ ARCHITECTURAL_VOCABULARY: Dict[str, str] = { # [VITRUV Bk.IV Ch.1] The three orders and their proper applications "doric_order": ( "[VITRUV] 'The Doric column exhibits the proportions, strength, and " "beauty of the body of a man' — used for temples to Mars, Minerva, " "Hercules. Simple, undecorated capital, no base originally." ), "ionic_order": ( "[VITRUV] 'The slenderness of women' — for Juno, Diana, Bacchus. " "Scroll volutes on capital, base with torus and scotia, " "elegant proportions between Doric and Corinthian." ), "corinthian_order": ( "[VITRUV Bk.IV Ch.1 §9] 'Imitation of the slenderness of a maiden' — " "acanthus leaf capital discovered by Callimachus from a basket on a tomb. " "Most ornate, used in secular grandeur and later Renaissance." ), "round_arch": ( "Semicircular arch — standard in Romanesque and early Italian Renaissance, " "used by Brunelleschi, derived from Roman sources." ), "barrel_vault": ( "Continuous rounded vault — appears in coffered form (Roman Pantheon), " "standard for painted architectural interiors." ), "coffered_ceiling": ( "Ceiling with recessed panels (coffers) — Roman derived, " "standard in Quattrocento architectural paintings, " "creates measurable perspective recession." ), "loggia": ( "Open arcade — colonnaded porch or gallery open on one side, " "very common architectural framing device in panel paintings." ), "arcade": ( "Series of arches on columns or piers — " "appears behind figures in Sacra Conversazione and Annunciation panels." ), "pilaster": ( "Flat column against wall — " "appears in painted architectural settings." ), } # ═══════════════════════════════════════════════════════════════════ # SECTION VIII: ANALYSIS OF AI MODEL FAILURES # What specific, documentable failures do Flux and SDXL exhibit # when generating Renaissance art? # ═══════════════════════════════════════════════════════════════════ @dataclass class ModelFailureAnalysis: """ Systematic analysis of documented failure modes in existing models, with direct citation to the Renaissance principle being violated. """ model: str failure_category: str specific_failure: str principle_violated: str source_citation: str correction_strategy: str SDXL_FAILURES: List[ModelFailureAnalysis] = [ ModelFailureAnalysis( model="SDXL / SDXL-Turbo", failure_category="SURFACE TEXTURE", specific_failure=( "Generates paintings with photographic sharpness and HDR tonal mapping. " "Treats 'painting' as a filter on photography rather than understanding " "the physical substrate. Canvas texture looks like a Photoshop overlay." ), principle_violated=( "Every medium has specific physical character: tempera is MATTE and " "cross-hatched; oil panels are enamel-like; fresco is chalky and wall-bound." ), source_citation="[CENNINI Ch.67-165] complete technical instruction on each surface", correction_strategy=( "Specify medium explicitly AND in detail. " "Use: 'egg tempera on gessoed poplar panel, matte chalky surface, " "cross-hatched parallel brush strokes, no impasto, no glazing'" ), ), ModelFailureAnalysis( model="SDXL / SDXL-Turbo", failure_category="COLOR PALETTE", specific_failure=( "Generates colors impossible in period: Prussian blue (invented 1704), " "cadmium red/yellow (1817-1840), modern synthetic greens, " "titanium white (1916), phthalo blue/green (1935). " "Result: 'Renaissance-ish' but anachronistically chromatic." ), principle_violated=( "Color vocabulary strictly limited by available mineral and organic pigments. " "No 'bright lime green', no 'hot pink', no 'electric blue' was possible." ), source_citation=( "[CENNINI Ch.37-70] each pigment named and described; " "[VINCI Tr.Ch.226-229] color mixing theory" ), correction_strategy=( "Specify pigment names directly: 'ultramarine blue lapis lazuli, " "lead white, yellow ochre, terre verte, vermilion, ivory black, " "red lake' — these are terms that orient the model correctly." ), ), ModelFailureAnalysis( model="SDXL / SDXL-Turbo", failure_category="LIGHT AND SHADOW", specific_failure=( "No understanding of sfumato. Generates hard-edged chiaroscuro everywhere " "or flat even lighting. Cannot generate the 'smoke-like' imperceptible " "transitions that define Leonardo's mature work. " "Also: uses cool grey shadows — historically incorrect (shadows are " "warm in tempera, colored by reflected surroundings in all techniques)." ), principle_violated=( "[VINCI Tr.Ch.189] 'The shadows are never to be of such a quality as " "to obliterate the proper colour.' " "[VINCI Tr.Ch.195] sfumato: 'as smoke loses itself in the air, so are " "your lights and shadows to pass from the one to the other'" ), source_citation="[VINCI Tr.Ch.175-221] comprehensive light and shadow theory", correction_strategy=( "Use: 'sfumato imperceptible shadow transitions, no hard shadow edges, " "shadows warm and colored not cool grey, reflected light in shadow areas, " "atmospheric modulation of all forms'" ), ), ModelFailureAnalysis( model="SDXL / SDXL-Turbo", failure_category="GOLD AND HALOES", specific_failure=( "Gold backgrounds rendered as metallic flat color or gradient. " "Haloes rendered as glowing rings (more like sci-fi than medieval). " "No understanding of burnished gold leaf, punchwork patterns, " "or the physical texture of gilded gesso." ), principle_violated=( "[CENNINI Ch.86-108] detailed instruction on gilding: " "gesso bole application, gold leaf laying, burnishing with dog-tooth tool, " "punching ornamental patterns into gilded surface" ), source_citation="[CENNINI Ch.86-108] gilding technique", correction_strategy=( "Use: 'burnished gold leaf background, punched punchwork border on " "circular halo, pastiglia ornamental border, " "no glow effect, flat gold field, gold is reflective not luminescent'" ), ), ModelFailureAnalysis( model="SDXL / SDXL-Turbo", failure_category="ANATOMY AND PROPORTION", specific_failure=( "Uses modern facial typology: high cheekbones, small nose, " "large eyes, contemporary 'model' proportions. " "Bodies often have fitness-model musculature not period-appropriate. " "Hands are malformed or hidden." ), principle_violated=( "[VITRUV Bk.III Ch.1] canonical proportions explicitly stated. " "[DURER] multiple proportion systems documented. " "[VINCI Tr.Ch.1-11] proportion rules for all body types." ), source_citation="[VINCI Tr.Ch.26-59] anatomy and proportion; [DURER] Four Books", correction_strategy=( "Use: 'Quattrocento facial features, period-typical physiognomy, " "Vitruvian body proportions, faces with characteristic period beauty: " "high forehead, straight nose, small mouth, almond eyes'" ), ), ModelFailureAnalysis( model="SDXL / SDXL-Turbo", failure_category="DRAPERY", specific_failure=( "Drapery either too photorealistic (looks like photographed fabric) " "or stylistically incongruent (modern fashion illustration style). " "No understanding of the weight and gathering system of period clothing." ), principle_violated=( "[VINCI Tr.Ch.143-148] 'Draperies must go gently over, describing " "the parts, but not with lines across cutting the members with hard notches.' " "[CENNINI Ch.163] drapery modeling technique" ), source_citation="[VINCI Tr.Ch.143-148]; [CENNINI Ch.163]", correction_strategy=( "Use: 'heavy wool drapery falling in weighted geometric folds, " "gathering at joints and compressed areas, " "reflecting body form beneath without revealing it, " "painted drapery in tempera cross-hatch technique'" ), ), ModelFailureAnalysis( model="SDXL / SDXL-Turbo", failure_category="PERSPECTIVE AND SPACE", specific_failure=( "Often generates correct single-point perspective but with " "photographic depth of field (blurred backgrounds). " "Foreground blur is not a Renaissance concept. " "Also fails at Quattrocento tilted ground plane (pre-High-Renaissance)." ), principle_violated=( "[ALBERTI De Pictura Bk.I] mathematical perspective is SHARP throughout, " "no atmospheric falloff in aerial perspective except at very great distance. " "Every detail in a close building is equally clear at that distance." ), source_citation="[ALBERTI De Pictura]; [VINCI Tr.Ch.112-127] linear perspective", correction_strategy=( "Use: 'mathematically constructed single-point perspective, " "no depth of field blur, equal clarity at all distances within frame, " "architectural recession to single vanishing point'" ), ), ] FLUX_FAILURES: List[ModelFailureAnalysis] = [ ModelFailureAnalysis( model="Flux.1 (Black Forest Labs)", failure_category="HISTORICAL ACCURACY", specific_failure=( "Flux generates more coherent images than SDXL but with a " "contemporary 'art school' aesthetic. The faces are modern. " "The light is photographic studio quality. " "The 'Renaissance' is a costume, not an understanding." ), principle_violated=( "[VASARI] 'maniera' — the distinctive character of period style " "is holistic: proportion, light, palette, surface, subject. " "Cannot be applied as a veneer." ), source_citation="[VASARI Lives, Preface to Second Part]; [CENNINI passim]", correction_strategy=( "Multi-layer specificity required: specify period, region, " "specific artist influence, medium, palette, and subject simultaneously." ), ), ModelFailureAnalysis( model="Flux.1 (Black Forest Labs)", failure_category="PAINTED TEXTURE", specific_failure=( "Flux treats 'painting' as a visual style modifier on photorealistic content. " "The result looks like a photograph with a 'painting' post-process filter. " "There is no understanding of paint as a physical substance with " "its own optical properties (glazing, scattering, absorption)." ), principle_violated=( "[CENNINI] Each pigment described as a physical substance " "with specific optical behavior: vermilion is opaque and dense, " "red lake is transparent and glowing, terre verte is thin and grey." ), source_citation="[CENNINI Ch.37-70] pigment by pigment description", correction_strategy=( "Add specific paint quality descriptors: " "'transparent red lake glaze', 'opaque lead white impasto', " "'thin terre verte underpainting shows through'" ), ), ModelFailureAnalysis( model="Flux.1 (Black Forest Labs)", failure_category="REGIONAL STYLE", specific_failure=( "Flux generates a generic 'Italian Renaissance' that conflates " "Florentine disegno, Venetian colore, and Sienese gold-ground styles. " "A Vasari/Ghiberti-educated artist would immediately identify the " "historical and regional incoherence." ), principle_violated=( "[VASARI] Sienese/Florentine/Venetian styles are fundamentally different " "in drawing priority, color relationships, spatial construction, " "and surface handling." ), source_citation="[VASARI Lives]; [VINCI Tr.] Florentine theory vs Venetian practice", correction_strategy=( "Always specify region. 'Florentine' = linear, hard, sculptural, " "sharp contour. 'Venetian' = warm, atmospheric, painterly, color priority. " "'Sienese' = gold ground, linear elegance, Byzantine inheritance." ), ), ModelFailureAnalysis( model="Flux.1 (Black Forest Labs)", failure_category="AGING AND TIME", specific_failure=( "Generates Renaissance art that looks freshly painted in 2024. " "No understanding of 500+ years of aging: craquelure, " "yellowed varnish, abraded paint layers, darkened shadows, " "inpainting visible under UV, gold abrasion at corners." ), principle_violated=( "Period authenticity requires visual evidence of age. " "A Leonardo looks different TODAY than it did in 1500 — " "the varnish has yellowed, the dark passages sunk, " "the azurite turned greenish." ), source_citation="Material aging of Renaissance pigments — documented conservation science", correction_strategy=( "Add aging descriptors: 'aged craquelure, yellowed varnish, " "slightly abraded high points, darkened shadows from oil oxidation, " "500 year old painting in museum condition'" ), ), ] # ═══════════════════════════════════════════════════════════════════ # SECTION IX: THE PROMPT GENERATION ENGINE # Synthesizes all principles into structured prompts. # ═══════════════════════════════════════════════════════════════════ class RenaissancePromptEngine: """ The core of the system. Takes a desired image specification and returns a positive prompt, negative prompt, and LoRA configuration derived from the Renaissance source texts. """ def __init__(self): self.palettes = PALETTES self.lighting = LIGHTING_SYSTEMS self.techniques = TECHNIQUE_DESCRIPTORS self.composition = COMPOSITION_PRINCIPLES # ───────────────────────────────────────────── # Primary prompt builder # ───────────────────────────────────────────── def build_prompt( self, subject: str, period: Period, region: Region, medium: Medium, lighting_key: str = "north_window", subject_type: Optional[Subject] = None, additional_context: str = "", artist_reference: str = "", include_aging: bool = True, ) -> Dict[str, str]: """ Returns {positive, negative, quality_booster, lora_tags, notes} """ # 1. Period + Region prefix period_phrase = self._period_region_phrase(period, region) # 2. Medium descriptor medium_desc = self._medium_phrase(medium) # 3. Technique vocabulary tech = TECHNIQUE_DESCRIPTORS.get(medium) tech_terms = ", ".join(tech.prompt_terms) if tech else "" # 4. Palette palette_key = self._select_palette(period, region) palette = self.palettes.get(palette_key) palette_phrase = self._palette_phrase(palette) if palette else "" # 5. Lighting light = self.lighting.get(lighting_key, self.lighting["north_window"]) light_phrase = light.prompt_fragment # 6. Artist reference (if any) artist_phrase = f"in the style and manner of {artist_reference}, " if artist_reference else "" # 7. Composition phrase — match by subject_type value or name keywords comp_phrase = "" if subject_type: sv = subject_type.value.lower() for comp in self.composition: cname = comp.name.lower().replace(" ", "_") # Match sacred conversazione → altarpiece / devotional if sv in ("altarpiece", "devotional_image", "madonna_child") and "sacra" in cname: comp_phrase = comp.prompt_guidance break elif sv in ("portrait",) and "portrait" in cname: comp_phrase = comp.prompt_guidance break elif sv in ("annunciation",) and "annunciation" in cname: comp_phrase = comp.prompt_guidance break elif sv in ("sacred_narrative", "history_painting", "mythological") and "historia" in cname: comp_phrase = comp.prompt_guidance break # 8. Aging aging_phrase = "" if include_aging: aging_phrase = self._aging_phrase(medium, period) # 9. Vitruvian proportion if human figures proportion_phrase = "" if any(w in subject.lower() for w in [ "figure", "portrait", "saint", "madonna", "angel", "person", "man", "woman", "child", "apostle" ]): proportion_phrase = ( "anatomically correct Renaissance proportions, " "Vitruvian body canon, period-typical physiognomy, " "correct facial features for period and region, " ) # 10. Assemble positive prompt (deduplicate medium; strip empties) positive_parts = [] seen: set = set() for p in [ period_phrase, artist_phrase, subject, medium_desc, # human-readable: "egg tempera on gessoed wood panel" tech_terms, # prompt keywords — may overlap; filter below palette_phrase, light_phrase, proportion_phrase, comp_phrase, aging_phrase, additional_context, ]: cleaned = p.strip().rstrip(", ") if cleaned and cleaned not in seen: seen.add(cleaned) positive_parts.append(cleaned) positive = ", ".join(positive_parts) # 11. Negative prompt negative = self._build_negative(period, region, medium) # 12. Quality booster — terms that push toward old-master quality quality_booster = ( "masterwork, museum collection, highest quality Renaissance painting, " "expert execution, period-authentic, art historical accuracy" ) # 13. LoRA recommendations lora_tags = self._lora_recommendations(period, region, medium) # 14. Notes for the user notes = self._generate_notes(period, region, medium, lighting_key) return { "positive": positive, "negative": negative, "quality_booster": quality_booster, "full_positive": f"{quality_booster}, {positive}", "lora_tags": lora_tags, "notes": notes, } # ───────────────────────────────────────────── # Component phrase builders # ───────────────────────────────────────────── def _period_region_phrase(self, period: Period, region: Region) -> str: period_map = { Period.PROTO_RENAISSANCE: "proto-Renaissance Trecento Italian", Period.INTERNATIONAL_GOTHIC: "International Gothic late medieval Italian", Period.EARLY_FLORENTINE: "early Quattrocento Florentine", Period.EARLY_SIENESE: "early Quattrocento Sienese", Period.EARLY_VENETIAN: "early Quattrocento Venetian", Period.EARLY_NORTHERN: "early Flemish Netherlandish Renaissance", Period.QUATTROCENTO: "fifteenth century Italian Renaissance", Period.HIGH_RENAISSANCE: "High Renaissance Italian", Period.HIGH_VENETIAN: "High Venetian Renaissance", Period.NORTHERN_HIGH: "Northern Renaissance German-Flemish", Period.MANNERIST: "Italian Mannerist late Renaissance", } region_map = { Region.FLORENCE: "Florentine school", Region.SIENA: "Sienese school", Region.VENICE: "Venetian school", Region.ROME: "Roman school", Region.UMBRIA: "Umbrian school", Region.PADUA: "Paduan school", Region.MILAN: "Milanese school", Region.NETHERLANDS: "Flemish Netherlandish school", Region.GERMANY: "German school", } return ( f"{period_map.get(period, 'Renaissance')}, " f"{region_map.get(region, 'Italian school')}" ) def _medium_phrase(self, medium: Medium) -> str: medium_map = { Medium.EGG_TEMPERA_PANEL: "egg tempera on gessoed wood panel", Medium.EGG_TEMPERA_CANVAS: "egg tempera on linen", Medium.BUON_FRESCO: "buon fresco on lime plaster", Medium.FRESCO_SECCO: "fresco secco wall painting", Medium.OIL_ON_PANEL: "oil on oak panel", Medium.OIL_ON_CANVAS: "oil on linen canvas", Medium.TEMPERA_OIL_MIXED: "mixed tempera and oil glazes on panel", Medium.ILLUMINATION: "manuscript illumination on vellum", Medium.MOSAIC: "gold-ground mosaic with glass tesserae", } return medium_map.get(medium, "panel painting") def _palette_phrase(self, palette: Optional[PigmentPalette]) -> str: if not palette: return "" pigment_names = list(palette.pigments.keys())[:6] return ( f"palette restricted to historical pigments: " f"{', '.join(pigment_names)}, " f"{palette.characteristic_combination}" ) def _aging_phrase(self, medium: Medium, period: Period) -> str: # How old is this painting now? age_map = { Period.PROTO_RENAISSANCE: "700 years of aging", Period.INTERNATIONAL_GOTHIC: "600 years of aging", Period.EARLY_FLORENTINE: "600 years of aging", Period.EARLY_SIENESE: "600 years of aging", Period.EARLY_VENETIAN: "550 years of aging", Period.HIGH_RENAISSANCE: "520 years of aging", Period.HIGH_VENETIAN: "500 years of aging", Period.NORTHERN_HIGH: "500 years of aging", Period.MANNERIST: "470 years of aging", } age_str = age_map.get(period, "500 years of aging") medium_aging = { Medium.EGG_TEMPERA_PANEL: ( "fine craquelure network in gesso, slight abrasion of " "highest paint layers, slightly yellowed surface" ), Medium.BUON_FRESCO: ( "salt efflorescence damage, paint loss at giornata seams, " "slightly faded color, plaster crazing" ), Medium.OIL_ON_PANEL: ( "pronounced oak panel craquelure, yellowed oil varnish, " "darkened shadows, slight paint sinking in darks" ), Medium.OIL_ON_CANVAS: ( "canvas age-crinkle, pronounced oil craquelure, " "amber yellow varnish tone, canvas weave visible" ), } aging_detail = medium_aging.get( medium, "aged craquelure, yellowed varnish" ) return ( f"{age_str}, {aging_detail}, " f"museum conservation condition, authentic patina of age" ) def _select_palette(self, period: Period, region: Region) -> str: """Select the most appropriate palette key.""" if region == Region.SIENA and period in [ Period.PROTO_RENAISSANCE, Period.INTERNATIONAL_GOTHIC, Period.EARLY_SIENESE ]: return "trecento_sienese" elif region == Region.FLORENCE and period in [ Period.EARLY_FLORENTINE, Period.QUATTROCENTO ]: return "early_florentine" elif period == Period.HIGH_RENAISSANCE and region == Region.MILAN: return "high_florentine" elif region == Region.VENICE or period == Period.HIGH_VENETIAN: return "venetian_oil" elif region in [Region.NETHERLANDS, Region.GERMANY]: return "northern_oil" else: return "early_florentine" # sensible default def _build_negative( self, period: Period, region: Region, medium: Medium ) -> str: """ Generates a comprehensive negative prompt based on what is explicitly wrong for this period, region, and medium. """ # Universal Renaissance negatives universal_negatives = [ # Anachronistic colors "Prussian blue", "cobalt blue paint", "cadmium red", "cadmium yellow", "phthalo green", "viridian green", "titanium white", "zinc white", "fluorescent", "neon", "electric", # Modern technique "impasto brushwork", "impressionist", "expressionist", "abstract", "watercolor washes", "digital", "3D render", "CGI", # Wrong lighting "HDR", "overexposed", "rim lighting", "backlit", "studio photography", "cinematic lighting", "golden hour photography", "lens flare", # Modern content "modern clothing", "contemporary fashion", "denim", "t-shirt", "tattoos", "piercing", "smartphone", "modern architecture", # Technical errors "blurry", "out of focus", "depth of field blur", "bokeh", "watermark", "signature overlaid", "border", "frame", "bad anatomy", "extra fingers", "malformed hands", # Wrong aesthetic "anime", "manga", "cartoon", "comic book", "illustration style", "concept art", "fantasy art style", "video game", "photorealistic photograph", "stock photo", # Contemporary faces "modern facial features", "contemporary beauty standards", "high cheekbones modern style", "fashion model face", ] # Medium-specific negatives medium_negatives: List[str] = [] tech = TECHNIQUE_DESCRIPTORS.get(medium) if tech: medium_negatives = tech.anti_terms # Period-specific negatives period_negatives: List[str] = [] if period in [Period.PROTO_RENAISSANCE, Period.EARLY_SIENESE]: period_negatives = [ "deep spatial recession", "naturalistic landscape background", "three-dimensional space", "atmospheric perspective", "High Renaissance confidence of form" ] elif period == Period.HIGH_RENAISSANCE: period_negatives = [ "flat gold background", "Byzantine stiffness", "schematic space", "no atmospheric haze in landscape" ] # Region-specific negatives region_negatives: List[str] = [] if region == Region.VENICE: region_negatives = ["hard outlines", "flat color", "cool grey shadows"] elif region == Region.FLORENCE: region_negatives = ["loose brushwork", "warm atmospheric haze everywhere"] elif region in [Region.NETHERLANDS, Region.GERMANY]: region_negatives = ["sfumato blur", "Italian warm tonality", "soft edges"] all_negatives = ( universal_negatives + medium_negatives + period_negatives + region_negatives ) return ", ".join(all_negatives) def _lora_recommendations( self, period: Period, region: Region, medium: Medium ) -> Dict[str, Union[str, float]]: """ Recommendations for LoRA models if user is working with Stable Diffusion / ComfyUI / Automatic1111. """ recs: Dict[str, Union[str, float]] = {} # Core style LoRAs if period in [Period.HIGH_RENAISSANCE, Period.EARLY_FLORENTINE]: if region == Region.FLORENCE: recs["renaissance_florentine_lora"] = 0.8 recs["leonardo_da_vinci_style"] = 0.6 elif region == Region.VENICE: recs["venetian_painting_lora"] = 0.8 recs["titian_style_lora"] = 0.6 if period in [Period.EARLY_SIENESE, Period.PROTO_RENAISSANCE]: recs["sienese_gothic_lora"] = 0.85 recs["italian_gothic_panel_lora"] = 0.7 if region in [Region.NETHERLANDS, Region.GERMANY]: recs["flemish_painting_lora"] = 0.85 recs["eyck_style_lora"] = 0.5 # Medium LoRAs if medium == Medium.EGG_TEMPERA_PANEL: recs["tempera_technique_lora"] = 0.7 elif medium == Medium.BUON_FRESCO: recs["fresco_painting_lora"] = 0.75 elif medium in [Medium.OIL_ON_CANVAS, Medium.OIL_ON_PANEL]: recs["old_master_oil_lora"] = 0.65 return recs def _generate_notes( self, period: Period, region: Region, medium: Medium, lighting_key: str ) -> str: """ Human-readable notes explaining the choices made. """ return textwrap.dedent(f""" GENERATION NOTES: • Period: {period.value} — {self._period_notes(period)} • Region: {region.value} — {self._region_notes(region)} • Medium: {medium.value} — {self._medium_notes(medium)} • Lighting: {lighting_key} — {self.lighting.get(lighting_key, self.lighting['north_window']).source_description} CRITICAL TIPS: 1. If output looks too modern: increase negative prompt weight for 'modern facial features, photographic quality, HDR' 2. If surface looks wrong: add 'BREAK {self._medium_phrase(medium)}' to force medium specificity 3. If color is wrong: list specific pigment names in positive prompt 4. If lighting is wrong: specify exact light source position and quality """).strip() def _period_notes(self, period: Period) -> str: notes = { Period.PROTO_RENAISSANCE: "Gold grounds, Byzantine inheritance, Cimabue/Duccio/Giotto", Period.EARLY_FLORENTINE: "Linear perspective emerging, Masaccio, sculptural figures", Period.HIGH_RENAISSANCE: "Sfumato, Leonardo, Raphael, Michelangelo peak", Period.HIGH_VENETIAN: "Color dominates, Titian, warm imprimatura, canvas", Period.EARLY_NORTHERN: "Oil technique mastered, van Eyck jewel-like precision", Period.MANNERIST: "Artificial elegance, elongation, complex poses", } return notes.get(period, "Italian Renaissance tradition") def _region_notes(self, region: Region) -> str: notes = { Region.FLORENCE: "[VASARI] disegno paramount — drawing and sculptural form", Region.SIENA: "Gold tradition, linear elegance, Byzantine gold-ground legacy", Region.VENICE: "[VASARI] colore paramount — painterly, atmospheric, warm", Region.NETHERLANDS: "Oil technique, microscopic detail, jewel-like precision", Region.GERMANY: "Dürer's mathematical rigor, German expressiveness", } return notes.get(region, "Italian regional school") def _medium_notes(self, medium: Medium) -> str: notes = { Medium.EGG_TEMPERA_PANEL: "[CENNINI] Cross-hatch only, no blending, matte surface", Medium.BUON_FRESCO: "[CENNINI] Wall-bound, giornata seams, chalky and matte", Medium.OIL_ON_PANEL: "Flemish: enamel-like; Italian: some sfumato possible", Medium.OIL_ON_CANVAS: "Venetian innovation c.1490, warm ground, impasto lights", } return notes.get(medium, "Period-appropriate painted surface") # ═══════════════════════════════════════════════════════════════════ # SECTION X: LORA TRAINING SPECIFICATION # What a proper Renaissance LoRA dataset should look like. # ═══════════════════════════════════════════════════════════════════ @dataclass class LoRATrainingSpec: """ Specification for training a Renaissance-specific LoRA that actually encodes the correct principles. """ # Dataset requirements min_images: int = 500 recommended_images: int = 2000 max_images: int = 5000 # Captioning schema caption_schema: Dict[str, str] = field(default_factory=lambda: { "required_fields": ( "period, region, medium, artist (if known), subject, " "lighting, palette_notes, surface_quality" ), "example_caption": ( "egg tempera on gessoed poplar panel, early Quattrocento Florentine, " "circle of Fra Angelico, sacra conversazione altarpiece, " "single north window soft lighting, ultramarine and gold leaf palette, " "terre verte underpaint in flesh areas, burnished gold leaf haloes, " "cross-hatched brushwork modeling, matte chalky surface quality, " "600 years of aging, fine craquelure, museum condition" ), }) # Architecture recommendation base_model: str = "Stable Diffusion XL 1.0 (for capacity) or SD 1.5 (for speed)" network_rank: int = 64 # Higher = more capacity, needed for complex style network_alpha: int = 32 learning_rate: float = 1e-4 text_lr: float = 5e-5 unet_lr: float = 1e-4 steps: int = 3000 batch_size: int = 4 resolution: str = "1024x1024 for SDXL, 512x512 for SD1.5" # Training data requirements data_requirements: List[str] = field(default_factory=lambda: [ "All images must be verified period-authentic museum photographs", "No modern reproductions or copies trained on modern media", "Each period should be trained SEPARATELY (separate LoRAs per period)", "Each medium should be trained separately for surface accuracy", "Images should be photographed under even, non-dramatic museum lighting", "No contemporary restorations without noting them in captions", "Include detail crops at 1:1 (brushwork visible) AND full compositions", "Color calibration: each image should match museum color space (sRGB)", ]) # Training curricula — order matters training_order: List[str] = field(default_factory=lambda: [ "Phase 1: Train on surface texture alone — all works same medium", "Phase 2: Add period palette information to captions", "Phase 3: Add lighting and compositional information", "Phase 4: Fine-tune on specific artist works (highest quality subset)", "Phase 5: Validation against negative examples (reject modern anachronisms)", ]) # Per-LoRA recommendations recommended_loras: List[Dict] = field(default_factory=lambda: [ { "name": "renaissance_tempera_surface", "focus": "Egg tempera surface quality: cross-hatch, matte, chalky", "images": "800 detail crops from Uffizi, National Gallery tempera works", "network_rank": 64, "trigger": "egg tempera painting style, tempera technique, " "quattrocento panel painting", }, { "name": "renaissance_florentine_quattrocento", "focus": "Florentine 1420-1480 complete style package", "images": "1200 works: Fra Angelico, Domenico Veneziano, Uccello, Castagno", "network_rank": 64, "trigger": "early florentine quattrocento style, disegno florentino", }, { "name": "renaissance_sienese_goldground", "focus": "Sienese gold-ground altarpieces, Byzantine linearity", "images": "600 Sienese works from 1280-1430", "network_rank": 32, "trigger": "sienese gold ground altarpiece, sienese trecento", }, { "name": "renaissance_high_florentine", "focus": "Leonardo sfumato, Raphael grace, High Renaissance", "images": "1500 works 1490-1530", "network_rank": 64, "trigger": "high renaissance italian style, sfumato technique, " "leonardesque chiaroscuro", }, { "name": "renaissance_venetian", "focus": "Venetian colorism, canvas texture, warm palette", "images": "1200 Bellini through Titian works", "network_rank": 64, "trigger": "venetian renaissance style, tiziano technique, " "venetian colorism, colore veneziano", }, { "name": "renaissance_flemish", "focus": "Flemish oil, jewel-like precision, northern style", "images": "1000 works van Eyck through Memling", "network_rank": 32, "trigger": "flemish renaissance oil painting, ars nova technique, " "eyckian precision", }, { "name": "renaissance_fresco", "focus": "Fresco surface quality, giornata seams, matte wall painting", "images": "700 detail photographs of authenticated frescoes", "network_rank": 32, "trigger": "buon fresco mural painting, fresco technique, " "lime plaster wall painting", }, ]) def as_training_config_json(self) -> str: """Returns a JSON config compatible with kohya-ss training.""" config = { "network_module": "networks.lora", "network_dim": self.network_rank, "network_alpha": self.network_alpha, "unet_lr": self.unet_lr, "text_encoder_lr": self.text_lr, "lr_scheduler": "cosine_with_restarts", "lr_warmup_steps": 100, "train_batch_size": self.batch_size, "max_train_steps": self.steps, "mixed_precision": "bf16", "gradient_checkpointing": True, "save_precision": "fp16", "save_every_n_steps": 500, "logging_dir": "./logs/renaissance_lora", "output_name": "renaissance_ai_lora", "caption_extension": ".txt", "resolution": self.resolution.split(" ")[0], "flip_aug": False, # Do NOT flip — many compositions directional "color_aug": False, # Do NOT color-aug — palette is the point "min_snr_gamma": 5, "noise_offset": 0.05, } return json.dumps(config, indent=2) # ═══════════════════════════════════════════════════════════════════ # SECTION XI: COMPLETE SYSTEM — RenaissanceAI # ═══════════════════════════════════════════════════════════════════ class RenaissanceAI: """ The top-level interface. Usage: ai = RenaissanceAI() # Generate a prompt result = ai.generate( subject="Madonna and Child enthroned with Saints Peter and Paul", period=Period.EARLY_FLORENTINE, region=Region.FLORENCE, medium=Medium.EGG_TEMPERA_PANEL, artist_reference="Fra Angelico", ) print(result['full_positive']) print(result['negative']) # Get failure analysis ai.print_failure_analysis("SDXL") # Get training spec spec = ai.get_training_spec() """ def __init__(self): self.engine = RenaissancePromptEngine() self.training = LoRATrainingSpec() def generate( self, subject: str, period: Period = Period.HIGH_RENAISSANCE, region: Region = Region.FLORENCE, medium: Medium = Medium.EGG_TEMPERA_PANEL, lighting: str = "north_window", subject_type: Optional[Subject] = None, artist_reference: str = "", include_aging: bool = True, additional_context: str = "", ) -> Dict[str, str]: return self.engine.build_prompt( subject=subject, period=period, region=region, medium=medium, lighting_key=lighting, subject_type=subject_type, additional_context=additional_context, artist_reference=artist_reference, include_aging=include_aging, ) def print_failure_analysis(self, model: str = "ALL") -> None: """Print the documented failure analysis for a given model.""" failures = [] if model.upper() in ["SDXL", "ALL"]: failures += SDXL_FAILURES if model.upper() in ["FLUX", "ALL"]: failures += FLUX_FAILURES print(f"\n{'═'*72}") print(f" RENAISSANCE AI — Failure Analysis: {model}") print(f" Based on primary source principles from Cennini, da Vinci,") print(f" Alberti, Vitruvius, Dürer, Ghiberti, Vasari") print(f"{'═'*72}\n") for i, f in enumerate(failures, 1): print(f"[{i}] {f.model} — {f.failure_category}") print(f" Failure: {f.specific_failure[:120]}...") print(f" Principle: {f.principle_violated[:100]}...") print(f" Source: {f.source_citation}") print(f" Fix: {f.correction_strategy[:120]}...") print() def get_training_spec(self) -> LoRATrainingSpec: return self.training def compare_approaches( self, subject: str, ) -> Dict[str, Dict]: """ Shows how generic vs. source-informed prompting differs. """ # What SDXL/Flux users typically write generic = { "positive": f"Renaissance painting of {subject}, oil painting, masterpiece", "negative": "bad quality, ugly", "verdict": "FAILS: No period, region, medium, palette, or technique specified", } # What this system produces informed = self.generate( subject=subject, period=Period.HIGH_RENAISSANCE, region=Region.FLORENCE, medium=Medium.TEMPERA_OIL_MIXED, lighting="north_window", artist_reference="Leonardo da Vinci", include_aging=True, ) informed["verdict"] = ( "SUCCEEDS: Period, region, medium, palette, lighting, " "technique, and aging all specified from primary sources" ) return {"generic_approach": generic, "source_informed": informed} def print_palette_analysis(self, palette_key: str) -> None: """Print detailed analysis of a historical palette.""" palette = PALETTES.get(palette_key) if not palette: print(f"Palette '{palette_key}' not found.") return print(f"\n{'─'*60}") print(f"PALETTE: {palette.name}") print(f"Period: {palette.period.value}") print(f"{'─'*60}") print("\nAVAILABLE PIGMENTS:") for pig_name, pig_desc in palette.pigments.items(): print(f" • {pig_name:<20} {pig_desc}") print("\nFORBIDDEN (anachronistic):") for f in palette.forbidden: print(f" ✗ {f}") print(f"\nCHARACTERISTIC COMBINATION:") print(f" {palette.characteristic_combination}") def quick_presets(self) -> Dict[str, Dict]: """ Ready-to-use preset configurations for common use cases. """ return { "florentine_altarpiece": dict( period=Period.EARLY_FLORENTINE, region=Region.FLORENCE, medium=Medium.EGG_TEMPERA_PANEL, lighting="gold_background", artist_reference="Fra Angelico", ), "leonardo_portrait": dict( period=Period.HIGH_RENAISSANCE, region=Region.MILAN, medium=Medium.TEMPERA_OIL_MIXED, lighting="north_window", artist_reference="Leonardo da Vinci", ), "sienese_madonna": dict( period=Period.EARLY_SIENESE, region=Region.SIENA, medium=Medium.EGG_TEMPERA_PANEL, lighting="gold_background", artist_reference="Sassetta", ), "venetian_portrait": dict( period=Period.HIGH_VENETIAN, region=Region.VENICE, medium=Medium.OIL_ON_CANVAS, lighting="architectural_interior", artist_reference="Titian", ), "flemish_detail": dict( period=Period.EARLY_NORTHERN, region=Region.NETHERLANDS, medium=Medium.OIL_ON_PANEL, lighting="north_window", artist_reference="Jan van Eyck", ), "high_fresco": dict( period=Period.HIGH_RENAISSANCE, region=Region.ROME, medium=Medium.BUON_FRESCO, lighting="architectural_interior", artist_reference="Raphael", ), } # ═══════════════════════════════════════════════════════════════════ # SECTION XII: ADDITIONAL FINE-GRAINED DESCRIPTORS # Specific vocabulary extracted from primary sources for the most # common failure points in AI generation. # ═══════════════════════════════════════════════════════════════════ FLESH_RENDERING_SYSTEM: Dict[str, Dict[str, str]] = { # [CENNINI Ch.67] "For painting flesh in tempera, take three # little brushes of minever... The first should be a dark one..." # [VINCI Tr.Ch.194-196] extensive discussion of flesh color management "tempera_flesh": { "step_1_underpainting": ( "[CENNINI Ch.67] terre verte (grey-green earth) thin wash over all " "flesh areas — this creates the characteristic grey-green shadow zones" ), "step_2_middle_tone": ( "pink-ochre mixture (vermilion + lead white + yellow ochre), " "applied in parallel hatched strokes" ), "step_3_lights": ( "pure lead white added to mixture, strokes become finer and more " "parallel, applied on forehead, nose, chin, cheekbone" ), "step_4_shadows": ( "thin transparent raw sienna and red lake glaze into shadow, " "terre verte visible through thin paint adds blue-green cast" ), "prompt_phrase": ( "terre verte grey-green underpaint visible in shadow zones of flesh, " "warm ochre-pink mid-tones, cool chalky lead white highlights, " "cross-hatched brushstroke modeling of flesh forms" ), }, "oil_flesh_north": { "prompt_phrase": ( "cool pearlescent flesh tones, cool grey-blue shadows in flesh, " "brilliant lead white highlights on nose forehead and cheekbone, " "subtle grey-violet at jaw and temple, warm ochre at cheek and lip" ), }, "oil_flesh_italian": { # [VINCI Tr.Ch.249] "The window must be open to the sky... the summertime # is the best, when the clouds conceal the sun" "prompt_phrase": ( "sfumato-modeled flesh with imperceptible shadow transitions, " "warm ochre-rose in lit zones, cool grey-green in shadow, " "reflected light filling all shadow areas, no pure dark in flesh" ), }, "oil_flesh_venetian": { "prompt_phrase": ( "warm golden flesh with amber mid-tones, " "warm brown-ochre shadows rather than cool grey, " "thick impasto in highlighted areas of cheek and forehead, " "deeply glazed transparent warm darks" ), }, } GOLD_SYSTEM: Dict[str, str] = { # [CENNINI Ch.86-108] Complete gold-leaf technique description "background": ( "flat burnished 23-carat gold leaf on gesso bole, " "reflecting light rather than glowing, " "punch-tooled ornamental border at picture frame, " "granular warm metallic gold, not chromatic yellow" ), "halo": ( "circular flat burnished gold leaf halo, " "punched punchwork pattern border (ring of dots or flowers), " "pastiglia raised ornamental border, " "no glow effect, no luminescence, not a ring of light, " "flat gold disk with punched decoration" ), "brocade": ( "gold-brocade fabric with raised gold leaf pattern, " "punched gold leaf applied over red or blue bole ground, " "alternating matt and burnished gold for pattern" ), } ARCHITECTURAL_BACKGROUNDS: Dict[str, str] = { # [VITRUV Bk.I Ch.1-2] [ALBERTI] period-appropriate architecture "quattrocento_loggia": ( "Brunelleschian loggia background with rounded arches on slender " "columns, Corinthian capitals, grey pietra serena stone, white plaster, " "mathematical single-point perspective recession, " "shallow garden or landscape visible through arcade" ), "sienese_abstract": ( "simplified architectural setting suggesting space without deep recession, " "gold or blue ground behind architectural frame elements, " "schematic space rather than illusionistic" ), "venetian_landscape": ( "warm atmospheric landscape background through window, " "atmospheric haze blurring distant hills, " "warm golden light on distant water and buildings, " "Venetian lagoon or terraferma landscape" ), "northern_interior": ( "Flemish domestic interior visible through round-arched window, " "detailed landscape with Flemish lowland scenery, " "carved wooden furniture, patterned floor tiles in perspective, " "every surface detail equally sharp (no depth of field)" ), "high_renaissance_apse": ( "classical apse with coffered half-dome, pilasters flanking, " "niches with classical statuary, marble revetment, " "single-point perspective vanishing behind central figure" ), } # ═══════════════════════════════════════════════════════════════════ # CLI / DEMO INTERFACE # ═══════════════════════════════════════════════════════════════════ def demo_output(ai: RenaissanceAI) -> None: """Demonstrate the system with several representative examples.""" examples = [ { "title": "FLORENTINE ALTARPIECE (Fra Angelico style)", "subject": "Madonna and Child enthroned with Saints Francis and Dominic, " "two kneeling angel musicians at the throne base", "kwargs": dict( period=Period.EARLY_FLORENTINE, region=Region.FLORENCE, medium=Medium.EGG_TEMPERA_PANEL, lighting="gold_background", artist_reference="Fra Angelico", subject_type=Subject.ALTARPIECE, ) }, { "title": "LEONARDO PORTRAIT (Sfumato technique)", "subject": "three-quarter portrait of a young noblewoman with dark hair, " "wearing dark silk dress with embroidered neckline, " "hands folded, soft atmospheric background", "kwargs": dict( period=Period.HIGH_RENAISSANCE, region=Region.MILAN, medium=Medium.TEMPERA_OIL_MIXED, lighting="north_window", artist_reference="Leonardo da Vinci", subject_type=Subject.PORTRAIT, ) }, { "title": "VENETIAN MYTHOLOGICAL (Titian style)", "subject": "Venus and Adonis, reclining Venus in golden landscape, " "Adonis departing with hunting dogs", "kwargs": dict( period=Period.HIGH_VENETIAN, region=Region.VENICE, medium=Medium.OIL_ON_CANVAS, lighting="landscape_diffused", artist_reference="Titian", subject_type=Subject.MYTHOLOGICAL, ) }, { "title": "FLEMISH PORTRAIT (van Eyck style)", "subject": "three-quarter portrait of a wealthy merchant, " "fur-trimmed robe, hands on parapet, " "window with Flemish landscape behind", "kwargs": dict( period=Period.EARLY_NORTHERN, region=Region.NETHERLANDS, medium=Medium.OIL_ON_PANEL, lighting="north_window", artist_reference="Jan van Eyck", subject_type=Subject.PORTRAIT, ) }, ] separator = "─" * 72 print(f"\n{'═'*72}") print(" RENAISSANCE AI — Demonstration Output") print(" All principles sourced from Cennini, da Vinci, Alberti,") print(" Vitruvius, Dürer, Ghiberti, Vasari") print(f"{'═'*72}") for ex in examples: result = ai.generate(subject=ex["subject"], **ex["kwargs"]) print(f"\n{separator}") print(f" {ex['title']}") print(f"{separator}") print(f"\n📋 POSITIVE PROMPT:") # Wrap at 70 chars for line in textwrap.wrap(result["full_positive"], 70): print(f" {line}") print(f"\n🚫 NEGATIVE PROMPT:") neg_short = result["negative"][:400] + "..." if len(result["negative"]) > 400 else result["negative"] for line in textwrap.wrap(neg_short, 70): print(f" {line}") if result.get("lora_tags"): print(f"\n🎛 LORA RECOMMENDATIONS:") for lora_name, weight in result["lora_tags"].items(): print(f" <lora:{lora_name}:{weight}>") print(f"\n{result['notes']}") def print_model_analysis() -> None: ai = RenaissanceAI() print("\n") ai.print_failure_analysis("ALL") def print_palette_guide() -> None: ai = RenaissanceAI() print(f"\n{'═'*72}") print(" HISTORICAL PALETTE GUIDE") print(f"{'═'*72}") for key in PALETTES: ai.print_palette_analysis(key) # ═══════════════════════════════════════════════════════════════════ # ENTRY POINT # ═══════════════════════════════════════════════════════════════════ if __name__ == "__main__": import sys ai = RenaissanceAI() if "--failures" in sys.argv: model = "ALL" for arg in sys.argv: if arg.upper() in ["SDXL", "FLUX"]: model = arg.upper() print_model_analysis() elif "--palettes" in sys.argv: print_palette_guide() elif "--training" in sys.argv: spec = ai.get_training_spec() print("\nLORA TRAINING CONFIGURATION (kohya-ss compatible JSON):") print(spec.as_training_config_json()) print("\nRECOMMENDED LORA DATASETS:") for lora in spec.recommended_loras: print(f"\n {lora['name']}") print(f" Focus: {lora['focus']}") print(f" Images: {lora['images']}") print(f" Rank: {lora['network_rank']}") print(f" Trigger: {lora['trigger']}") elif "--compare" in sys.argv: subject = " ".join(sys.argv[sys.argv.index("--compare") + 1:]) or "Madonna and Child" comparison = ai.compare_approaches(subject) print("\n" + "═"*72) print(f"COMPARISON: Generic vs Source-Informed Prompting") print("═"*72) print("\n[GENERIC — what most users write]:") print(f" POSITIVE: {comparison['generic_approach']['positive']}") print(f" NEGATIVE: {comparison['generic_approach']['negative']}") print(f" VERDICT: {comparison['generic_approach']['verdict']}") print("\n[SOURCE-INFORMED — what this system generates]:") pos = comparison['source_informed']['full_positive'] for line in textwrap.wrap(pos, 70): print(f" {line}") print(f"\n VERDICT: {comparison['source_informed']['verdict']}") else: demo_output(ai)
Content is user-generated and unverified.
    Renaissance AI Art Generation System | Claude