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.
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
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:
-
NO Mannequins
- Visible mannequins (full or partial)
- Plastic forms, torso forms, dress forms
- Any mannequin shapes or outlines
-
NO Models or Human Elements
- Human figures, faces, body parts
- Skin, hands, arms, legs, torso, neck, head
- Any human presence or suggestion
-
NO Support Structures
- Hangers, stands, rods, clips
- Visible support systems of any kind
- Equipment or rigging
-
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:
- Template Level: Base template includes exclusion constraints
- Prompt Generation Level: Dynamic prompts emphasize exclusions
- Integration Level: AI-powered prompt writer receives explicit exclusion requirements
- 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_TEMPLATEwith your own base template variable name - Replace
/lib/ghost/prompt-generator.tswith your actual file path - Replace
Gemini 2.5 Flash Imagewith 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
DunApp PWA - Project Constraints
Defines 14 hard constraints for a Hungarian PWA project, banning Netlify deployment and enforcing local-only testing, Supabase backend, and zero-cost development.
Constraints
Defines a three-tier priority system for design decisions, with conflict resolution examples to guide trade-offs.
Version Constraints Guide
Teaches Composer version constraint syntax for WordPress plugins and themes using a custom shell script wrapper.
Specifying version constraints
Explains how to pin Terraform CLI, provider, and Ansible versions for IBM Cloud Schematics workspaces and actions.