# Welcome

<figure><img src="/files/EteyySkobk46UP7eEsNh" alt=""><figcaption><p>Developer Documentation</p></figcaption></figure>

## <kbd>Transform Text into 3D Reality</kbd>

[MeshifAI ](https://meshifai.com)empowers developers to generate high-quality 3D models from simple text descriptions. With our advanced AI technology, creating complex 3D assets is now as simple as writing a sentence.

<figure><img src="/files/E9y6EBfRWMw4gzFqSO6c" alt=""><figcaption><p>Example models</p></figcaption></figure>

### Instant 3D Generation

Transform ideas into 3D models in seconds. No modeling experience required – just describe what you want, and our AI handles the rest.

### Developer-First Approach

Built by developers, for developers. Our API and SDKs integrate seamlessly with your existing workflows and applications.

### Versatile Applications

From gaming and VR to e-commerce and education, MeshifAI can revolutionize how you create and implement 3D content.

### Key Features

* **Text-to-3D Generation**: Describe any object, character, or environment in plain English
* **Customizable Outputs**: Control the creative variance of your models
* **Fast Processing**: Get results in seconds, not hours
* **Flexible Integration**: JavaScript SDK available now, Unity SDK coming soon
* **WebGL Compatible**: Generated models work directly in browsers
* **Production-Ready**: High-quality models suitable for commercial applications

### Join Our Growing Community

Thousands of developers are already using MeshifAI to revolutionize their 3D content creation workflow.&#x20;


# Getting Started


# Installation

Get started with the MeshifAI JavaScript SDK by installing it via [NPM](https://www.npmjs.com/package/@0xretrodev/meshifai):

```bash
npm install @0xretrodev/meshifai
```

Or using Yarn:

```bash
yarn add @0xretrodev/meshifai
```

## Requirements

* Node.js 14 or later
* npm or yarn package manager

## Importing the SDK

ES6/TypeScript:

```bash
import meshifai from '@0xretrodev/meshifai'
```


# Quick Start

Get up and running with the MeshifAI JavaScript SDK in minutes.\
\
You can generate both `Textured` and `Untextured` models. Textured models can often put a lot of strain on the server and may not be as reliable as untextured models but provide a much higher quality result.

### <kbd>Basic Setup</kbd>

```javascript
import meshifai from '@0xretrodev/meshifai';

// Generate an untextured model (faster and more reliable)
const result = await meshifai.textTo3d('A cute cat');
console.log(`Download URL: ${result.modelUrl}`);

// Generate a textured model with PBR materials
const texturedResult = await meshifai.textTo3d('A red apple', { 
  textured: true 
});
console.log(`Download URL: ${texturedResult.modelUrl}`);


```

{% hint style="warning" %}
Please note that `Textured Models` can take longer to generate and are highly experimental.
{% endhint %}

### <kbd>Additional Options</kbd>

The `textTo3d` function accepts an optional second parameter with options for `untextured` models:

```javascript
// The highRes parameter controls the quality of the model generation
// false = standard quality (faster), true = high resolution (better quality, slower)
const url = await meshifai.textTo3d('A luxury sports car', {
  highRes: true
});
```

\
The `textTo3d` function also accepts an optional second parameter with options for `textured` models:

```javascript
// Generate a high-quality textured model by increasing polygon count
const highQualityResult = await meshifai.textTo3d('A red apple', { 
  textured: true,
  polygons: 50000  // Default is 25000, higher = better quality
});
console.log(`Download URL: ${highQualityResult.modelUrl}`);
```

### <kbd>Model Format</kbd>

The generated 3D models are in `.glb` format (GL Transmission Format Binary), which is widely supported by:<br>

* 3D modeling software like Blender
* Game engines like Unity and Unreal
* Web-based 3D viewers
* AR/VR applications

More formats coming soon!


# Getting Started


# Installation

## <kbd>MeshifAI Unity SDK Installation</kbd>

The Official MeshifAI Unity Package can be downloaded from our official mirror by clicking [here](http://api.meshifai.com/packages/unity/MeshifAI.unitypackage).\
\
Once you've downloaded the `.unitypackage` file, you can simply drag and drop it into your Unity window to add MeshifAI to your current project.\ <br>

<figure><img src="/files/dyrDps6Zn3ErsbHA6WOr" alt=""><figcaption><p>Click on 'Import'</p></figcaption></figure>

Once you've completed the above you should note the new folder in your **Unity** project. If you can see this folder, you have successfully added the MeshifAI SDK to your project and can start building.\ <br>

<figure><img src="/files/alNhLkjCGwUyKGTgGEGs" alt=""><figcaption></figcaption></figure>

**Below are some quick links to get you started:**

{% content-ref url="/pages/ALHliAC2nPmKlJVULnQl" %}
[Broken mention](broken://pages/ALHliAC2nPmKlJVULnQl)
{% endcontent-ref %}

{% content-ref url="/pages/Yz6VCXvWEcOWGUJyCbIV" %}
[Scripting API](/unity-engine/scripting-api)
{% endcontent-ref %}


# Editor Tool

## <kbd>MeshifAI Editor Tool</kbd>&#x20;

The MeshifAI Unity Editor tool allows you to generate simple meshes from text and preview them prior to either saving them, or generating a new prompt.\
\
Simply click on the Window item called `MeshifAI` and then on `Text-To-3D`<br>

<br>

<figure><img src="/files/GezSmQOf9Z9fKwhm0USr" alt=""><figcaption><p>Getting to the editor tool</p></figcaption></figure>

After you've opened the tool, you'll be able to enter your desired prompt and click on `Generate Model`&#x20;

<figure><img src="/files/7c5CFq9jYsFGuJ5Nwq00" alt=""><figcaption><p>Generating a new model</p></figcaption></figure>

Once a model has finished generating, you'll be able to preview it and choose whether or not you'd like to save it within your project for use later. \ <br>

<figure><img src="/files/zdLfKgPWEoQUUYdCiPot" alt=""><figcaption><p>Previewing our model</p></figcaption></figure>

{% hint style="success" %}
Don't like your model? No problem! You don't have to save it and can simply try again.
{% endhint %}

Now that your model has been generated and saved, you'll find it under `Assets/GeneratedModels/{ModelName}/{ModelName}.glb`&#x20;

{% hint style="info" %}
Need Support? Feel free to reach out to us over `hello@0xretro.dev` or twitter on `@0xretrodev`
{% endhint %}


# Scripting API


# Quick Start

## <kbd>Quick Start Guide</kbd>&#x20;

Getting started with the MeshifAI Scripting API is simply and easy to use. Let's dive into using it below.

### <kbd>Basic Usage</kbd>

Here's a simple example to generate a 3D model from a text description:

```csharp
using UnityEngine;
using MeshifAI.Core;

public class QuickStartExample : MonoBehaviour
{
    private void Start()
    {
        // Generate a model with a simple description
        Meshifai.GenerateModel(
            "A futuristic spaceship",
            OnModelGenerated
        );
    }
    
    private void OnModelGenerated(GameObject model)
    {
        // Position the model in your scene
        model.transform.SetParent(transform);
        model.transform.localPosition = Vector3.zero;
        
        // That's it! Your AI-generated model is ready to use
        Debug.Log("Model generated successfully!");
    }
}
```

### <kbd>Adding Error Handling</kbd>

For more robust implementation, add error handling:

```csharp
Meshifai.GenerateModel(
    "A medieval castle",
    OnModelGenerated,
    OnGenerationError
);

private void OnGenerationError(string errorMessage)
{
    Debug.LogError($"Generation failed: {errorMessage}");
}
```

### <kbd>Showing Progress Updates</kbd>

Keep your users informed with progress updates:

```csharp
Meshifai.GenerateModel(
    "A fantasy sword",
    OnModelGenerated,
    OnGenerationError,
    OnGenerationStatus
);

private void OnGenerationStatus(string status, float progress)
{
    // Update your UI with the current generation status
    Debug.Log($"{status} - {progress:P0} complete");
}
```

### <kbd>Accessing Model Metadata</kbd>

Each generated model includes metadata about how it was created:

```csharp
private void OnModelGenerated(GameObject model)
{
    // Get the generation data component
    ModelGenerationData data = model.GetComponent<ModelGenerationData>();
    
    // Access generation parameters
    Debug.Log($"Model prompt: {data.Prompt}");
    Debug.Log($"Model variance: {data.Variance}");
    Debug.Log($"Generated at: {data.GenerationTime}");
}
```

Now that you have a general understanding, you're ready to dive into the world of 3D Model generation. \
\
We look forward to see what you choose to build with it.

{% hint style="info" %}
Need Support? Feel free to reach out to us over `hello@0xretro.dev` or twitter on `@0xretrodev`
{% endhint %}


# API Reference

## <kbd>MeshifAI API Reference</kbd>

### <kbd>Core API</kbd>

#### `Meshifai.GenerateModel`

The primary method for generating 3D models from text descriptions.

```csharp
public static object GenerateModel(
    string prompt,
    Action<GameObject> onComplete,
    Action<string> onError = null,
    Action<string, float> onStatus = null,
    float variance = 0.2f,
    bool applyDefaultMaterial = true
)
```

**Parameters**

| Parameter              | Type                   | Description                                                       |
| ---------------------- | ---------------------- | ----------------------------------------------------------------- |
| `prompt`               | string                 | Text description of the model to generate                         |
| `onComplete`           | Action\<GameObject>    | Callback when generation completes successfully                   |
| `onError`              | Action\<string>        | (Optional) Callback when an error occurs                          |
| `onStatus`             | Action\<string, float> | (Optional) Callback for status updates (message and progress 0-1) |
| `highRes`              | bool                   | (Optional) Controls the output quality of the genereted model     |
| `applyDefaultMaterial` | bool                   | (Optional) Whether to apply a default material                    |

**Returns**

* `object`: A handle that can be used to cancel the generation

**Example**

```csharp
var handle = Meshifai.GenerateModel(
    "A cyberpunk city building",
    model => {
        // Handle the completed model
    },
    error => {
        // Handle any errors
    },
    (status, progress) => {
        // Show generation progress
    },
    highRes: true
);
```

#### `Meshifai.CancelGeneration`

Cancels an in-progress model generation.

```csharp
public static void CancelGeneration(object handle)
```

**Parameters**

| Parameter | Type   | Description                          |
| --------- | ------ | ------------------------------------ |
| `handle`  | object | The handle returned by GenerateModel |

**Example**

```csharp
// Start generation and store the handle
var handle = Meshifai.GenerateModel("A dragon", OnModelGenerated);

// Later, cancel the generation if needed
Meshifai.CancelGeneration(handle);
```

#### `Meshifai.CloneModel`

Creates a copy of an existing MeshifAI-generated model, preserving all metadata.

```csharp
public static GameObject CloneModel(GameObject originalModel)
```

**Parameters**

| Parameter       | Type       | Description                |
| --------------- | ---------- | -------------------------- |
| `originalModel` | GameObject | The original model to copy |

**Returns**

* `GameObject`: A new copy of the model with all generation data preserved

**Example**

```csharp
// Clone an existing MeshifAI model
GameObject original = /* a MeshifAI-generated model */;
GameObject copy = Meshifai.CloneModel(original);
```

### <kbd>ModelGenerationData Component</kbd>

Each generated model has a `ModelGenerationData` component attached that contains information about how it was created.

#### Properties

| Property         | Type     | Description                                        |
| ---------------- | -------- | -------------------------------------------------- |
| `Prompt`         | string   | The text description used to generate the model    |
| `highRes`        | bool     | Controls the output quality of the genereted model |
| `GenerationTime` | DateTime | When the model was generated                       |

#### `Example`

```csharp
// Accessing generation data
ModelGenerationData data = model.GetComponent<ModelGenerationData>();
Debug.Log($"Generated from prompt: {data.Prompt}");
Debug.Log($"High resolution: {data.HighRes}");
Debug.Log($"At time: {data.GenerationTime}");
```

{% hint style="info" %}
Need Support? Feel free to reach out to us over `hello@0xretro.dev` or twitter on `@0xretrodev`
{% endhint %}


