Skip to content

Commit 9c4d16e

Browse files
update Open Source Docs from Roblox internal teams
1 parent 735e301 commit 9c4d16e

File tree

1 file changed

+55
-48
lines changed

1 file changed

+55
-48
lines changed

content/en-us/reference/engine/classes/GenerationService.yaml

Lines changed: 55 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,23 @@ type: class
33
category:
44
memory_category: Instances
55
summary: |
6-
Generate 3D objects from text prompts using Roblox's
7-
[Cube 3D foundation model](https://corp.roblox.com/newsroom/2025/03/introducing-roblox-cube).
6+
`GenerationService` is a service that allows developers to generate 3D objects from text prompts utilizing Roblox's [Cube 3D foundation model](https://corp.roblox.com/newsroom/2025/03/introducing-roblox-cube).
87
description: |
9-
`GenerationService` lets you generate 3D objects from text prompts using
10-
Roblox's [Cube 3D foundation model](https://corp.roblox.com/newsroom/2025/03/introducing-roblox-cube).
8+
`GenerationService` is a service that allows developers to generate 3D objects from text prompts utilizing Roblox's [Cube 3D foundation model](https://corp.roblox.com/newsroom/2025/03/introducing-roblox-cube).
9+
10+
Mesh generation is a two step process:
11+
12+
1. `Class.GenerationService:GenerateMeshAsync()|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.
13+
2. `Class.GenerationService:LoadGeneratedMeshAsync()|LoadGeneratedMeshAsync()` loads the generated mesh into the experience. The mesh is returned as a `Class.MeshPart` containing an `Class.EditableMesh`.
14+
15+
Currently, GenerationService only supports the following usage:
16+
17+
- `Class.GenerationService:GenerateMeshAsync()|GenerateMeshAsync()` must be called from server scripts.
18+
- `Class.GenerationService:LoadGeneratedMeshAsync()|LoadGeneratedMeshAsync()` must be called from client scripts.
19+
20+
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 `Class.GenerationService:LoadGeneratedMeshAsync()|LoadGeneratedMeshAsync()` and retrieve the mesh. Note that since the generated mesh is loaded with `Class.EditableMesh` content and only on the client, it is not replicated to any other clients.
21+
22+
The following code illustrates this design pattern. See [this demo experience](https://www.roblox.com/games/86571743597273/Mesh-Generation-Template) for a more detailed example. Click the **⋯** button and **Edit in Studio**.
1123
code_samples:
1224
- GenerationService-ServerSideMeshGeneration
1325
- GenerationService-ClientSideMeshGeneration
@@ -21,27 +33,33 @@ properties: []
2133
methods:
2234
- name: GenerationService:GenerateMeshAsync
2335
summary: |
24-
Generates a new mesh from a text prompt and returns unique IDs to track
25-
and retrieve the result.
36+
Starts the generation of a new 3D mesh from a text prompt and returns
37+
unique IDs used to track and retrieve the result. After the generation is
38+
complete, use
39+
`Class.GenerationService:LoadGeneratedMeshAsync()|LoadGeneratedMeshAsync()`
40+
to load and display the generated mesh.
2641
description: |
27-
Generates a new mesh from a text prompt and returns unique IDs to track
28-
and retrieve the result. Mesh generation happens in two stages, with an
29-
initial non-textured mesh being generated first and the texture generated
30-
in the second stage. To retrieve more intermediate results, use the
31-
optional callback to retrieve the initial generated mesh before the
32-
texture has been created and applied.
42+
Starts the generation of a new 3D mesh from a text prompt and returns
43+
unique IDs used to track and retrieve the result. You can optionally
44+
receive intermediate results, such as the untextured mesh, by providing an
45+
`intermediateResultCallback` function. After the generation is complete,
46+
use `Class.GenerationService:LoadGeneratedMeshAsync|LoadGeneratedMeshAsync()`
47+
to load and display the generated mesh.
3348
34-
For a more detailed example, see
35-
[this demo experience](https://www.roblox.com/games/86571743597273/Mesh-Generation-Template).
36-
Click the **⋯** button and **Edit in Studio**.
49+
**Rate limits**
3750
38-
- The `GenerateMeshAsync()` method triggers the mesh generation and returns
39-
the generation ID which can then be loaded with the
40-
`LoadGeneratedMeshAsync()` method after the generation process
41-
completes.
42-
- The `GenerateMeshAsync()` method can only be called on the server.
43-
- Requests are limited to 5 per minute, per experience.
51+
There is a rate limit of 5 generations per minute per experience. If you
52+
exceed this limit, further generation requests are blocked until the next
53+
minute.
4454
55+
**Error codes**
56+
57+
| Error | Description | Recommended developer action |
58+
| ----- | ----------- | ---------------------------- |
59+
| Rate limit exceeded | The maximum number of mesh generations has been exceeded for the minute. | Wait until the rate limit resets. |
60+
| Moderation failure | The mesh generation was flagged for moderation. | Review and modify the prompt to ensure it adheres to Roblox's moderation guidelines. |
61+
| Internal server error | An unexpected issue occurred on the server. | Retry the request later or check server status for issues. |
62+
| 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. |
4563
code_samples:
4664
- GenerationService-GenerateMeshAsync-BasicUsage
4765
- GenerationService-GenerateMeshAsync-WithIntermediateResultsCallback
@@ -51,30 +69,29 @@ methods:
5169
type: Dictionary
5270
default:
5371
summary: |
54-
Mesh generation inputs. Must include a `Prompt` key with a string
55-
value describing the object to generate.
72+
A dictionary containing the mesh generation prompts. Currently, the only supported key is the `Prompt` (string) that describes the mesh to generate.
5673
- name: player
5774
type: Player
5875
default:
5976
summary: |
60-
The player requesting the generation.
77+
The `Class.Player` requesting the generation.
6178
- name: options
6279
type: Dictionary
6380
default:
6481
summary: |
65-
Mesh generation options (none currently available).
82+
Additional generation options. Currently, no options are supported.
6683
- name: intermediateResultCallback
6784
type: Function?
6885
default:
6986
summary: |
70-
Optional function that receives intermediate generations. The callback
71-
receives three parameters: `intermediateType` (an enum indicating the
72-
type of intermediate result), `generationId` (string), and `contextId`
73-
(string).
87+
A callback function triggered with intermediate generation results. Useful for retrieving early mesh versions (e.g. before textures are applied).
7488
returns:
7589
- type: Tuple
7690
summary: |
7791
A tuple of generation ID and context ID.
92+
93+
- Generation ID: A unique ID returned for each invocation of `GenerateMeshAsync()`.
94+
- Context ID: Not currently used.
7895
tags:
7996
- Yields
8097
deprecation_message: ''
@@ -84,36 +101,26 @@ methods:
84101
writeCapabilities: []
85102
- name: GenerationService:LoadGeneratedMeshAsync
86103
summary: |
87-
Loads a generated mesh from RCC using the generation ID. The generated
88-
mesh is an `Class.MeshPart`.
104+
Retrieves and loads a mesh generated by `Class.GenerationService:GenerateMeshAsync()`
105+
using the provided `generationId`. The mesh is returned as a `Class.MeshPart`
106+
with `Class.EditableMesh` content.
89107
description: |
90-
Loads the mesh generated by `Class.GenerationService:GenerateMeshAsync()|GenerateMeshAsync()`
91-
using the `generationId` and returns a `Class.MeshPart` with the editable
92-
content. The resulting generation is then subject to `Class.EditableMesh`
93-
characteristics.
94-
95-
For a more detailed example, see
96-
[this demo experience](https://www.roblox.com/games/86571743597273/Mesh-Generation-Template).
97-
Click the **⋯** button and **Edit in Studio**.
98-
99-
Currently, the `LoadGeneratedMeshAsync()` method can only be called on
100-
the client due to the restrictions on replicating editable meshes. This
101-
means that only one player will be able to see the generated mesh, as this
102-
function can only be called once per `generationId`.'
103-
108+
Retrieves and loads a mesh generated by `Class.GenerationService:GenerateMeshAsync()`
109+
using the provided generationId. The mesh is returned as a `Class.MeshPart`
110+
with `Class.EditableMesh` content. Because editable meshes are not replicated,
111+
the loaded mesh is not replicated to any other clients and can only be loaded once per `generationId`.
104112
code_samples:
105113
- GenerationService-LoadGeneratedMeshAsync-LoadAGeneratedMesh
106114
parameters:
107115
- name: generationId
108116
type: string
109117
default:
110118
summary: |
111-
The generation ID returned by
112-
`Class.GenerationService:GenerateMeshAsync()|GenerateMeshAsync()`.
119+
The unique ID returned by `Class.GenerationService:GenerateMeshAsync()|GenerateMeshAsync()`. Identifies the mesh to load.
113120
returns:
114121
- type: MeshPart
115122
summary: |
116-
The generated `Class.MeshPart`.
123+
The generated mesh, returned as a `Class.MeshPart` containing an `Class.EditableMesh`.
117124
tags:
118125
- Yields
119126
deprecation_message: ''

0 commit comments

Comments
 (0)