{
  "workflow_info": {
    "name": "Cosmetic Layer Generator",
    "description": "Generate avatar cosmetic accessories, clothing, and decorations as separate layers",
    "version": "1.0.0",
    "author": "Lilith Platform",
    "category": "avatar",
    "tags": [
      "cosmetic",
      "accessory",
      "layer",
      "customization",
      "overlay"
    ],
    "estimated_time_seconds": 35,
    "gpu_requirement": "A5000"
  },
  "inputs": {
    "cosmetic_type": {
      "type": "enum",
      "options": [
        "headwear",
        "jewelry",
        "clothing",
        "wings",
        "aura_effect",
        "tattoo",
        "hair_accessory",
        "held_item",
        "background_element"
      ],
      "default": "jewelry",
      "description": "Type of cosmetic item to generate"
    },
    "headwear_style": {
      "type": "enum",
      "options": [
        "crown",
        "halo",
        "flower_crown",
        "turban",
        "hood",
        "headband",
        "third_eye_gem",
        "antlers",
        "horns_divine"
      ],
      "default": "halo",
      "description": "Style of headwear (if selected)"
    },
    "jewelry_style": {
      "type": "enum",
      "options": [
        "mala_beads",
        "crystal_pendant",
        "chakra_necklace",
        "earrings",
        "armlets",
        "rings",
        "nose_ring",
        "forehead_chain"
      ],
      "default": "mala_beads",
      "description": "Style of jewelry (if selected)"
    },
    "clothing_style": {
      "type": "enum",
      "options": [
        "cape",
        "shawl",
        "sash",
        "belt",
        "gloves",
        "sleeves",
        "collar",
        "vest"
      ],
      "default": "shawl",
      "description": "Style of clothing piece (if selected)"
    },
    "wings_style": {
      "type": "enum",
      "options": [
        "angel_feather",
        "butterfly",
        "energy_wings",
        "fairy",
        "dragon",
        "geometric",
        "light_wings"
      ],
      "default": "angel_feather",
      "description": "Style of wings (if selected)"
    },
    "material": {
      "type": "enum",
      "options": [
        "gold",
        "silver",
        "crystal",
        "fabric",
        "energy",
        "nature",
        "ethereal",
        "gemstone"
      ],
      "default": "gold",
      "description": "Primary material appearance"
    },
    "color_scheme": {
      "type": "enum",
      "options": [
        "chakra_specific",
        "white_gold",
        "cosmic_purple",
        "nature_green",
        "ocean_blue",
        "fire_red",
        "rainbow",
        "monochrome"
      ],
      "default": "white_gold",
      "description": "Color scheme for the cosmetic"
    },
    "chakra_target": {
      "type": "enum",
      "options": [
        "root",
        "sacral",
        "solar_plexus",
        "heart",
        "throat",
        "third_eye",
        "crown",
        "all"
      ],
      "default": "heart",
      "description": "Target chakra for chakra_specific color"
    },
    "glow_effect": {
      "type": "boolean",
      "default": true,
      "description": "Add glowing/luminescent effect"
    },
    "transparency": {
      "type": "enum",
      "options": [
        "solid",
        "translucent",
        "ethereal",
        "energy_only"
      ],
      "default": "solid",
      "description": "Transparency level"
    },
    "seed": {
      "type": "integer",
      "default": -1,
      "description": "Random seed"
    },
    "width": {
      "type": "integer",
      "default": 512,
      "description": "Output width"
    },
    "height": {
      "type": "integer",
      "default": 512,
      "description": "Output height"
    },
    "steps": {
      "type": "integer",
      "default": 30,
      "description": "Sampling steps"
    },
    "cfg_scale": {
      "type": "float",
      "default": 7.5,
      "description": "CFG scale"
    },
    "hires_fix": {
      "type": "boolean",
      "default": true,
      "description": "Two-pass detail refinement: 1.5x latent upscale + low-denoise second sampling pass"
    },
    "freeu": {
      "type": "boolean",
      "default": true,
      "description": "FreeU v2 backbone re-weighting (family-tuned b1/b2/s1/s2)"
    },
    "checkpoint": {
      "type": "enum",
      "options": [
        "dreamshaper_8",
        "sd15_base"
      ],
      "default": "dreamshaper_8",
      "description": "SD1.5 checkpoint: DreamShaper 8 finetune (default, baked VAE) or base 1.5"
    },
    "face_detail": {
      "type": "boolean",
      "default": true,
      "description": "Impact FaceDetailer detect-and-inpaint refinement pass on detected faces"
    }
  },
  "headwear_prompts": {
    "crown": "ornate spiritual crown, royal headpiece, gemstone studded, divine authority",
    "halo": "glowing circular halo, saint nimbus, divine light ring, golden disc",
    "flower_crown": "floral flower crown, natural blossoms, living garland, nature blessing",
    "turban": "wrapped turban headwear, spiritual covering, sacred cloth, wisdom symbol",
    "hood": "mystical hooded cowl, shadowed face, mystery shroud, sage covering",
    "headband": "decorated headband, forehead ornament, brow decoration, simple elegance",
    "third_eye_gem": "third eye gemstone, forehead jewel, bindi crystal, awareness symbol",
    "antlers": "divine antlers, deer spirit, nature crown, forest connection, shamanic",
    "horns_divine": "divine graceful horns, celestial being, cosmic power symbol, otherworldly"
  },
  "jewelry_prompts": {
    "mala_beads": "sacred mala prayer beads, 108 bead necklace, meditation rosary, mantra counter",
    "crystal_pendant": "crystal pendant necklace, gemstone hanging, healing stone, energy focus",
    "chakra_necklace": "chakra stone necklace, seven stones, rainbow alignment, energy balance",
    "earrings": "spiritual earrings, sacred symbols, dangling ornaments, ear decoration",
    "armlets": "decorative armlets, upper arm bands, warrior adornment, strength symbol",
    "rings": "sacred finger rings, multiple rings, spiritual symbols, hand decoration",
    "nose_ring": "delicate nose ring, nostril piercing, cultural tradition, subtle decoration",
    "forehead_chain": "forehead chain jewelry, tikka headpiece, brow decoration, bridal style"
  },
  "clothing_prompts": {
    "cape": "flowing spiritual cape, draped fabric, dramatic back, hero covering",
    "shawl": "soft shawl wrap, shoulder covering, comfort draping, gentle protection",
    "sash": "decorative sash belt, waist wrapping, rank symbol, color accent",
    "belt": "ornate belt, waist decoration, cinching detail, accessory piece",
    "gloves": "elegant spiritual gloves, hand covering, ceremonial, refined detail",
    "sleeves": "separate decorative sleeves, arm covering, flowing fabric, dance movement",
    "collar": "decorative collar piece, neck frame, formal accent, statement piece",
    "vest": "spiritual vest overlay, torso covering, layered look, additional detail"
  },
  "wings_prompts": {
    "angel_feather": "white feathered angel wings, bird wings, divine messenger, heavenly flight",
    "butterfly": "iridescent butterfly wings, transformation symbol, metamorphosis, delicate beauty",
    "energy_wings": "pure energy wings, light construct, no feathers, glowing outline",
    "fairy": "delicate fairy wings, gossamer thin, sparkling dust, magical flight",
    "dragon": "majestic dragon wings, leathery membrane, powerful span, mythic creature",
    "geometric": "sacred geometry wings, mathematical patterns, platonic shapes, cosmic design",
    "light_wings": "wings made of light rays, sun beams, divine radiance, illuminated"
  },
  "material_prompts": {
    "gold": "polished gold material, precious metal, warm shine, valuable",
    "silver": "gleaming silver material, moonlight metal, cool shine, lunar",
    "crystal": "clear crystal material, faceted gem, light refracting, precious stone",
    "fabric": "rich fabric material, silk or velvet, soft texture, flowing",
    "energy": "pure energy material, light construct, immaterial, glowing substance",
    "nature": "natural organic material, leaves wood flowers, earth-grown, living",
    "ethereal": "ethereal immaterial, ghostly translucent, spirit substance, otherworldly",
    "gemstone": "precious gemstone material, ruby emerald sapphire, jewel quality, valuable"
  },
  "chakra_colors": {
    "root": "deep red root chakra color, muladhara",
    "sacral": "orange sacral chakra color, svadhisthana",
    "solar_plexus": "yellow solar plexus color, manipura",
    "heart": "green or pink heart chakra color, anahata",
    "throat": "blue throat chakra color, vishuddha",
    "third_eye": "indigo third eye color, ajna",
    "crown": "violet or white crown chakra color, sahasrara",
    "all": "rainbow all chakra colors, full spectrum"
  },
  "color_prompts": {
    "white_gold": "white and gold colors, pure and precious, divine combination",
    "cosmic_purple": "cosmic purple violet, mystical deep colors, spiritual depth",
    "nature_green": "nature green colors, forest emerald, earth connection",
    "ocean_blue": "ocean blue colors, water element, deep sea, flowing",
    "fire_red": "fire red orange colors, flame element, passion energy",
    "rainbow": "full rainbow spectrum, all colors, prismatic, complete",
    "monochrome": "single color monochrome, elegant simplicity, tonal variation"
  },
  "nodes": {
    "1": {
      "class_type": "CheckpointLoaderSimple",
      "inputs": {
        "ckpt_name": "{{checkpoint_files[checkpoint]}}"
      },
      "outputs": [
        "MODEL",
        "CLIP",
        "VAE"
      ]
    },
    "2": {
      "class_type": "CLIPTextEncode",
      "inputs": {
        "text": "{{constructed_prompt}}",
        "clip": [
          "1",
          1
        ]
      },
      "outputs": [
        "CONDITIONING"
      ]
    },
    "3": {
      "class_type": "CLIPTextEncode",
      "inputs": {
        "text": "human face, body, person, ugly, low quality, blurry, text, watermark, complex background, multiple items",
        "clip": [
          "1",
          1
        ]
      },
      "outputs": [
        "CONDITIONING"
      ]
    },
    "4": {
      "class_type": "EmptyLatentImage",
      "inputs": {
        "width": "{{width}}",
        "height": "{{height}}",
        "batch_size": 1
      },
      "outputs": [
        "LATENT"
      ]
    },
    "5": {
      "class_type": "KSampler",
      "inputs": {
        "model": [
          "freeu",
          0
        ],
        "positive": [
          "2",
          0
        ],
        "negative": [
          "3",
          0
        ],
        "latent_image": [
          "4",
          0
        ],
        "seed": "{{seed}}",
        "steps": "{{steps}}",
        "cfg": "{{cfg_scale}}",
        "sampler_name": "dpmpp_2m_sde",
        "scheduler": "karras",
        "denoise": 1.0
      },
      "outputs": [
        "LATENT"
      ]
    },
    "6": {
      "class_type": "VAEDecode",
      "inputs": {
        "samples": [
          "hires_sampler",
          0
        ],
        "vae": [
          "1",
          2
        ]
      },
      "outputs": [
        "IMAGE"
      ]
    },
    "7": {
      "class_type": "RemoveBackground",
      "inputs": {
        "image": [
          "face_detailer",
          0
        ]
      },
      "outputs": [
        "IMAGE"
      ],
      "_comment": "Remove background for layering"
    },
    "8": {
      "class_type": "SaveImage",
      "inputs": {
        "images": [
          "7",
          0
        ],
        "filename_prefix": "cosmetic_layer"
      },
      "outputs": []
    },
    "freeu": {
      "class_type": "FreeU_V2",
      "inputs": {
        "model": [
          "1",
          0
        ],
        "b1": 1.3,
        "b2": 1.4,
        "s1": 0.9,
        "s2": 0.2
      },
      "outputs": [
        "MODEL"
      ],
      "_condition": "{{freeu}}",
      "_comment": "FreeU v2 with known-good sd15 parameters."
    },
    "hires_upscale": {
      "class_type": "LatentUpscaleBy",
      "inputs": {
        "samples": [
          "5",
          0
        ],
        "upscale_method": "bislerp",
        "scale_by": 1.5
      },
      "outputs": [
        "LATENT"
      ],
      "_condition": "{{hires_fix}}"
    },
    "hires_sampler": {
      "class_type": "KSampler",
      "inputs": {
        "model": [
          "freeu",
          0
        ],
        "positive": [
          "2",
          0
        ],
        "negative": [
          "3",
          0
        ],
        "latent_image": [
          "hires_upscale",
          0
        ],
        "seed": "{{seed}}",
        "steps": 14,
        "cfg": "{{cfg_scale}}",
        "sampler_name": "dpmpp_2m",
        "scheduler": "karras",
        "denoise": 0.45
      },
      "outputs": [
        "LATENT"
      ],
      "_condition": "{{hires_fix}}",
      "_condition_passthrough": "latent_image",
      "_comment": "Hires second pass: refine structure from the 1.5x upscaled latent."
    },
    "face_bbox": {
      "class_type": "UltralyticsDetectorProvider",
      "inputs": {
        "model_name": "bbox/face_yolov8m.pt"
      },
      "outputs": [
        "BBOX_DETECTOR",
        "SEGM_DETECTOR"
      ],
      "_condition": "{{face_detail}}"
    },
    "face_detailer": {
      "class_type": "FaceDetailer",
      "inputs": {
        "image": [
          "6",
          0
        ],
        "model": [
          "freeu",
          0
        ],
        "clip": [
          "1",
          1
        ],
        "vae": [
          "1",
          2
        ],
        "guide_size": 512.0,
        "guide_size_for": true,
        "max_size": 1024.0,
        "seed": "{{seed}}",
        "steps": 20,
        "cfg": 7.0,
        "sampler_name": "dpmpp_2m",
        "scheduler": "karras",
        "positive": [
          "2",
          0
        ],
        "negative": [
          "3",
          0
        ],
        "denoise": 0.5,
        "feather": 5,
        "noise_mask": true,
        "force_inpaint": true,
        "bbox_threshold": 0.5,
        "bbox_dilation": 10,
        "bbox_crop_factor": 3.0,
        "sam_detection_hint": "center-1",
        "sam_dilation": 0,
        "sam_threshold": 0.93,
        "sam_bbox_expansion": 0,
        "sam_mask_hint_threshold": 0.7,
        "sam_mask_hint_use_negative": "False",
        "drop_size": 10,
        "bbox_detector": [
          "face_bbox",
          0
        ],
        "wildcard": "",
        "cycle": 1
      },
      "outputs": [
        "image",
        "cropped_refined",
        "cropped_enhanced_alpha",
        "mask",
        "detailer_pipe",
        "cnet_images"
      ],
      "_condition": "{{face_detail}}",
      "_condition_passthrough": "image",
      "_comment": "Impact FaceDetailer (SAM optional; bbox mask + feather fallback)."
    }
  },
  "prompt_construction": {
    "template": "isolated {cosmetic_type} cosmetic item, {type_specific_prompt}, {material_prompt}, {color_prompt}, transparent background for compositing, single item centered, clean edges, {transparency} appearance{glow_clause}, game asset quality, digital art, highly detailed, professional quality",
    "variables": {
      "cosmetic_type": "{{cosmetic_type}}",
      "type_specific_prompt": "{{headwear_prompts[headwear_style] if cosmetic_type == 'headwear' else (jewelry_prompts[jewelry_style] if cosmetic_type == 'jewelry' else (clothing_prompts[clothing_style] if cosmetic_type == 'clothing' else (wings_prompts[wings_style] if cosmetic_type == 'wings' else '')))}}",
      "material_prompt": "{{material_prompts[material]}}",
      "color_prompt": "{{chakra_colors[chakra_target] if color_scheme == 'chakra_specific' else color_prompts[color_scheme]}}",
      "transparency": "{{transparency}}",
      "glow_clause": "{{', glowing luminescent effect, light emission, radiant' if glow_effect else ''}}"
    }
  },
  "output_spec": {
    "type": "image",
    "format": "png",
    "channels": 4,
    "transparency": true
  },
  "custom_nodes_required": [
    "FaceDetailer",
    "RemoveBackground",
    "UltralyticsDetectorProvider"
  ],
  "models_required": [
    "DreamShaper_8_pruned.safetensors",
    "bbox/face_yolov8m.pt",
    "v1-5-pruned-emaonly.safetensors"
  ],
  "checkpoint_files": {
    "dreamshaper_8": "DreamShaper_8_pruned.safetensors",
    "sd15_base": "v1-5-pruned-emaonly.safetensors"
  }
}
