Merges multiple texture images in a 3D model into a single texture image of a specified pixel size.
Syntax
scene ST_CombineTextures(scene sc, int4 expected_size);Parameters
| Parameter | Type | Description |
|---|---|---|
sc | scene | The scene object. If not specified, the function returns NULL. |
expected_size | int4 | The pixel size of the merged texture image. Must be greater than 0. The output image is square—for example, setting this to 256 produces a 256 x 256 pixel image. |
Description
ST_CombineTextures combines all texture images in a 3D model into one square texture image. The pixel dimensions of the merged image are determined by expected_size.
Error behavior:
If
scis not specified, the function returns NULL.If
expected_sizeis less than or equal to 0, the function reports an error.
Examples
The following example merges multiple 256 x 256 pixel texture images from a scene into a single 4,096 x 4,096 pixel texture image.
SELECT ST_AsText(ST_CombineTextures(scene, 4096)) from t;The function returns a scene object in glTF format:
{"type" : "gltf", "content" : {"accessors":[{"bufferView":0,......One of the source texture images (256 x 256):

Merged texture image (4,096 x 4,096):
