簡化3D 模型。
文法
scene ST_Simplify(scene sc, cstring rules);參數
| 參數名稱 | 描述 |
| sc | scene對象。 |
| rules | 簡化規則。 |
描述
對3D 模型進行幾何簡化,可傳入JSON模型的規則,JSON格式如下:
{
"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}
]
}JSON欄位含義如下:
| 參數 | 描述 |
| mothed | 簡化控制方式,可選擇:
說明 percent為簡化後的三角面數量與原模型三角面數量的比值, percent越小簡化越多。error的計算方式為新頂點到原頂點的距離,error越大簡化越多。 |
| threshold | 簡化的閾值,取值範圍見mothed參數描述。 |
| blacklist | 對模型中的Mesh按name進行過濾,黑名單中的Mesh不簡化。 |
| boundary | 是否簡化邊界,預設為true。 說明 簡化邊界會導致模型坍塌、破洞。 |
| meshes.names | 對模型中的Mesh按name分組簡化,不同組可設定不同的簡化閾值。 |
| meshes.threshold | meshes.names對應的簡化閾值。 說明 可對一個複雜的模型,進行分組簡化,如提高精模部分的簡化比、減少粗模部分的簡化比。 |
模型簡化可以在保持顯示效果的同時,大幅降低模型的空間佔用,樣本如下:
- 簡化比:100%
- 佔用空間:96 MB
- 模型效果:

- 簡化比:5%幾何簡化 + 25%圖片簡化
- 佔用空間:2.9 MB
- 模型效果:

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