{
  "id": "usJiWkyJJ3r0woC1",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Product Concept to 3D Showcase with AI Packaging Design & Rotation Rendering",
  "tags": [],
  "nodes": [
    {
      "id": "8259fe41-6d89-4993-8fdf-3c807173a51f",
      "name": "Webhook Trigger",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -608,
        1344
      ],
      "parameters": {
        "path": "product-showcase",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 1
    },
    {
      "id": "c864b4ca-8947-438a-b6e2-85eaa33ce54e",
      "name": "Parse AI Response",
      "type": "n8n-nodes-base.code",
      "position": [
        -32,
        1344
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "885ae259-8b7f-4bf7-bb23-bd743b5b75c4",
      "name": "Generate Packaging Design",
      "type": "n8n-nodes-base.openAi",
      "position": [
        192,
        1248
      ],
      "parameters": {
        "model": "=dall-e-3",
        "prompt": "={{ 'Professional product packaging design for ' + $json.productSpec.productName + '. ' + $json.productSpec.packaging.design + '. Colors: ' + $json.productSpec.colors.primary + ', ' + $json.productSpec.colors.secondary + '. Modern, clean, high-end commercial product photography style. 4K quality.' }}",
        "options": {},
        "requestOptions": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ae21a823-1893-47be-ab1a-17535cab516e",
      "name": "Generate Texture Maps",
      "type": "n8n-nodes-base.openAi",
      "position": [
        192,
        1536
      ],
      "parameters": {
        "model": "=dall-e-3",
        "prompt": "={{ 'High-quality texture map for ' + $json.productSpec.materials.join(', ') + ' material. Seamless, tileable, PBR ready. 4K resolution. Professional product rendering quality.' }}",
        "options": {},
        "requestOptions": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "957b8272-d03a-4cef-ab15-65f996ae1695",
      "name": "Generate 3D Scene Script",
      "type": "n8n-nodes-base.code",
      "position": [
        640,
        1392
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "6f333135-b1a5-44ed-a934-b667fa64b5c2",
      "name": "Generate 3D Preview Render",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        864,
        1280
      ],
      "parameters": {
        "url": "https://api.replicate.com/v1/predictions",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "version",
              "value": "stability-ai/sdxl"
            },
            {
              "name": "input",
              "value": "={{ { \"prompt\": \"Professional 3D product render of \" + $json.productSpec.productName + \", studio lighting, 8K, photorealistic, commercial photography\", \"width\": 1024, \"height\": 1024 } }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "2f80cf77-ddd5-407c-abb3-997bb653e365",
      "name": "Process Video Rendering",
      "type": "n8n-nodes-base.code",
      "position": [
        1088,
        1392
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "e582488f-469b-4737-b360-648bb2de1a62",
      "name": "Upload to Video Service",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1312,
        1248
      ],
      "parameters": {
        "url": "={{ $json.videoEncodingService || 'https://api.cloudflare.com/client/v4/accounts/YOUR_ACCOUNT_ID/stream' }}",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "meta",
              "value": "={{ { \"name\": $json.productName + \"_showcase\" } }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "2e5b4c8f-8a15-48e1-9f77-98b99aaad9e5",
      "name": "Merge All Assets",
      "type": "n8n-nodes-base.merge",
      "position": [
        416,
        1392
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combinationMode": "mergeByPosition"
      },
      "typeVersion": 2.1
    },
    {
      "id": "2643680a-bd5f-4472-8dae-b40a2501b9db",
      "name": "Check Render Status",
      "type": "n8n-nodes-base.if",
      "position": [
        1312,
        1440
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.renderStatus }}",
              "value2": "queued",
              "operation": "equals"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f2c5da90-5358-4c3e-907d-2288b887766a",
      "name": "Wait for Render",
      "type": "n8n-nodes-base.wait",
      "position": [
        1536,
        1488
      ],
      "parameters": {
        "unit": "seconds",
        "amount": 30
      },
      "typeVersion": 1
    },
    {
      "id": "c91f52db-e7aa-4054-9cf1-38c1331079aa",
      "name": "Format Final Output",
      "type": "n8n-nodes-base.code",
      "position": [
        1536,
        1296
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "98ce1ca4-fb97-48fc-addb-9ae095a6fdf7",
      "name": "Send Response",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1760,
        1200
      ],
      "parameters": {
        "options": {
          "responseCode": 200,
          "responseHeaders": {
            "entries": [
              {
                "name": "Content-Type",
                "value": "application/json"
              }
            ]
          }
        },
        "respondWith": "json",
        "responseBody": "={{ $json }}"
      },
      "typeVersion": 1
    },
    {
      "id": "995e9fc5-b707-4771-862a-64319caa0c32",
      "name": "Save to Database",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1760,
        1392
      ],
      "parameters": {
        "table": "product_showcases",
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "public"
        },
        "columns": {
          "value": {},
          "schema": [],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "abcb69cd-37a4-4ec2-a743-b92e464e852e",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -384,
        512
      ],
      "parameters": {
        "width": 780,
        "height": 400,
        "content": "## How it Works\nThis workflow turns a simple product idea (from Google Gemini chat) into a polished 3D showcase video. It auto-generates concepts, packaging visuals, textures, a rotatable 3D scene script, and renders a 360\u00b0 animation\u2014ready for sharing in seconds. Key flow: Chat input \u2192 AI design gen \u2192 Asset merging \u2192 Script & render \u2192 Status check & output. Handles pro lighting (HDRI/rim) and exports GLB/PBR files. Tracks everything in a database for retries.\n\n## Setup Steps\n1. Add credentials: Google Gemini API key (in Chat Model node), your video hosting service (e.g., Vimeo API in Upload node), and DB connection (e.g., Supabase/Postgres in Save to Database).\n2. Test webhook: Send a sample prompt like \"Generate a red sneaker concept\" via Gemini chat to trigger.\n3. Configure paths: Set output folder in Generate Texture Maps; adjust render duration (default 10s) in 3D Scene Script.\n4. Run once: Execute workflow, check DB for status, tweak if renders fail (e.g., API quotas).\n5. Go live: Share webhook URL with your team for on-demand showcases.\n\n(Questions? Check node descriptions or n8n docs.)"
      },
      "typeVersion": 1
    },
    {
      "id": "4a3ae410-58a1-4080-abb7-f5c8edd4c29e",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -320,
        1568
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "6cb9cfe8-1d16-42a1-b79e-64e161d42073",
      "name": "AI Product Concept Generator",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -384,
        1344
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 2.2
    },
    {
      "id": "6ed0a8d6-8aa6-4add-b366-07c03c090092",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -688,
        1136
      ],
      "parameters": {
        "color": 4,
        "width": 192,
        "height": 352,
        "content": "## Chat Input\nStarts with Gemini prompt (e.g., \"eco-friendly bottle\"). Parses response for concept details. Add your API key here."
      },
      "typeVersion": 1
    },
    {
      "id": "67551d72-d6f3-42b3-90ef-2170c4697bff",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -416,
        1120
      ],
      "parameters": {
        "color": 6,
        "width": 464,
        "height": 352,
        "content": "## Design Generation\nBuilds product spec from chat, then creates pro packaging visuals (DALL-E maps). Outputs layered assets for next steps."
      },
      "typeVersion": 1
    },
    {
      "id": "d1b9e8b3-1f8e-4f2f-924f-5b3a483949a9",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        96,
        1088
      ],
      "parameters": {
        "color": 3,
        "width": 928,
        "height": 624,
        "content": "## 3D Assets\nMerges textures (PBR-ready) and scripts a rotatable scene with HDRI lighting + 360\u00b0 anim (10s default)."
      },
      "typeVersion": 1
    },
    {
      "id": "4bd1fcde-9b8d-4ce5-b4fc-bf146945b1e5",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1040,
        1024
      ],
      "parameters": {
        "color": 5,
        "width": 176,
        "height": 624,
        "content": "## Render & Host\nQueues preview render, uploads video, formats GLB for web. Handles encoding via your service API."
      },
      "typeVersion": 1
    },
    {
      "id": "ca71f6f9-bfe7-4e5e-8232-3f799c121c4a",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1264,
        1008
      ],
      "parameters": {
        "color": 4,
        "width": 608,
        "height": 624,
        "content": "## Status & Save\nPolls render progress, waits for completion, saves showcase data to DB, sends final link back via chat."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "cc8546b2-e2d5-4652-a80c-1abf407e32ee",
  "connections": {
    "Wait for Render": {
      "main": [
        [
          {
            "node": "Check Render Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook Trigger": {
      "main": [
        [
          {
            "node": "AI Product Concept Generator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge All Assets": {
      "main": [
        [
          {
            "node": "Generate 3D Scene Script",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse AI Response": {
      "main": [
        [
          {
            "node": "Generate Packaging Design",
            "type": "main",
            "index": 0
          },
          {
            "node": "Generate Texture Maps",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge All Assets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Render Status": {
      "main": [
        [
          {
            "node": "Wait for Render",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Format Final Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Final Output": {
      "main": [
        [
          {
            "node": "Send Response",
            "type": "main",
            "index": 0
          },
          {
            "node": "Save to Database",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Texture Maps": {
      "main": [
        [
          {
            "node": "Merge All Assets",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Process Video Rendering": {
      "main": [
        [
          {
            "node": "Upload to Video Service",
            "type": "main",
            "index": 0
          },
          {
            "node": "Check Render Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload to Video Service": {
      "main": [
        [
          {
            "node": "Format Final Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate 3D Scene Script": {
      "main": [
        [
          {
            "node": "Generate 3D Preview Render",
            "type": "main",
            "index": 0
          },
          {
            "node": "Process Video Rendering",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Product Concept Generator",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Generate Packaging Design": {
      "main": [
        [
          {
            "node": "Merge All Assets",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Generate 3D Preview Render": {
      "main": [
        [
          {
            "node": "Process Video Rendering",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Product Concept Generator": {
      "main": [
        [
          {
            "node": "Parse AI Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}