Retopology (Enterprise)
Quick Primer

Quick Primer on Retopology

Retopology offers options for mesh optimization and topology generation:

Models:

  • Swift: Fast meshes for mobile and low-poly use.
  • Precision: Detailed, clean meshes for complex assets.

Output Options:

  • Quads: If true, convert triangles to quads where possible. The resulting mesh may have mixed topology.

Note: Retopology is currently only available to enterprise customers. The current limit for retopology jobs is 5 concurrent jobs.

Here's a quick example of how to use the API:

import requests
import json
import time
 
def create_retopology_session(mesh):
    url = "https://api.csm.ai/v3/sessions/"
    
    payload = json.dumps({
        "type": "retopology",
        "input": {
            "model": "swift", # or "precision"
            "mesh": mesh,
            "quads": True
        }
    })
    
    headers = {
        'x-api-key': '<X-API_KEY>',
        'Content-Type': 'application/json'
    }
    
    response = requests.post(url, headers=headers, data=payload)
    return response.json()
 
def get_session_status(session_id):
    url = f"https://api.csm.ai/v3/sessions/{session_id}"
    headers = {
        'x-api-key': '<X-API_KEY>',
        'Content-Type': 'application/json'
    }
    
    response = requests.get(url, headers=headers)
    return response.json()
 
# Create a retopology session
session = create_retopology_session("https://your-mesh-url.com/mesh.glb") # or "ASSET_<ID>"
session_id = session["_id"]
 
# Poll for completion
while True:
    status = get_session_status(session_id)
    if status["status"] == "complete":
        # Get the first retopologized mesh's OBJ URL
        obj_url = status["output"]["meshes"][0]["data"]["obj_url"]
        print(f"Retopology complete! OBJ URL: {obj_url}")
        break
    elif status["status"] == "failed":
        print("Retopology failed")
        break
    time.sleep(30)  # Wait 30 seconds before checking again

Create

To start a retopology session, provide the input GLB mesh URL (or Cube asset ID) along with the desired settings as described in the Create Session (opens in a new tab) documentation.

Processing

Once the session is created, the system will process the mesh:

  • Duration: Approximately 5-10 minutes for swift, up to 50 minutes for precision
  • Session status during processing: incomplete
  • Session status upon completion: complete
  • Session status upon failure: failed

Output

The retopology process generates multiple variations of the retopologized mesh. Each variation will have an OBJ file URL.