# Trellis 2

> Generate 3D models from your images using Trellis 2. A native 3D generative model enabling versatile and high-quality 3D asset creation.


## Overview

- **Endpoint**: `https://fal.run/fal-ai/trellis-2/retexture`
- **Model ID**: `fal-ai/trellis-2/retexture`
- **Category**: image-to-3d
- **Kind**: inference
**Tags**: image-to-3D



## Pricing

Your request will cost 0.2 $ for 512p resolution, 0.24 $ for 1024p resolution and above.

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_):
  URL of the reference image for texturing
  - Examples: "https://v3b.fal.media/files/b/0a86b60d/xkpao5B0uxmH0tmJm0HVL_2fe35ce1-fe44-475b-b582-6846a149537c.png"

- **`mesh_url`** (`string`, _required_):
  URL of the untextured 3D mesh to retexture. Supports GLB, OBJ, PLY, and STL formats.
  - Examples: "https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/ClearCoatCarPaint/glTF-Binary/ClearCoatCarPaint.glb"

- **`seed`** (`integer`, _optional_):
  Random seed for reproducibility

- **`resolution`** (`ResolutionEnum`, _optional_):
  Internal resolution for texture generation. Higher produces finer texture details but is slower. Default value: `"1024"`
  - Default: `1024`
  - Options: `512`, `1024`

- **`tex_slat_guidance_strength`** (`float`, _optional_):
  How closely the texture follows the input image colors. Higher values produce more vivid but potentially oversaturated textures. Default value: `1`
  - Default: `1`
  - Range: `0` to `10`

- **`tex_slat_guidance_rescale`** (`float`, _optional_):
  Dampens artifacts from high guidance in the texture stage. Increase if textures look noisy or have color banding.
  - Default: `0`
  - Range: `0` to `1`

- **`tex_slat_guidance_interval_start`** (`float`, _optional_):
  Fraction of the denoising process at which classifier-free guidance starts for the texture stage. Guidance is only applied between interval_start and interval_end. Default value: `0.6`
  - Default: `0.6`
  - Range: `0` to `1`

- **`tex_slat_guidance_interval_end`** (`float`, _optional_):
  Fraction of the denoising process at which classifier-free guidance ends for the texture stage. Must be >= tex_slat_guidance_interval_start. Default value: `0.9`
  - Default: `0.9`
  - Range: `0` to `1`

- **`tex_slat_sampling_steps`** (`integer`, _optional_):
  Number of denoising steps for texture generation. More steps = slower but potentially cleaner textures. Default value: `12`
  - Default: `12`
  - Range: `1` to `50`

- **`tex_slat_rescale_t`** (`float`, _optional_):
  Controls noise schedule sharpness for texture generation. Higher values produce sharper texture details. Default value: `3`
  - Default: `3`
  - Range: `1` to `6`

- **`texture_size`** (`TextureSizeEnum`, _optional_):
  Resolution of the texture image baked onto the mesh. Higher values capture finer surface details but produce larger files. Default value: `"2048"`
  - Default: `2048`
  - Options: `1024`, `2048`, `4096`



**Required Parameters Example**:

```json
{
  "image_url": "https://v3b.fal.media/files/b/0a86b60d/xkpao5B0uxmH0tmJm0HVL_2fe35ce1-fe44-475b-b582-6846a149537c.png",
  "mesh_url": "https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/ClearCoatCarPaint/glTF-Binary/ClearCoatCarPaint.glb"
}
```

**Full Example**:

```json
{
  "image_url": "https://v3b.fal.media/files/b/0a86b60d/xkpao5B0uxmH0tmJm0HVL_2fe35ce1-fe44-475b-b582-6846a149537c.png",
  "mesh_url": "https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/ClearCoatCarPaint/glTF-Binary/ClearCoatCarPaint.glb",
  "resolution": 1024,
  "tex_slat_guidance_strength": 1,
  "tex_slat_guidance_interval_start": 0.6,
  "tex_slat_guidance_interval_end": 0.9,
  "tex_slat_sampling_steps": 12,
  "tex_slat_rescale_t": 3,
  "texture_size": 2048
}
```


### Output Schema

The API returns the following output format:

- **`model_glb`** (`File`, _required_):
  Generated 3D GLB file
  - Examples: {"url":"https://v3b.fal.media/files/b/0a86b61d/DNmTkiWHUQ8k-rG6aussB_trellis2_68d6300f70f34d23b69a912b5fe60487.glb"}



**Example Response**:

```json
{
  "model_glb": {
    "url": "https://v3b.fal.media/files/b/0a86b61d/DNmTkiWHUQ8k-rG6aussB_trellis2_68d6300f70f34d23b69a912b5fe60487.glb"
  }
}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/fal-ai/trellis-2/retexture \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "image_url": "https://v3b.fal.media/files/b/0a86b60d/xkpao5B0uxmH0tmJm0HVL_2fe35ce1-fe44-475b-b582-6846a149537c.png",
     "mesh_url": "https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/ClearCoatCarPaint/glTF-Binary/ClearCoatCarPaint.glb"
   }'
```

### 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(
    "fal-ai/trellis-2/retexture",
    arguments={
        "image_url": "https://v3b.fal.media/files/b/0a86b60d/xkpao5B0uxmH0tmJm0HVL_2fe35ce1-fe44-475b-b582-6846a149537c.png",
        "mesh_url": "https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/ClearCoatCarPaint/glTF-Binary/ClearCoatCarPaint.glb"
    },
    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("fal-ai/trellis-2/retexture", {
  input: {
    image_url: "https://v3b.fal.media/files/b/0a86b60d/xkpao5B0uxmH0tmJm0HVL_2fe35ce1-fe44-475b-b582-6846a149537c.png",
    mesh_url: "https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/ClearCoatCarPaint/glTF-Binary/ClearCoatCarPaint.glb"
  },
  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);
```


## Additional Resources

### Documentation

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

### fal.ai Platform

- [Platform Documentation](https://docs.fal.ai)
- [Python Client](https://docs.fal.ai/clients/python)
- [JavaScript Client](https://docs.fal.ai/clients/javascript)
