generate_nature_scene
Create photorealistic natural outdoor scenes with procedurally generated terrain, vegetation, and environmental elements using Infinigen's 3D scene generation capabilities.
Instructions
Generate a photorealistic natural outdoor scene using Infinigen. Creates terrain, vegetation, and natural elements.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| seed | No | Random seed for reproducible generation (default: random) | |
| output_folder | Yes | Output folder path for generated scene files | |
| configs | No | Configuration files to use (e.g., ['desert.gin', 'simple.gin']) | |
| use_gpu | No | Whether to use GPU acceleration (default: false) |
Implementation Reference
- src/index.ts:117-137 (handler)The handler function that executes the tool: generates a random seed if not provided, constructs a Python command to run Infinigen's datagen.manage_jobs, executes it via child_process.exec, and returns the output or error.async function generateNatureScene(args: { seed?: number; output_folder: string; configs?: string[]; use_gpu?: boolean; }): Promise<string> { const seed = args.seed ?? Math.floor(Math.random() * 1000000); const configs = args.configs ?? ["simple.gin"]; const useGpu = args.use_gpu ?? false; const gpuFlag = useGpu ? "" : "LocalScheduleHandler.use_gpu=False"; const command = `python -m infinigen.datagen.manage_jobs --output_folder ${args.output_folder} --num_scenes 1 --specific_seed ${seed} --configs ${configs.join(" ")} --pipeline_configs local_16GB.gin monocular.gin blender_gt.gin ${gpuFlag ? `--pipeline_overrides ${gpuFlag}` : ""}`; try { const { stdout, stderr } = await execAsync(command, { maxBuffer: 10 * 1024 * 1024 }); return `Scene generation started successfully.\nSeed: ${seed}\nOutput: ${args.output_folder}\n\nCommand output:\n${stdout}\n${stderr || ""}`; } catch (error) { throw new Error(`Failed to generate scene: ${error instanceof Error ? error.message : "Unknown error"}`); } }
- src/index.ts:31-55 (schema)Input schema definition for the generate_nature_scene tool, specifying parameters, types, descriptions, defaults, and required fields.inputSchema: { type: "object", properties: { seed: { type: "number", description: "Random seed for reproducible generation (default: random)", }, output_folder: { type: "string", description: "Output folder path for generated scene files", }, configs: { type: "array", items: { type: "string" }, description: "Configuration files to use (e.g., ['desert.gin', 'simple.gin'])", default: ["simple.gin"], }, use_gpu: { type: "boolean", description: "Whether to use GPU acceleration (default: false)", default: false, }, }, required: ["output_folder"], },
- src/index.ts:28-56 (registration)Tool object registration in the TOOLS array, which is returned by ListToolsRequestHandler. Includes name, description, and inputSchema.{ name: "generate_nature_scene", description: "Generate a photorealistic natural outdoor scene using Infinigen. Creates terrain, vegetation, and natural elements.", inputSchema: { type: "object", properties: { seed: { type: "number", description: "Random seed for reproducible generation (default: random)", }, output_folder: { type: "string", description: "Output folder path for generated scene files", }, configs: { type: "array", items: { type: "string" }, description: "Configuration files to use (e.g., ['desert.gin', 'simple.gin'])", default: ["simple.gin"], }, use_gpu: { type: "boolean", description: "Whether to use GPU acceleration (default: false)", default: false, }, }, required: ["output_folder"], }, },
- src/index.ts:203-213 (registration)Dispatch logic in CallToolRequestHandler switch statement: calls the generateNatureScene handler and formats the response for MCP.case "generate_nature_scene": { const result = await generateNatureScene(args as any); return { content: [ { type: "text", text: result, }, ], }; }