This topic describes the ST_Simplify function. This function simplifies a 3D model.

Syntax

scene  ST_Simplify(scene sc, cstring rules);

Parameters

ParameterDescription
scThe scene object.
rulesThe rule that is used to simplify the 3D model.

Description

This function simplifies the 3D model based on the rule that you specified. The rule is in the JSON format.
{
  "mothed": "percent"/"error", default is "percent",
  "threshold": default is 0.5,
  "blacklist" : ["wall","glass"],
  "boundary": default is true, simplify the boundary,
  "meshes":[
    {"names": ["m0","m1"], "threshold": 0.5},
    {"names": ["m2","m3"], "threshold": 0.001}
  ]
}
The following table describes the fields in the JSON value.
FieldDescription
mothedThe method that is used to control the simplification. Valid values:
  • percent: the percentage of triangular surfaces. Valid values: (0, 1)
  • error: the geometric error of the result. Valid values: (0, +inf).
Note percent indicates the percentage of the number of triangular surfaces after the simplification to the number of triangular surfaces in the original model. A smaller value indicates that the model is more simplified. error indicates the distance from the new vertex to the original vertex. A larger value indicates that the model is more simplified.
thresholdThe threshold of the simplification. For more information about valid values, see the description of the mothed parameter.
blacklistThe blacklist of the simplification. The mesh objects in the model are filtered by name. Mesh objects that are in the blacklist are not simplified.
boundarySpecifies whether to simplify the boundary. Default value: true.
Note If the boundary is simplified, the model may be collapsed or broken.
meshes.namesYou can group mesh objects in the model by name and simplify the mesh objects by group. You can specify different thresholds for groups.
meshes.thresholdThe simplification threshold of the group.
Note You can group objects in a model by name and simplify the objects by group. For example, you can increase the percentage based on which high-precision models are simplified and decrease the percentage based on which low-precision models are simplified.
Model simplification does not moderate the display results of models but can significantly reduce the storage that is occupied by the models. The following section provides examples:
  • Percentage for simplification: 100%
    • Occupied storage: 96 MB
    • Result100% simplification
  • Percentage for simplification: 5% geometric simplification and 25% image simplification
    • Occupied storage: 2.9 MB
    • Result5%+25%

Examples

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.....