329 lines
17 KiB
Go
329 lines
17 KiB
Go
package artifact
|
||
|
||
import (
|
||
"crypto/sha256"
|
||
"encoding/binary"
|
||
"fmt"
|
||
"strings"
|
||
)
|
||
|
||
const collectionPresetRaccoon = "raccoon_full_art_v1"
|
||
|
||
const characterAnchorPrompt = `Create the canonical character reference for an original collectible-art series.
|
||
|
||
CANONICAL CHARACTER — LOCK THIS IDENTITY:
|
||
Create one original anthropomorphic silver-gray raccoon named RIFT.
|
||
Permanent visual features:
|
||
- charcoal-black raccoon eye mask with a clean, recognizable shape
|
||
- creamy white muzzle, cheeks and chest
|
||
- large expressive amber-gold eyes
|
||
- small rounded ears; one tiny notch in the RIGHT ear
|
||
- short broad muzzle and a subtle confident half-smile
|
||
- oversized head with compact athletic humanoid proportions
|
||
- thick striped raccoon tail with exactly five dark rings
|
||
- soft sculpted stylized fur clumps, never photographic fur
|
||
- friendly, clever, confident personality
|
||
|
||
WARDROBE FOR THE ANCHOR ONLY:
|
||
A simple charcoal utility overshirt with no logos, no writing and no theme-specific accessories. Keep the outfit neutral so future images can replace it completely.
|
||
|
||
COMPOSITION:
|
||
Vertical 3/4 character portrait, full torso and most of the tail visible, neutral elegant studio background, clean readable silhouette, centered, no props obscuring the face or tail.
|
||
|
||
STYLE:
|
||
Neutral high-end stylized 3D character illustration, deliberately non-photorealistic, premium animated-feature quality, rounded shapes, rich material detail, cinematic soft key light plus rim light, subtle depth of field, controlled color, polished collectible character reference. Keep the rendering neutral enough that future task-specific style references can deliberately restyle RIFT without changing his identity.
|
||
|
||
STRICT:
|
||
Exactly one raccoon character. No human face. No tiger features. No dreadlocks. No text, numbers, logo, trademark, watermark, card border, UI, duplicate character, photorealistic wildlife or realistic human anatomy.`
|
||
|
||
type themeProfile struct {
|
||
Name string
|
||
Outfit string
|
||
Accessories string
|
||
Scene string
|
||
Mood string
|
||
}
|
||
|
||
var collectionThemes = []themeProfile{
|
||
{
|
||
Name: "Neon Courier",
|
||
Outfit: "oversized midnight technical bomber, black utility vest with reflective piping, loose futuristic cargo trousers, high-top sneakers and fingerless gloves",
|
||
Accessories: "compact cross-body courier satchel and a translucent visor pushed above the eyes",
|
||
Scene: "rain-slick future city alley, glowing shop fronts, cables overhead, thin steam and floating light particles",
|
||
Mood: "energetic, adventurous and cool; electric night light with warm facial highlights",
|
||
},
|
||
{
|
||
Name: "Sakura Ronin",
|
||
Outfit: "layered modern ronin jacket, asymmetrical sash, armored fabric panels, tapered trousers and split-toe boots",
|
||
Accessories: "ornamental sheathed short sword worn as a costume prop, braided cord and a small lacquer charm",
|
||
Scene: "windy hill path beneath flowering cherry trees, distant lanterns and drifting petals at blue hour",
|
||
Mood: "calm, disciplined and cinematic with warm lantern rim light",
|
||
},
|
||
{
|
||
Name: "Lunar Botanist",
|
||
Outfit: "cream exploration suit with padded joints, soft graphite harness, compact boots and botanical specimen pockets",
|
||
Accessories: "clear bubble helmet carried under one arm and a glowing seed capsule",
|
||
Scene: "moon greenhouse with alien plants, curved windows, pale regolith outside and tiny floating pollen motes",
|
||
Mood: "curious, serene and optimistic with silver-blue light and soft green bioluminescence",
|
||
},
|
||
{
|
||
Name: "Apex Racer",
|
||
Outfit: "sleek original motorsport suit with angular panels, quilted shoulders, racing gloves and lightweight boots; absolutely no real-world team branding",
|
||
Accessories: "custom unbranded racing helmet tucked at the hip and a small timing wrist display",
|
||
Scene: "futuristic pit lane after sunset, abstract light streaks, glossy track surface and atmospheric haze",
|
||
Mood: "focused, fast and triumphant with hard edge lighting and motion energy",
|
||
},
|
||
{
|
||
Name: "Sky Captain",
|
||
Outfit: "tailored deep-green flight coat, brass-toned fasteners, layered leather-like harness, high boots and a long scarf",
|
||
Accessories: "round aviator goggles on the forehead, miniature compass and folded flight chart",
|
||
Scene: "fantasy airship observation deck above glowing clouds, propeller silhouettes and warm sunrise",
|
||
Mood: "adventurous, noble and windswept with golden backlight",
|
||
},
|
||
{
|
||
Name: "Deep Salvager",
|
||
Outfit: "stylized pressure-diver jacket, segmented shoulder guards, flexible utility trousers and heavy magnetic boots",
|
||
Accessories: "compact breathing collar, antique-looking lamp and a small salvage pouch",
|
||
Scene: "underwater ruin with rays of blue light, bubbles, coral growth, old machinery and drifting particles",
|
||
Mood: "mysterious, brave and exploratory with teal caustics and warm lamp glow",
|
||
},
|
||
{
|
||
Name: "Rooftop Skater",
|
||
Outfit: "oversized graphic-free hoodie under a cropped windbreaker, wide technical pants, knee pads and chunky skate shoes",
|
||
Accessories: "original blank skateboard with abstract geometric deck art and wireless headphones around the neck",
|
||
Scene: "sunset rooftop skate spot, concrete shapes, distant skyline, spray mist and long shadows",
|
||
Mood: "playful, rebellious and relaxed with saturated sunset gradients",
|
||
},
|
||
{
|
||
Name: "Arcane Archivist",
|
||
Outfit: "layered indigo scholar robe, structured vest, embroidered star-map patterns without readable glyphs, soft boots and fingerless reading gloves",
|
||
Accessories: "floating crystal lens, chained key and a closed oversized book with no text on the cover",
|
||
Scene: "towering fantasy archive, suspended shelves, luminous dust and circular windows showing a starry sky",
|
||
Mood: "wise, curious and magical with violet-gold volumetric light",
|
||
},
|
||
{
|
||
Name: "Desert Nomad",
|
||
Outfit: "sand-colored hooded field jacket, layered scarf, reinforced trousers, wrapped boots and lightweight shoulder guards",
|
||
Accessories: "goggles hanging at the collar, water canteen and a compact navigation device",
|
||
Scene: "vast stylized dunes around a half-buried futuristic relay station, windblown dust and distant heat shimmer",
|
||
Mood: "resilient, solitary and heroic with warm amber sunlight and cool shadow fill",
|
||
},
|
||
{
|
||
Name: "Harbor Corsair",
|
||
Outfit: "navy captain coat with exaggerated collar, striped sash, fitted waistcoat, weathered trousers and tall deck boots",
|
||
Accessories: "ornamental brass spyglass, rope bracelet and a broad captain hat with no insignia",
|
||
Scene: "fantasy harbor at dawn, stylized sailing vessel, gull silhouettes, rolling mist and bright spray",
|
||
Mood: "mischievous, bold and charismatic with crisp sea light",
|
||
},
|
||
{
|
||
Name: "Alpine Rider",
|
||
Outfit: "bright technical snow jacket, insulated bib trousers, soft neck gaiter, mittens and oversized snowboard boots",
|
||
Accessories: "reflective snow goggles lifted above the eyes and a custom blank snowboard with geometric patterning",
|
||
Scene: "high alpine ridge after fresh snowfall, powder plume, distant peaks and sparkling ice crystals",
|
||
Mood: "joyful, fearless and fresh with clean winter sunlight and blue shadows",
|
||
},
|
||
{
|
||
Name: "Noir Detective",
|
||
Outfit: "charcoal trench coat over a fitted waistcoat and shirt, narrow tie, tailored trousers and polished ankle boots",
|
||
Accessories: "soft-brim hat, small notebook with blank pages and an old-fashioned camera",
|
||
Scene: "stylized rainy midnight street, glowing windows, puddle reflections, fog and dramatic architectural shadows",
|
||
Mood: "clever, suspicious and composed with high-contrast noir lighting plus a single warm practical light",
|
||
},
|
||
{
|
||
Name: "Jungle Soundmaster",
|
||
Outfit: "bold woven-pattern jacket, relaxed dark trousers, colorful knit cap and layered fabric wristbands; original patterns only",
|
||
Accessories: "large studio headphones, portable sampler with abstract unlabelled controls and bead accents",
|
||
Scene: "lush tropical night stage tucked into giant leaves, warm string lights, mist and floating firefly-like particles",
|
||
Mood: "musical, warm and charismatic with saturated green, gold and red accents",
|
||
},
|
||
{
|
||
Name: "Solar Guardian",
|
||
Outfit: "ceremonial cream-and-gold mantle over fitted plated fabric armor, broad belt, tapered trousers and soft armored boots",
|
||
Accessories: "floating sun-disc ornament, geometric shoulder charms and a staff-shaped decorative prop",
|
||
Scene: "monumental desert temple terrace, shafts of sunlight, drifting sand and abstract solar motifs",
|
||
Mood: "regal, radiant and protective with intense gold rim light and deep cyan shadows",
|
||
},
|
||
{
|
||
Name: "Retro Astronaut",
|
||
Outfit: "chunky retro-future space suit with rounded padding, orange utility tabs, ribbed joints and oversized moon boots",
|
||
Accessories: "dome helmet carried at the side, analog-style wrist module with no readable numbers and tether clips",
|
||
Scene: "colorful retro orbital station window, star field, distant planet and floating equipment shapes",
|
||
Mood: "wonder-filled, optimistic and iconic with soft cosmic blues and warm cabin light",
|
||
},
|
||
{
|
||
Name: "Storm Mechanic",
|
||
Outfit: "rolled-sleeve heavy work jacket, dark overalls, reinforced gloves, tool belt and rugged lace-up boots",
|
||
Accessories: "large wrench-shaped prop, protective goggles on the head and a compact diagnostic tablet with abstract graphics",
|
||
Scene: "open-air repair platform during an approaching electrical storm, turbine parts, sparks and rain mist",
|
||
Mood: "resourceful, gritty and confident with cool storm light and warm sparks",
|
||
},
|
||
}
|
||
|
||
var poseOptions = []string{
|
||
"standing in a relaxed three-quarter stance with one shoulder slightly forward",
|
||
"mid-step with a confident turn toward camera",
|
||
"leaning casually against a thematic prop while keeping the full facial mask visible",
|
||
"slightly crouched in an energetic ready pose with the tail creating a strong S-curve",
|
||
"standing upright with one hand adjusting an accessory and the other relaxed",
|
||
"heroic low-angle three-quarter pose, expressive but not aggressive",
|
||
}
|
||
|
||
var atmosphereOptions = []string{
|
||
"subtle floating particles and soft volumetric haze",
|
||
"small foreground elements crossing the lower frame for depth",
|
||
"gentle wind motion in fabric and fur",
|
||
"bright rim-light bloom plus restrained lens glow",
|
||
"layered foreground bokeh and crisp facial focus",
|
||
"tiny environmental sparks or motes that echo the outfit materials",
|
||
}
|
||
|
||
type collectionTraits struct {
|
||
ThemeName string `json:"theme"`
|
||
Outfit string `json:"outfit"`
|
||
Accessories string `json:"accessories"`
|
||
Scene string `json:"scene"`
|
||
Mood string `json:"mood"`
|
||
Pose string `json:"pose"`
|
||
Atmosphere string `json:"atmosphere"`
|
||
Rarity string `json:"rarity"`
|
||
AccentA string `json:"accent_a"`
|
||
AccentB string `json:"accent_b"`
|
||
EditionCode string `json:"edition_code"`
|
||
}
|
||
|
||
var accentPairs = [][2]string{
|
||
{"#79F7FF", "#7D6CFF"},
|
||
{"#FFB84D", "#FF5D8F"},
|
||
{"#9BFF9E", "#16D7C5"},
|
||
{"#F8E16C", "#D979FF"},
|
||
{"#6AE4FF", "#FF7AD9"},
|
||
{"#FFD36A", "#53A8FF"},
|
||
{"#B7FF6A", "#FF8A5B"},
|
||
{"#C7B2FF", "#6CFFD7"},
|
||
}
|
||
|
||
func deriveCollectionTraits(x win) collectionTraits {
|
||
h := sha256.Sum256([]byte(x.ID + "|" + x.Winner + "|" + x.Seed + "|" + x.Guess))
|
||
theme := collectionThemes[int(h[0])%len(collectionThemes)]
|
||
pair := accentPairs[int(h[1])%len(accentPairs)]
|
||
rarityRoll := binary.BigEndian.Uint16(h[2:4]) % 10000
|
||
rarity := "RARE"
|
||
switch {
|
||
case rarityRoll < 35:
|
||
rarity = "MYTHIC"
|
||
case rarityRoll < 260:
|
||
rarity = "LEGENDARY"
|
||
case rarityRoll < 1250:
|
||
rarity = "EPIC"
|
||
case rarityRoll < 4200:
|
||
rarity = "RARE"
|
||
default:
|
||
rarity = "SIGNATURE"
|
||
}
|
||
return collectionTraits{
|
||
ThemeName: theme.Name,
|
||
Outfit: theme.Outfit,
|
||
Accessories: theme.Accessories,
|
||
Scene: theme.Scene,
|
||
Mood: theme.Mood,
|
||
Pose: poseOptions[int(h[4])%len(poseOptions)],
|
||
Atmosphere: atmosphereOptions[int(h[5])%len(atmosphereOptions)],
|
||
Rarity: rarity,
|
||
AccentA: pair[0],
|
||
AccentB: pair[1],
|
||
EditionCode: strings.ToUpper(fmt.Sprintf("NH-%02X%02X-%02X%02X", h[6], h[7], h[8], h[9])),
|
||
}
|
||
}
|
||
|
||
func buildCollectionPrompt(x win, traits collectionTraits) string {
|
||
taskDirection := strings.TrimSpace(x.PromptInstructions)
|
||
if taskDirection == "" {
|
||
taskDirection = "No additional task-specific direction."
|
||
}
|
||
avoid := strings.TrimSpace(x.NegativePrompt)
|
||
if avoid == "" {
|
||
avoid = "No additional task-specific avoid list."
|
||
}
|
||
beaconDirection := "No Beacon Hunt trait for this winning card."
|
||
if strings.TrimSpace(x.BeaconPath) != "" {
|
||
match := "did not match the boosted path"
|
||
if strings.EqualFold(x.BeaconPath, x.BeaconBoostedPath) {
|
||
match = "matched the boosted path"
|
||
}
|
||
beaconDirection = fmt.Sprintf("Winning Beacon path: %s; boosted path: %s; drand round: %d; the chosen path %s. Translate this subtly into lighting, motion, particles or accessory accents. Do not render the path name or round as text.", x.BeaconPath, x.BeaconBoostedPath, x.BeaconRound, match)
|
||
}
|
||
return fmt.Sprintf(`Create one original premium full-art collectible character illustration.
|
||
|
||
REFERENCE IMAGES — SEPARATE IDENTITY FROM STYLE:
|
||
Image 1 is the canonical RIFT CHARACTER reference. Use Image 1 only to preserve identity: silver-gray raccoon species, charcoal eye-mask shape, creamy muzzle/chest, amber-gold eyes, right-ear notch, muzzle proportions, head-to-body proportions, five-ring tail and overall face identity. Do NOT treat Image 1's neutral wardrobe, background, lighting or rendering style as fixed.
|
||
Image 2 is the TASK STYLE reference. Use Image 2 only for visual language: rendering technique, shape language, material treatment, color behavior, lighting character, texture/detail level and overall illustration mood. Do NOT copy Image 2's subject, species, pose, clothing, cultural symbols, logos, text or composition literally.
|
||
Priority rule: identity comes from Image 1; visual style comes from Image 2; wardrobe/theme/scene come from this prompt. If the references conflict, preserve RIFT's identity first and adopt the style reference second.
|
||
|
||
SUBJECT:
|
||
RIFT, one anthropomorphic raccoon character. The character must remain unmistakably animal-like and deliberately stylized rather than realistic or human-faced.
|
||
|
||
THEME:
|
||
%s
|
||
|
||
CLOTHING — PRIMARY VARIABLE:
|
||
%s.
|
||
The clothing is the main collectible trait. It must instantly communicate the theme, look custom-tailored to RIFT, use premium materials and retain a clear silhouette. No logos or recognizable real-world brand marks.
|
||
|
||
ACCESSORIES:
|
||
%s.
|
||
|
||
SCENE:
|
||
%s.
|
||
|
||
POSE:
|
||
%s.
|
||
|
||
MOOD / LIGHTING:
|
||
%s.
|
||
|
||
ATMOSPHERE:
|
||
%s.
|
||
|
||
COMPOSITION:
|
||
Vertical 1024x1536 full-art composition. Exactly one dominant character occupying about 65–75%% of the frame. Three-quarter body view with the face and right-ear notch clearly visible and at least most of the striped tail visible. Put the eyes near the upper third. Use foreground/background layering and dynamic depth, but keep the silhouette immediately readable. Leave natural darker breathing room near the very top and bottom so a programmatic collectible-card overlay can remain legible.
|
||
|
||
VISUAL LANGUAGE — TASK STYLE HAS AUTHORITY:
|
||
Follow Image 2 decisively for the rendering language. Recreate its level of stylization, line/edge treatment, brushwork or surface treatment, material abstraction, shading model, texture density, palette behavior, lighting language and finish. The Task Style may be 3D-cartoon, cel-shaded, graphic comic, painterly, watercolor-like, clay/toy-like, low-poly, retro-game-inspired or another deliberately illustrated collectible-art language. Do NOT force RIFT back into the neutral 3D look of Image 1. Preserve the permanent identity markers from Image 1 while translating them naturally into Image 2's visual language. Keep the result premium, coherent, richly art-directed and clearly non-photorealistic.
|
||
|
||
FULL-ART ENERGY:
|
||
The environment should visually merge with the character through thematic particles, light, fabric motion, mist, sparks, petals, snow, dust or other scene-appropriate elements. Create many small visual discoveries while keeping RIFT instantly readable.
|
||
|
||
BEACON HUNT WIN TRAIT:
|
||
%s
|
||
|
||
TASK-SPECIFIC CREATIVE DIRECTION:
|
||
%s
|
||
|
||
TASK-SPECIFIC AVOID LIST:
|
||
%s
|
||
|
||
STRICT CONSTRAINTS:
|
||
Original character design only. Exactly one raccoon. No human face. No photorealistic wildlife. No card frame or UI inside the generated artwork. No readable words, letters, numbers, signatures, logos, trademarks or watermarks. No duplicate character. No extra tails. Tail must retain exactly five dark rings. Do not copy the style-reference subject or its clothing. Do not add random costume elements unrelated to the theme.
|
||
|
||
Deterministic creative fingerprint only, never render it as text: task=%s winner=%s difficulty=%d-bit seed=%s.`,
|
||
traits.ThemeName,
|
||
traits.Outfit,
|
||
traits.Accessories,
|
||
traits.Scene,
|
||
traits.Pose,
|
||
traits.Mood,
|
||
traits.Atmosphere,
|
||
beaconDirection,
|
||
taskDirection,
|
||
avoid,
|
||
shortHash(x.ID), shortHash(x.Winner), x.RangeBits, shortHash(x.Seed),
|
||
)
|
||
}
|
||
|
||
func collectionNegativePrompt(x win) string {
|
||
return joinPrompt(
|
||
"photorealistic, realistic wildlife, human face, human skin, duplicate character, two characters, extra tail, wrong tail rings, unreadable anatomy, malformed paws, text, letters, numbers, logo, trademark, watermark, signature, card border, UI, low detail, blur",
|
||
x.NegativePrompt,
|
||
)
|
||
}
|