# Meshy Relief

> Meshy Relief converts an image into a 3D relief model with a raised surface and a flat back.


## Overview

- **Endpoint**: `https://fal.run/meshy/relief`
- **Model ID**: `meshy/relief`
- **Category**: image-to-3d
- **Kind**: inference
**Tags**: 3d, relief, image-to-3d



## Pricing

Your request will cost **$0.80** per generation.

For more details, see [fal.ai pricing](https://fal.ai/pricing).

## API Information

This model can be used via our HTTP API or more conveniently via our client libraries.
See the input and output schema below, as well as the usage examples.


### Input Schema

The API accepts the following input parameters:


- **`image_url`** (`string`, _required_):
  Photo to turn into a relief. Works best with one clear subject on a plain background. JPG, PNG or WebP up to 20 MB.
  - Examples: "https://v3b.fal.media/files/b/zebra/3osHJDI8IZ2wl6sGtEUeB_image.png"

- **`variant`** (`VariantEnum`, _optional_):
  Relief depth. 'low' gives slight depth and finer detail (patterns, badges, seals); 'high' gives bold, sculptural depth (pets, portraits, characters). Default value: `"low"`
  - Default: `"low"`
  - Options: `"low"`, `"high"`

- **`should_generate_model`** (`boolean`, _optional_):
  Generate the STL and GLB relief models. Set to false to return only the 16-bit depth map. Default value: `true`
  - Default: `true`

- **`size_mm`** (`float`, _optional_):
  Length of the photo's long side in millimeters, measured flat before any bend. Default value: `60`
  - Default: `60`
  - Range: `20` to `250`

- **`carving_mode`** (`CarvingModeEnum`, _optional_):
  'emboss' makes the nearer parts stand out; 'engrave' inverts the depth so they are cut in. Default value: `"emboss"`
  - Default: `"emboss"`
  - Options: `"emboss"`, `"engrave"`

- **`carving_depth_mm`** (`float`, _optional_):
  Carving depth in millimeters. Defaults to 3 for 'low' and 6 for 'high'.
  - Range: `0` to `60`

- **`remove_base`** (`boolean`, _optional_):
  Cut away the background and build no base plate. A high removal_threshold, or a carving depth of 0, can produce an empty model.
  - Default: `false`

- **`removal_threshold`** (`float`, _optional_):
  Only used with remove_base. Depth below which the background is cut, on the depth map's 0-1 scale. Defaults to 0.01.
  - Range: `0.01` to `1`

- **`base_thickness_mm`** (`float`, _optional_):
  Base plate thickness in millimeters. Defaults to 1. Not allowed with remove_base.
  - Range: `0.1` to `10`

- **`bend_mode`** (`BendModeEnum`, _optional_):
  Bend the relief into a convex or concave curve. Default value: `"off"`
  - Default: `"off"`
  - Options: `"off"`, `"convex"`, `"concave"`

- **`bend_axis`** (`BendAxisEnum`, _optional_):
  Bend axis: 'xz' curls the left and right edges, 'yz' the top and bottom. Default value: `"xz"`
  - Default: `"xz"`
  - Options: `"xz"`, `"yz"`

- **`bend_angle`** (`float`, _optional_):
  Bend angle in degrees. Under 1 stays flat. Default value: `60`
  - Default: `60`
  - Range: `0` to `360`

- **`mesh_resolution`** (`integer`, _optional_):
  Mesh points along the long side. At 2048, files reach about 150 MB (GLB) and 300 MB (STL), and a bend can push the STL to about 800 MB. Default value: `1024`
  - Default: `1024`
  - Range: `512` to `2048`

- **`enable_safety_checker`** (`boolean`, _optional_):
  If set to true, input data will be checked for safety before processing. Default value: `true`
  - Default: `true`



**Required Parameters Example**:

```json
{
  "image_url": "https://v3b.fal.media/files/b/zebra/3osHJDI8IZ2wl6sGtEUeB_image.png"
}
```

**Full Example**:

```json
{
  "image_url": "https://v3b.fal.media/files/b/zebra/3osHJDI8IZ2wl6sGtEUeB_image.png",
  "variant": "low",
  "should_generate_model": true,
  "size_mm": 60,
  "carving_mode": "emboss",
  "bend_mode": "off",
  "bend_axis": "xz",
  "bend_angle": 60,
  "mesh_resolution": 1024,
  "enable_safety_checker": true
}
```


### Output Schema

The API returns the following output format:

- **`depth_map`** (`File`, _required_):
  16-bit grayscale depth map (PNG, 2K).

- **`model_glb`** (`File`, _optional_):
  Relief model in GLB format. Absent when should_generate_model is false.

- **`model_urls`** (`ModelUrls`, _optional_):
  Relief model files (GLB and STL). Empty when should_generate_model is false.

- **`thumbnail`** (`File`, _optional_):
  Preview image of the relief.



**Example Response**:

```json
{
  "depth_map": {
    "url": "",
    "content_type": "image/png",
    "file_name": "z9RV14K95DvU.png",
    "file_size": 4404019
  }
}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/meshy/relief \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "image_url": "https://v3b.fal.media/files/b/zebra/3osHJDI8IZ2wl6sGtEUeB_image.png"
   }'
```

### Python

Ensure you have the Python client installed:

```bash
pip install fal-client
```

Then use the API client to make requests:

```python
import fal_client

def on_queue_update(update):
    if isinstance(update, fal_client.InProgress):
        for log in update.logs:
           print(log["message"])

result = fal_client.subscribe(
    "meshy/relief",
    arguments={
        "image_url": "https://v3b.fal.media/files/b/zebra/3osHJDI8IZ2wl6sGtEUeB_image.png"
    },
    with_logs=True,
    on_queue_update=on_queue_update,
)
print(result)
```

### JavaScript

Ensure you have the JavaScript client installed:

```bash
npm install --save @fal-ai/client
```

Then use the API client to make requests:

```javascript
import { fal } from "@fal-ai/client";

const result = await fal.subscribe("meshy/relief", {
  input: {
    image_url: "https://v3b.fal.media/files/b/zebra/3osHJDI8IZ2wl6sGtEUeB_image.png"
  },
  logs: true,
  onQueueUpdate: (update) => {
    if (update.status === "IN_PROGRESS") {
      update.logs.map((log) => log.message).forEach(console.log);
    }
  },
});
console.log(result.data);
console.log(result.requestId);
```


## Deploy your own model

To run your own weights, a fine-tune or a custom pipeline on the GPUs that serve this API, deploy it on fal Serverless. GPUs from H100 (80GB) to B300 (288GB), billed per second; an H100 is $4.50/h list, as low as $2.49/h. Prices, GPU specs and deploy steps: [fal Serverless](https://fal.ai/serverless.md).

## Additional Resources

### Documentation

- [Model Playground](https://fal.ai/models/meshy/relief)
- [API Documentation](https://fal.ai/models/meshy/relief/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=meshy/relief)

### fal.ai Platform

- [Platform Documentation](https://fal.ai/docs/documentation)
- [Python Client](https://fal.ai/docs/api-reference/client-libraries/python)
- [JavaScript Client](https://fal.ai/docs/api-reference/client-libraries/javascript)

### Other agent-readable surfaces

This file covers one model. To find anything else:

- [Platform overview](https://fal.ai/llms.txt): Entry points and representative endpoint IDs
- [Documentation index](https://fal.ai/docs/llms.txt): Every documentation page
- [Full documentation text](https://fal.ai/docs/llms-full.txt): The whole documentation inlined
- [Pricing](https://fal.ai/pricing.md): Model API and Serverless GPU prices
- [fal Serverless](https://fal.ai/serverless.md): Deploy your own models: GPU prices, specs and steps
- Any other model: `https://fal.ai/models/<endpoint-id>/llms.txt`
