All Products
Search
Document Center

PolarDB:ST_Simplify

Last Updated:Mar 28, 2026

ST_Simplify reduces the vertex count of a 3D scene to decrease storage size without affecting visual output.

Syntax

scene ST_Simplify(scene sc, cstring rules);

Parameters

ParameterTypeDescription
scsceneThe scene object to simplify.
rulescstringA JSON string that controls the simplification behavior. See Rules for the full schema.

Rules

Pass a JSON object to rules to configure how simplification is applied. All fields are optional and fall back to their defaults.

{
  "mothed": "percent",
  "threshold": 0.5,
  "blacklist": ["wall", "glass"],
  "boundary": true,
  "meshes": [
    {"names": ["m0", "m1"], "threshold": 0.5},
    {"names": ["m2", "m3"], "threshold": 0.001}
  ]
}
FieldTypeDefaultDescription
mothedstring"percent"The simplification method. Valid values: "percent", "error".
thresholdnumber0.5The simplification threshold. Semantics depend on mothed. See Threshold behavior.
blacklistarray of stringsMesh names to exclude from simplification. Meshes in this list are left unchanged.
boundarybooleantrueSpecifies whether to simplify boundary geometry.
meshesarray of objectsPer-group simplification overrides. Each entry specifies a list of mesh names and a threshold that applies only to those meshes.
meshes[].namesarray of stringsThe mesh names in this group.
meshes[].thresholdnumberThe simplification threshold for this group, overriding the top-level threshold.

Threshold behavior

The meaning of threshold changes based on the mothed value:

mothedthreshold rangeMeaningDirection
"percent"(0, 1)Ratio of triangles retained after simplification to the original count. A value of 1 retains all triangles (no simplification); a value close to 0 produces maximum simplification.Lower = more simplified
"error"(0, +∞)Maximum allowed distance (in model coordinate units) from a new vertex to its original position. A larger value permits greater deviation and produces more simplification.Higher = more simplified

Boundary simplification

Warning

If the boundary is simplified, the model may be collapsed or broken. Test with a copy of your model before applying to production data.

Per-mesh group overrides

Use the meshes field to apply different thresholds to specific mesh groups. This lets you simplify high-detail meshes aggressively while preserving detail in others.

For example, set a high threshold (less simplification) for architectural detail meshes and a low threshold (more simplification) for background geometry.

Examples

The following example simplifies a scene using the percent method with a global threshold of 0.1 (retaining 10% of triangles), excludes three meshes from simplification, and applies custom thresholds to two mesh groups.

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;

Storage impact

Simplification significantly reduces model storage size without affecting visual output.

Simplification settingsStorage size
100% (no simplification)96 MB
5% geometric + 25% image simplification2.9 MB

100% (no simplification)

100% simplification

5% geometric + 25% image simplification

5%+25%