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
Xilinx Constraints
Explains Xilinx XDC constraint ordering, compilation precedence, and key references for FPGA timing closure.
Technical Constraints & Requirements
Defines platform, performance, security, and deployment constraints for a Scottish mountain weather app with native iOS/Android and PWA fallback.
Token Constraints Implementation
Defines a token constraint system that counts tokens, truncates content, and streams responses to stay within an LLM's token limit.
Constraints
Explains how to model constraints as Ceres Solver cost functions in the fuse optimization framework, with a complete code example.