29154bd651
Co-authored-by: Copilot <copilot@github.com>
5.0 KiB
5.0 KiB
Foreground Layer Example
Overview
The foreground layer adds depth and realism to product images by placing decorative elements (like plants, porch furniture, or architectural details) in front of the product.
Layer Stacking Order
From back to front:
- Base Layer (z-index: 1) - Background/house/frame
- Door Layer (z-index: 2) - Door or window panel (changes with color)
- Hardware Layer (z-index: 3) - Handles, locks, hinges
- Overlay Layer (z-index: 4) - Glass views or decorative overlays
- Foreground Layer (z-index: 5) - Plants, decorative items that appear in front
Creating a Foreground Layer
Step 1: Prepare Your Image
- Take or create an image of decorative elements (plants, porch items, etc.)
- Remove the background completely (use Photoshop, GIMP, or Photopea)
- Save as PNG with transparency
- Ensure dimensions match your base layer image
Step 2: Position Elements
When creating your foreground layer, position elements to:
- Frame the product naturally
- Not obscure critical product details
- Add depth by having some elements extend beyond product edges
- Consider perspective and lighting consistency
Step 3: Export Settings
- Format: PNG-24
- Transparency: Enabled
- Color Profile: sRGB
- Resolution: Match your base layer (typically 800-1200px width)
JSON Configuration Example
{
"productCode": "600",
"description": "#600 PREMIUM ENTRY DOOR",
"image": "images/600.jpg",
"colors": ["White", "Black", "Bronze", "Sandstone"],
"materials": ["Aluminum", "Vinyl"],
"imageConfig": {
"layered": true,
"basePath": "images/products/600/",
"layers": {
"base": "house-background.jpg",
"door": {
"white": "door-white.png",
"black": "door-black.png",
"bronze": "door-bronze.png",
"sandstone": "door-sandstone.png"
},
"hardware": "handle-silver.png",
"foreground": "front-plants.png"
}
}
}
File Structure
app/images/products/600/
├── house-background.jpg # Background layer with house/frame
├── door-white.png # White door (transparent background)
├── door-black.png # Black door (transparent background)
├── door-bronze.png # Bronze door (transparent background)
├── door-sandstone.png # Sandstone door (transparent background)
├── handle-silver.png # Hardware layer (transparent background)
└── front-plants.png # Foreground layer with plants (transparent background)
Tips for Best Results
Foreground Elements to Consider
- Potted plants: Add life and color to the scene
- Hanging baskets: Create visual interest at different heights
- Porch railings: Partial railings in foreground add depth
- Architectural details: Columns, trim, or decorative elements
- Seasonal decorations: Pumpkins, wreaths, holiday items (create variants)
Technical Tips
- Keep file sizes reasonable (compress PNGs without losing quality)
- Use soft shadows on foreground elements for realism
- Match lighting direction across all layers
- Consider blur/depth of field on very close foreground elements
- Test on different screen sizes to ensure elements don't obscure product
Common Mistakes to Avoid
- ❌ Foreground elements too large, obscuring product
- ❌ Inconsistent lighting between layers
- ❌ Mismatched image dimensions
- ❌ Harsh edges on transparent elements
- ❌ Too much foreground detail competing with product
Advanced: Multiple Foreground Variants
You can create different foreground options for variety:
{
"productCode": "600",
"description": "#600 PREMIUM ENTRY DOOR",
"imageConfig": {
"layered": true,
"basePath": "images/products/600/",
"layers": {
"base": "house-background.jpg",
"door": {
"white": "door-white.png",
"black": "door-black.png"
},
"hardware": "handle-silver.png",
"foreground": "plants-spring.png"
// Could add logic to swap between plants-spring.png, plants-summer.png, etc.
}
}
}
Testing Your Foreground Layer
- Load your product page
- Change door colors - foreground should stay visible on top
- Verify no important product details are obscured
- Check on mobile/tablet to ensure proper scaling
- Test with different browsers for compatibility
Performance Considerations
- PNG files can be large - optimize them using tools like:
- TinyPNG (https://tinypng.com)
- ImageOptim (https://imageoptim.com)
- Photoshop "Export for Web"
- Target file size: 50-200KB for foreground layer
- Use appropriate resolution (no need for 4K if displaying at 800px)
Accessibility Note
The foreground layer has pointer-events: none CSS property, meaning clicks pass through to the controls below. This ensures the decorative layer doesn't interfere with user interaction.