#08 VRMお手軽ポーズ 高解像度撮影 MaterialDebugモード https://gyazo.com/9e62a5d5e79b34ae1c36eb6cbb78d8d1
基本情報
高解像度撮影機能
https://gyazo.com/ba5686b4b3542b1002016feb3c49920f https://gyazo.com/5d80206a3bbe7155030a3e8b1f58eaf4
画面解像度の倍率を変更して撮影できるようになりました。
実験的機能 > 解像度倍率(0.125~4)で操作できます。
解像度を上げると当然負荷も増大するので注意してください。
実装
canvasのサイズを拡大 (縮小)し、スタイルを再設定して元の大きさで表示させます.
code:js
canvas.width = width * dpr * this.rendererScale;
canvas.height = height * dpr * this.rendererScale;
canvas.style.width = '100vw';
canvas.style.height = '100vh';
this.renderer.setSize(window.innerWidth * this.rendererScale, window.innerHeight * this.rendererScale);
this.sceneCanvas.style.width = '100vw';
this.sceneCanvas.style.height = '100vh';
MtoonのMaterialDebugモード
https://gyazo.com/d4c1d371f60cdbd95e86c120cb80d554https://gyazo.com/d408c3f205233561341e2a30b56220c1
モデルのシャドウやノーマル、UVを表示できる機能を追加しました。
イラストや画像編集などの参考になるかも。
実装
debugMode
0 : None : 通常
1 :Normal : ノーマル
2 :LitShadeRate : 影
3 :UV : UV
code:ts
setDebugMode(materials: THREE.Material[] | undefined, mode: number) {
if (materials) {
materials.forEach((material) => {
if ((<MToonMaterial>material).isMToonMaterial) {
(<MToonMaterial>material).debugMode = mode;
}
});
}
}
// exp
setDebugMode(this.currentVRM.materials, value);
参考