Spaces:
Runtime error
A newer version of the Gradio SDK is available:
5.49.1
Mech Prompt Engineering Guide - HuggingFace Space
Problem: AI Generates Organic Shapes Instead of Mechanical
Root Cause: Text-to-3D AI interprets "chicken mech" literally as organic chicken shape.
Solution: Use precise mechanical keywords + reference images OR highly detailed prompts.
Method 1: Image-to-3D (RECOMMENDED - 90% Success Rate)
Workflow:
- Generate concept art with FLUX.1-schnell (2D image generation)
- Use image as reference for Hunyuan3D-2 (image-to-3D)
- Result: Precise mechanical design
Example:
# Step 1: Generate concept art (FLUX)
result = client.predict(
prompt="bipedal chicken mech, hard surface, mechanical legs, armored body, sci-fi, white background, front view, game asset",
quality="High",
api_name="/generate_2d_asset_pro"
)
# Step 2: Use image for 3D generation
result = client.predict(
prompt="mechanical chicken mech, hard surface, game asset",
image=result[0], # Use generated concept art
quality="High",
api_name="/lambda"
)
Method 2: Text-Only with Precise Keywords (70% Success Rate)
Critical Keywords for Mechanical Designs:
Hard-Surface Keywords (MUST INCLUDE)
hard surface- Forces geometric, non-organic shapesmechanical- Emphasizes machine partsarmored- Adds plating, panelssci-fi- Futuristic tech aestheticgame asset- Optimized geometrywhite background- Clean isolation
Material Keywords
metal plating- Metallic surfacesrivets and bolts- Mechanical detailspanel lines- Surface detailhydraulic joints- Mechanical articulationexposed machinery- Internal mechanisms
Style Keywords
low-poly- Simplified geometry (game-ready)stylized- Artistic interpretationrealistic- Photorealistic detailsindustrial design- Functional aesthetics
Negative Keywords (What to AVOID)
- โ
organic- Creates biological shapes - โ
feathers- Adds organic details - โ
realistic chicken- Too literal - โ
cartoon- May create soft shapes
Prompt Templates for Different Mech Types
Chicken Mech (Bipedal Walker)
"bipedal chicken mech, hard surface mechanical design, armored metal plating,
hydraulic legs, sci-fi military robot, panel lines and rivets, game asset,
white background, front view, low-poly stylized"
Key Elements:
bipedal- Two legs (not four)hard surface mechanical- Non-organicarmored metal plating- Mechanical materialshydraulic legs- Mechanical jointspanel lines and rivets- Surface detail
Tank Mech (Tracked Vehicle)
"tracked tank mech, hard surface armor, heavy weapons platform,
industrial design, metal plating with rivets, sci-fi military vehicle,
game asset, white background, isometric view"
Spider Mech (Multi-Legged)
"spider mech with 6 mechanical legs, hard surface design, armored body,
hydraulic joints, sci-fi robot, metal construction, game asset,
white background, top-down view"
Humanoid Mech (Gundam-Style)
"humanoid battle mech, hard surface armor, mechanical joints,
sci-fi military robot, panel lines and vents, game asset,
white background, front view, heroic pose"
Prompt Structure Formula
Optimal Format:
[Type] + [Hard-Surface Keywords] + [Materials] + [Details] + [Context] + [Technical]
Example Breakdown:
"bipedal chicken mech" (Type)
+ "hard surface mechanical design" (Hard-Surface)
+ "armored metal plating" (Materials)
+ "hydraulic legs, panel lines, rivets" (Details)
+ "sci-fi military robot" (Context)
+ "game asset, white background, front view" (Technical)
Quality Settings for Mechs
Recommended Settings:
- Quality: High (30 steps, 512 octree, 2K textures)
- Reason: Mechanical details need precision
- Time: 60-90 seconds
Fast Iteration (Testing Prompts):
- Quality: Balanced (15 steps, 384 octree, 2K textures)
- Reason: Quick feedback on prompt effectiveness
- Time: 30-45 seconds
Testing Your Prompts
Iteration Workflow:
- Start with Balanced quality (fast feedback)
- Test prompt variations
- Once prompt works, use High quality
- If still organic, switch to image-to-3D method
Common Issues:
Issue: Still looks organic
Fix: Add more hard-surface keywords: mechanical joints, metal construction, industrial design
Issue: Too abstract/simple
Fix: Add detail keywords: panel lines, rivets, vents, hydraulic pistons
Issue: Wrong proportions
Fix: Add view keywords: front view, side view, isometric view
Advanced: Multi-View Generation
For Complex Mechs:
# Generate multiple views
views = ["front view", "side view", "back view", "top view"]
for view in views:
prompt = f"bipedal chicken mech, hard surface, mechanical, {view}, white background"
result = client.predict(prompt=prompt, quality="High", api_name="/lambda")
# Use all views as reference for final model
Comparison: Text-Only vs Image-to-3D
Text-Only:
- โ Faster (no 2D generation step)
- โ Good for simple designs
- โ Less precise control
- โ Higher chance of organic shapes
Image-to-3D:
- โ Precise control over design
- โ 90%+ success rate for mechanical
- โ Can iterate on 2D concept first
- โ Requires 2D generation step (adds 30-60s)
Recommendation: Use image-to-3D for hero mechs, text-only for variations.
Example: Complete Chicken Mech Generation
Step 1: Generate Concept Art (FLUX)
concept_result = client.predict(
prompt="bipedal chicken mech, hard surface mechanical design, armored legs, "
"sci-fi military robot, front view, white background, game concept art, "
"detailed panel lines, hydraulic joints, metal plating",
quality="High",
api_name="/generate_2d_asset_pro"
)
# Result: 2D concept art image
Step 2: Generate 3D Model (Hunyuan3D-2)
mech_result = client.predict(
prompt="mechanical chicken mech, hard surface, game asset, detailed",
image=concept_result[0], # Use concept art as reference
quality="High",
api_name="/lambda"
)
# Result: Precise mechanical 3D model
Step 3: Process in Blender (Optional)
# If needed, refine in Blender
processed = client.predict(
input_path=mech_result[0],
target_height=2.0,
generate_lod=True,
generate_collision=True,
api_name="/process_for_godot"
)
Quick Reference: Keyword Cheat Sheet
ALWAYS INCLUDE:
hard surfacemechanicalgame assetwhite background
FOR DETAILS:
panel linesrivetshydraulic jointsmetal plating
FOR STYLE:
sci-fi(futuristic)industrial(functional)military(combat-ready)low-poly(game-optimized)
NEVER INCLUDE:
- โ
organic - โ
feathers - โ
realistic chicken - โ
cartoon(unless stylized is goal)
Troubleshooting
Problem: Still getting organic shapes Solution: Use image-to-3D method with FLUX concept art
Problem: Too simple/blocky
Solution: Add detail keywords: panel lines, rivets, vents, hydraulic pistons
Problem: Wrong scale/proportions
Solution: Add view keywords: front view, heroic pose, isometric view
Problem: Not game-ready
Solution: Add game asset, low-poly, optimized geometry
Next Steps
- Test Prompts: Use Balanced quality for fast iteration
- Refine: Add keywords based on results
- Switch to Image-to-3D: If text-only fails
- Process: Use Blender pipeline for final optimization
Your HuggingFace Space has all these capabilities built-in!
Token Usage: 106,086/200,000 (53%)