Tango Constructorから出力した
モデルをちょこっと綺麗にする
社内勉強会#30
スタジオアルカナ
遠藤勝也
綺麗にするモデル
https://sketchfab.com/models/4461c2d0da1a445
88b499691f38aece4
https://sketchfab.com/models/9b2c4d3eb4ee4d8
d9166ee07f6e23dc9
やってみよう
できれば3Dモデリングソフトとかの
APIを叩いたりしたい
自分で頂点のいじったら
テクスチャの頂点とかもずれそうで怖い
候補
Blender
Mesh Lab
3Dモデルの編集に特化している
Mesh Labで実験
ノイズを消すならおそらく
平滑化とかだろう!
だけどどんな平滑化手法が
いいんだろう
http://cg.xyamu.net/Blender/entry276.html
Laplacian Smooth
微細なポリゴンで構成されたオブジェクト表面の
荒れを軽減したり、シンプルな形状のオブジェク
トを元に新しい形状にしたりできます。
“
“
Mesh Labで
Laplacian Smoothを
試してみる
綺麗になったけど床に穴が空いてる
しかもStepを増やすと大きくなる
壁にも規則正しく
面選択すると綺麗に選択できちゃう
面選択すると綺麗に選択できちゃう
おそらくTango ConstructorではSLAMの際に
こんな感じで平面を分割している
原因
おそらくTangoから出力されたモデルは
1つの平面を複数の平面に分割している
解決策
重複する頂点をマージしてから平滑化してみる
マージして……
平滑化!!
できた!
一通りの手順
Mesh Labを立ち上げた画面
.objを読み込み
.objを読み込み
.objを読み込み
右上のFindから"Remove Duplicate Vertices"を選択
見た目はわからないけどマージされた
次は"Laplacian Smooth"を選択
Smoothing stepsとか設定できるけどそのまま
Previewにチェックをいれて確認
Smoothing stepsとか設定できるけどそのまま
Previewにチェックをいれて確認
適応前
適応後
一応比較
MeshLabにはmeshlabserver
というcliが用意されている
みたいなのでスクリプトにしておく
環境
MacOS X High Sierra
Mesh Lab v2016.12
まずはQtの依存関係を解決
$ cd /Applications/meshlab.app/Contents/MacOS
$ install_name_tool -add_rpath
> "@executable_path/../Frameworks" meshlabserver
$ ./meshlabserver
Usage:
meshlabserver [logargs] [args]
where logargs can be:
-d filename dump on a text file a list of all
filtering functions
-l filename log of the filters is ouput on a
where args can be:
-p filename meshlab project (.mlp) to be loaded
-w filename [-x] output meshlab project (.mlp) to
If -x flag is
平滑化までの一通りの処理を
スクリプトで保存
1. 一通りの処理を実行する
マージ-> 平滑化
2. 終わったら
Filters > Show current lter script
3. 処理があっているか確認して
Save Scriptで.mlxを書き出し
<!DOCTYPE FilterScript>
<FilterScript>
<filter name="Remove Duplicate Vertices"/>
<filter name="Laplacian Smooth">
<Param tooltip="The number of times that the whole algorithm (
<Param tooltip="If true the boundary edges are smoothed only b
<Param tooltip="If true the cotangente weighting scheme is com
<Param tooltip="If checked the filter is performed only on the
</filter>
</FilterScript>
実行
$ /Applications/meshlab.app/Contents/MacOS/meshlabserver 
-i 20170626154555/20170626154555.obj 
-o 20170626154555/output.obj 
-m wt 
-s merge_smoothing.mlx
まとめ
ちょっとだけ綺麗にすることができた
平滑化はあくまでオリジナルの形を崩してしまう
ことを理解しておくことが必要
参考
http://cg.xyamu.net/Blender/entry276.html
https://jnphgs.blogspot.jp/2016/06/meshlab.html
ありがとうございました

Tango Constructorから出力したモデルをちょこっと綺麗にする