Back to .md Directory

Negative Constraints for Ghost Mannequin Rendering

Defines negative constraints for a ghost mannequin rendering pipeline to exclude mannequins, models, support structures, and non-white backgrounds from final output.

May 2, 2026
0 downloads
0 views
ai prompt
View source

What this file does

Defines negative constraints for a ghost mannequin rendering pipeline to exclude mannequins, models, support structures, and non-white backgrounds from final output.

When to use it

  • Building an e-commerce product photography pipeline for garments
  • Implementing AI image generation with strict exclusion rules
  • Creating a ghost mannequin effect that removes all human or mannequin artifacts
  • Setting up prompt templates for garment-only rendering in Gemini 2.5 Flash

Assumes this stack

Gemini 2.5 FlashFiles API

Negative Constraints for Ghost Mannequin Rendering

🚫 Critical Exclusion Constraints

The ghost mannequin rendering pipeline now includes comprehensive negative constraints to ensure ONLY the garment appears in the final output.

✅ Implementation Details

File: /lib/ghost/prompt-generator.ts

The base template and dynamic prompt generation now explicitly exclude:

🔴 Absolutely Excluded Elements:

  1. NO Mannequins

    • Visible mannequins (full or partial)
    • Plastic forms, torso forms, dress forms
    • Any mannequin shapes or outlines
  2. NO Models or Human Elements

    • Human figures, faces, body parts
    • Skin, hands, arms, legs, torso, neck, head
    • Any human presence or suggestion
  3. NO Support Structures

    • Hangers, stands, rods, clips
    • Visible support systems of any kind
    • Equipment or rigging
  4. NO Unwanted Visual Elements

    • Backgrounds other than pure white (#FFFFFF)
    • Props or accessories not part of the garment
    • Shadows of human forms or mannequin shapes
    • Reflections showing people or equipment

✅ What IS Included:

  • ONLY the garment with dimensional form
  • Invisible internal structure creating natural drape
  • Professional studio lighting
  • Pure white background (#FFFFFF)
  • Ghost mannequin effect (garment appears worn but without visible support)

📋 Template Sections Updated:

1. Base Template (FLASH_25_BASE_TEMPLATE)

## CRITICAL EXCLUSION CONSTRAINTS:

ABSOLUTELY EXCLUDE from the final image:
- **NO mannequins** (visible or partial)
- **NO models** (human figures, faces, body parts)
- **NO human elements** (skin, hands, arms, legs, torso, neck, head)
- **NO mannequin parts** (plastic forms, torso forms, dress forms)
- **NO visible support structures** (hangers, stands, rods, clips)
- **NO backgrounds** other than pure white (#FFFFFF)
- **NO props** (accessories not part of the garment)
- **NO shadows of human forms** or mannequin shapes
- **NO reflections** showing people or equipment

2. Integration Prompt (Dynamic Prompt Generation)

CRITICAL EXCLUSION REQUIREMENTS - The prompt MUST explicitly exclude:
• NO mannequins, models, human figures, or body parts (hands, arms, legs, skin, torso, neck, head)
• NO visible support structures (hangers, stands, dress forms, plastic forms)
• NO shadows or reflections of people or equipment
• NO props or accessories beyond the garment itself
• ONLY pure white background (#FFFFFF)

The garment must appear with dimensional form created by INVISIBLE internal structure - 
as if worn but with complete absence of any visible person, mannequin, or support.

🎯 Rendering Philosophy:

Instead of using negative commands like "remove person" or "no mannequin", the system uses positive framing:

  • ✅ "Professional e-commerce ghost mannequin photography"
  • ✅ "Garment displays dimensional form with invisible support"
  • ✅ "Pure garment form with natural drape on pure white background"
  • ✅ "Shows ONLY the garment itself with dimensional form created by invisible internal structure"

📊 Test Results:

Pipeline Performance: 60.2s total time

  • ✅ Background Removal: 17.1s
  • ✅ Analysis: 4.3s (with interior analysis)
  • ✅ Enrichment: 2.1s
  • ✅ Consolidation: 2.0s
  • ✅ Rendering: 19.0s

Token Optimization: 98% reduction via Files API (~960 tokens for rendering)

🔧 Technical Integration:

The negative constraints are integrated at multiple levels:

  1. Template Level: Base template includes exclusion constraints
  2. Prompt Generation Level: Dynamic prompts emphasize exclusions
  3. Integration Level: AI-powered prompt writer receives explicit exclusion requirements
  4. Rendering Level: Final prompt to Gemini 2.5 Flash Image includes all constraints

✨ Benefits:

  • Cleaner Outputs: Eliminates unwanted mannequin/model artifacts
  • Professional Quality: Ensures pure e-commerce product photography
  • Consistent Results: Explicit constraints reduce variability
  • Brand Safety: No human elements that could be problematic
  • Interior Preservation: Interior surfaces remain visible and accurate

Last Updated: 2025-09-30
Status: ✅ Active in Production

What's inside

1 philosophy section, 2 template blocks, 1 integration prompt, 1 test results table, 4 technical integration levels, 5 benefits

Change this for your project

  • Replace FLASH_25_BASE_TEMPLATE with your own base template variable name
  • Replace /lib/ghost/prompt-generator.ts with your actual file path
  • Replace Gemini 2.5 Flash Image with your target model name

Where it goes

Keep it in your repository where the agent or team that needs it will read it.

Worth borrowing

  • Using positive framing instead of negative commands to guide image generation
  • Layering exclusion constraints at template, prompt, integration, and rendering levels

Related Documents