BM

bigchx/mcp_3d_relief

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

24 stars 6 forks 质量 54 趋势 11MIT

图像转三维浮雕STL模型

概览

该项目提供一个MCP服务器,将2D图像转换为STL格式的3D浮雕模型,适用于3D打印或渲染。 - 将任意图像转换为3D浮雕模型 - 控制模型尺寸(宽度、厚度) - 为3D模型添加可选底座 - 反转深度以实现不同浮雕效果 - 快速处理并立即下载链接 - image_path:输入图像文件的本地路径或网页URL- model_width:3D模型宽度(毫米)(默认:50.0)- model_thickness:3D模型的最大厚度/高度(毫米)(默认:5.0)- base_thickness:底座厚度(毫米)(默认:2.0)- skip_depth:是直接使用图像还是生成深度图(默认:true)- invert_depth:反转浮雕(明亮区域变低而非高)(默认:false)- detail_level:控制处理后的图像分辨率(默认:1.0)。当detail_level=1.0时,图像以320px分辨率处理,通常生成一个低于100MB的STL文件。

概述(AI 翻译)

中文 · MCP简介 · 维基

该项目提供一个MCP服务器,将2D图像转换为STL格式的3D浮雕模型,适用于3D打印或渲染。

特色

  • 将任意图像转换为三维浮雕模型
  • 控制模型尺寸(宽度、厚度)
  • 为3D模型添加可选底座
  • 不同缓解效果的反转深度
  • 快速处理,带即时下载链接

安装

先决条件

  • Python 3.10+
  • 紫外线

选项1:本地安装

  1. 克隆仓库:

  2. 安装依赖:

  3. 运行/检查服务器:

用途

JSON 配置

MCP 工具参数

  • image_path:输入图像文件的本地路径或网页URL。
  • model_width:3D模型宽度(毫米)(默认:50.0)
  • model_thickness:3D模型的最大厚度/高度(毫米)(默认:5.0)
  • base_thickness:底座厚度(毫米)(默认:2.0)
  • skip_depth:是直接使用图像还是生成深度图(默认:true)
  • invert_depth:反转浮雕(明亮区域变低而非高处)(默认:错误)
  • detail_level:控制处理后的图像分辨率(默认:1.0)。detail_level = 1。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

MCP STL 3D Relief Generator

This project provides a MCP server that converts 2D images into 3D relief models in STL format, suitable for 3D printing or rendering.

Features

  • Convert any image to a 3D relief model
  • Control model dimensions (width, thickness)
  • Add optional base to the 3D model
  • Invert depth for different relief effects
  • Fast processing with immediate download links

Installation

Prerequisites

  • Python 3.10+
  • uv

Option 1: Local Installation

  1. Clone the repository:
git clone https://github.com/bigchx/mcp_3d_relief.git
cd mcp_3d_relief
  1. Install dependencies:
uv pip sync requirements.txt
  1. Run/Inspect the server:
mcp run server.py
mcp dev server.py

Usage

JSON Configuration

{
  "mcpServers": {
    "mcp_3d_relief": {
      "command": "uv",
      "args": ["--directory", "{fill_in_your_path_here}", "run", "server.py"]
    }
  }
}

MCP Tool Parameters

  • image_path: Local path or web URL to the input image file
  • model_width: Width of the 3D model in mm (default: 50.0)
  • model_thickness: Maximum thickness/height of the 3D model in mm (default: 5.0)
  • base_thickness: Thickness of the base in mm (default: 2.0)
  • skip_depth: Whether to use the image directly or generate a depth map (default: true)
  • invert_depth: Invert the relief (bright areas become low instead of high) (default: false)
  • detail_level: Controls the resolution of the processed image (default: 1.0). At detail_level = 1.0, the image is processed at 320px resolution, producing an STL file typically under 100MB. Higher values improve detail quality but significantly increase both processing time and STL file size. For example, doubling the detail_level can increase file size by 4x or more. Use with caution.

Response

The MCP Tool returns a JSON response with:

{
  "status": "success",
  "depth_map_path": "path/to/yourimage_depth_map.png",
  "stl_path": "path/to/yourimage.stl"
}

Where LLMs can access the generated files from this MCP server, using the provided URLs.

Command Line

You can also use the script directly from the command line to generate a relief model from an image:

python3 relief.py path/to/your/image.jpg

External Depth Map Generation

For higher quality depth maps, you can use external depth map generation services like Depth-Anything-V2. This service can generate more accurate depth maps that you can then use with this project:

  1. Visit https://huggingface.co/spaces/depth-anything/Depth-Anything-V2
  2. Upload your image to generate a depth map
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "mcp_3d_relief": { "command": "uv", "args": ["--directory", "{fill_in_your_path_here}", "run", "server.py"] } } }