Generate Texture
贴图生成
This API will generate textures and 3D model for the given images, prompt and 3D model.
授权
请求体
imagestring · binary必填
promptstring可选
modelstring · binary必填
seednumber可选
geometry_file_formatstring · enum可选Default:
glb可能的值: materialstring · enum可选Default:
PBR可能的值: escorenumber可选Default:
3.5reference_scalenumber可选Default:
1resolutionstring · enum可选Default:
Basic可能的值: 响应
201成功
application/json
post
/api/v2/rodin_texture_onlycurl https://api.hyper3d.com/api/v2/rodin_texture_only \
--request POST \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
--header 'Content-Type: multipart/form-data' \
--file 'image=@/path/to/your/image.png' \
--file "model=@/path/to/your/model.obj" \
--file "geometry_file_format=glb" \
--file "material=PBR" \
--file "escore=3.5" \
--file "reference_scale=1" \
--file "resolution=Basic" \
...
201成功
{
"error": "text",
"message": "text",
"uuid": "text",
"submit_time": "text",
"jobs": {
"uuids": [
"text"
],
"subscription_key": "text"
}
}贴图生成
使用此API向我们的服务器提交异步任务。你将从API中获得一个任务UUID,该UUID可用于检查进度和下载结果。
价格
每次调用该API生成需要消耗 0.5 credits。
Request
Authentication
此API使用密钥进行身份验证。您需要在所有请求的Authorization头中包含一个有效的密钥. 参阅快速开始获取您的账户的API生成密钥。
Authorization: Bearer RODIN_API_KEYBody
参数
类型
描述
image
file/Binary
必须. 上传一张图片文件作为生成贴图的图片参考。
prompt
string
可选的。一段描述贴图的文字,指导贴图生成。
model
file/Binary
必须. 上传一个二进制的三维模型文件进行处理。
seed
number
可选的。网格生成中用于随机化的种子值,范围从0到65535(包括两者)。如果不提供,种子将随机生成。
reference_scale
number
可选的。表示纹理生成过程中的参考尺寸。
geometry_file_format
string
可选的。模型文件的格式。可能的值为glb,usdz,fbx,obj,stl。默认值为glb。
material
string
可选的。材质类型。可能的值为PBR和Shaded。默认值为PBR。
resolution
string
可选的。 输出贴图的分辨率。可能的值为Basic 和 High. 默认是Basic.
样例
export RODIN_API_KEY="your api key"
curl https://api.hyper3d.com/api/v2/rodin_texture_only \
-H "Authorization: Bearer ${RODIN_API_KEY}" \
-F "image=@/path/to/your/image.jpg" \
-F "model=@path/to/your/model.obj" \
-F "reference_scale=1.0" \
-F "geometry_file_format=glb" \
-F "material=PBR" \
-F "resolution=High"
unset RODIN_API_KEYimport requests
# Constants
ENDPOINT = "https://api.hyper3d.com/api/v2/rodin_texture_only"
API_KEY = "your api key" # Replace with your actual API key
IMAGE_PATH = "/path/to/your/image.jpg" # Replace with the path to your image
MODEL_PATH = "/path/to/your/model.obj"
# Prepare the headers
headers = {
'Authorization': f'Bearer {API_KEY}',
}
# Prepare the form data
files = {
'image': (os.path.basename(IMAGE_PATH), image_data, 'image/jpeg'),
'model': (os.path.basename(MODEL_PATH), model_data, 'model/obj'),
'reference_scale': (None, 1.0),
'geometry_file_format': (None, 'glb'),
'material': (None, PBR),
'resolution': (None, 'High'),
}
# Make the POST request
response = requests.post(ENDPOINT, headers=headers, files=files)
# Parse and return the JSON response
print(response.json())
{
"error": null,
"message": "Submitted.",
"uuid": "123e4567-e89b-12d3-a456-426614174000",
"jobs": {
"uuids": ["job-uuid-1", "job-uuid-2"],
"subscription_key": "sub-key-1"
}
}最后更新于
这有帮助吗?