All Products
Search
Document Center

PolarDB:ST_Simplify

Last Updated:Mar 28, 2026

Simplifies a 3D model in a scene object based on a JSON rule set.

Syntax

scene ST_Simplify(scene sc, cstring rules);

Parameters

ParameterDescription
scThe scene object to simplify.
rulesThe simplification rule, in JSON format. See Rule fields for the full specification.

Rule fields

Pass the rules parameter as a JSON object with the following fields:

{
  "mothed": "percent",
  "threshold": 0.5,
  "blacklist": ["wall", "glass"],
  "boundary": true,
  "meshes": [
    {"names": ["m0", "m1"], "threshold": 0.5},
    {"names": ["m2", "m3"], "threshold": 0.001}
  ]
}
FieldDescription
mothedThe simplification method. Valid values: percent, error. Default value: percent.
thresholdThe simplification threshold. The valid range depends on the mothed value. Default value: 0.5.
blacklistThe names of mesh objects to exclude from simplification. Mesh objects in this list are not simplified.
boundarySpecifies whether to simplify the boundary of the model. Default value: true.
meshes[].namesGroups mesh objects by name for independent simplification.
meshes[].thresholdThe simplification threshold for the mesh group.

Simplification methods

percent — reduces the number of triangles to a percentage of the original count.

  • Valid values: (0, 1) (exclusive)

  • A value of 0.1 retains 10% of the original triangles. Lower values produce more aggressive simplification.

error — controls simplification by the geometric error of the result, measured as the distance from the new vertex to the original vertex.

  • Valid values: (0, +inf) (exclusive)

  • Higher values produce more aggressive simplification.

Boundary simplification

Warning

Simplifying boundaries ("boundary": true) may cause the model to collapse or break. Disable boundary simplification for models where edge integrity is critical.

Per-mesh group thresholds

Use the meshes field to apply different thresholds to different parts of a model. For example, apply a higher threshold (less simplification) to high-precision meshes and a lower threshold (more simplification) to low-precision meshes.

Usage notes

Model simplification reduces storage size without affecting the visual appearance in rendering. The table below shows the effect on a sample model:

Simplification settingStorage sizeResult
100% (no simplification)96 MB100% simplification
5% geometry + 25% image2.9 MB5%+25%

Example

The following example simplifies a scene stored in table t. The global threshold is 10% (retaining 10% of triangles). Three meshes are excluded from simplification via the blocklist. Two mesh groups use independent thresholds.

SELECT ST_Simplify(data,
                    '{
                        "threshold": 0.1,
                        "mothed": "percent",
                        "blacklist":["Mesh.012", "Mesh.009", "Mesh.005"],
                        "meshes": [
                            {"names":["Mesh.007"], "threshold": 0.01},
                            {"names":["Mesh.004"], "threshold": 0.3}
                        ]}') from t;
---------------------------
0x.....