GenerationService
GenerationService
is a service that allows developers to generate 3D objects from text prompts utilizing Roblox's Cube 3D foundation model.
Memory category | Instances |
---|
Member index 5
Description
GenerationService
is a service that allows developers to generate 3D objects from text prompts utilizing Roblox's Cube 3D foundation model.
Mesh generation is a two step process:
- GenerateMeshAsync() starts the mesh generation process using a text prompt and other required parameters. It returns a unique identifier (generation ID) that can be used to retrieve the future result.
- LoadGeneratedMeshAsync() loads the generated mesh into the experience. The mesh is returned as a MeshPart containing an EditableMesh.
Currently, GenerationService only supports the following usage:
- GenerateMeshAsync() must be called from server scripts.
- LoadGeneratedMeshAsync() must be called from client scripts.
As a result, when a mesh generation request originates from a client, the client must send a signal to the server to initiate generation. Once the server determines that generation is complete, it should notify the appropriate client to call LoadGeneratedMeshAsync() and retrieve the mesh. Note that since the generated mesh is loaded with EditableMesh content and only on the client, it is not replicated to any other clients.
The following code illustrates this design pattern. See this demo experience for a more detailed example. Click the ⋯ button and Edit in Studio.
History 6
- 662 Add InternalGenerateMeshAsync
- 661 Add
- 661 Add
- 661 Add LoadGeneratedMeshAsync
- 661 Add GenerateMeshAsync
- 661 Add GenerationService
Members 5
GenerateMeshAsync
Parameters (4) | ||
---|---|---|
inputs | Dictionary | |
player | Player | |
options | Dictionary | |
intermediateResultCallback | Function? | |
Returns (1) | ||
Tuple |
Starts the generation of a new 3D mesh from a text prompt and returns
unique IDs used to track and retrieve the result. You can optionally
receive intermediate results, such as the untextured mesh, by providing an
intermediateResultCallback
function. After the generation is complete,
use LoadGeneratedMeshAsync()
to load and display the generated mesh.
Rate limits
There is a rate limit of 5 generations per minute per experience. If you exceed this limit, further generation requests are blocked until the next minute.
Error codes
Error | Description | Recommended developer action |
---|---|---|
Rate limit exceeded | The maximum number of mesh generations has been exceeded for the minute. | Wait until the rate limit resets. |
Moderation failure | The mesh generation was flagged for moderation. | Review and modify the prompt to ensure it adheres to Roblox's moderation guidelines. |
Internal server error | An unexpected issue occurred on the server. | Retry the request later or check server status for issues. |
Character limit exceeded | The input prompt length for this generation request exceeded the limit. | Reduce the number of characters in the Prompt string of the input dictionary. |
Thread safety | Unsafe |
---|
History 1
- 661 Add GenerateMeshAsync
InternalGenerateMeshAsync
Parameters (4) | ||
---|---|---|
inputs | Dictionary | |
userId | int64 | |
options | Dictionary | |
intermediateResultCallback | Function? | |
Returns (1) | ||
Tuple |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 1
LoadGeneratedMeshAsync
Parameters (1) | ||
---|---|---|
generationId | string | |
Returns (1) | ||
MeshPart |
Retrieves and loads a mesh generated by GenerationService:GenerateMeshAsync()
using the provided generationId. The mesh is returned as a MeshPart
with EditableMesh content. Because editable meshes are not replicated,
the loaded mesh is not replicated to any other clients and can only be loaded once per generationId
.
Thread safety | Unsafe |
---|