forked from vrm-c/vrm.dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'ja/master' into merge/2024-02-19
- Loading branch information
Showing
46 changed files
with
800 additions
and
444 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
title: 開発ドキュメントの移動 | ||
authors: [vrmc] | ||
tags: [maintenance] | ||
--- | ||
|
||
https://vrm-c.github.io/UniVRM/ のドキュメントを本サイトに移動しました。 | ||
おもに [/api/](/api/) フォルダー配下になります。 | ||
|
||
今後はこちらで更新していきます。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import DocCardList from '@theme/DocCardList'; | ||
|
||
# UniVRM API | ||
|
||
<DocCardList /> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# RuntimeGltfInstane | ||
|
||
ヒエラルキーの root にアタッチされます。 | ||
リソースの破棄について。 | ||
|
||
## ShowMeshes | ||
|
||
```cs | ||
public void ShowMeshes() | ||
{ | ||
foreach (var r in VisibleRenderers) | ||
{ | ||
r.enabled = true; | ||
} | ||
} | ||
``` | ||
|
||
## EnableUpdateWhenOffscreen | ||
|
||
```cs | ||
public void EnableUpdateWhenOffscreen() | ||
{ | ||
foreach (var skinnedMeshRenderer in SkinnedMeshRenderers) | ||
{ | ||
skinnedMeshRenderer.updateWhenOffscreen = true; | ||
} | ||
} | ||
``` | ||
|
||
## Dispose | ||
|
||
関連するリソースを破棄します。 | ||
|
||
```cs | ||
public void Dispose() | ||
{ | ||
if (this != null && this.gameObject != null) | ||
{ | ||
UnityObjectDestroyer.DestroyRuntimeOrEditor(this.gameObject); | ||
} | ||
} | ||
``` | ||
|
||
:::tip GameObject.Destory でも破棄できます | ||
|
||
```cs | ||
void OnDestroy() | ||
{ | ||
foreach (var (_, obj) in _resources) | ||
{ | ||
UnityObjectDestroyer.DestroyRuntimeOrEditor(obj); | ||
} | ||
} | ||
``` | ||
|
||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# import の最適化について | ||
|
||
## GltfData | ||
|
||
:::tip UniGLTF.GltfData の生成はスレッドセーフです | ||
Unity にアクセスしません。 | ||
Parse を別スレッドで実行可能です。 | ||
|
||
```cs | ||
// 使用例 | ||
var task = Task.Run(()=>{ | ||
// スレッド OK | ||
return new GlbBinaryParser(bytes, path).Parse(); | ||
}); | ||
|
||
using(var data = await task){ | ||
|
||
} | ||
``` | ||
|
||
::: | ||
|
||
## IAwaitCaller | ||
|
||
Task を小出しにすることでフレームレートの低下に対策できます。 | ||
|
||
[0_87_runtime_import](/api/0_87_runtime_import) | ||
|
||
### ImmediateCaller | ||
|
||
小出しにせずに普通に処理します。 | ||
UnityEditor や UnitTest など Unity の frame が回っていない環境でも | ||
動くように作られています。 | ||
|
||
### RuntimeOnlyAwaitCaller | ||
|
||
Unity の `yield return` と似た感じです。 | ||
後続の処理を次のフレームに先送りします。 | ||
|
||
:::tip フレーム当りの処理量は減るがトータルで必要な時間は長くなります | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# GltfData | ||
|
||
`.glb`, `.vrm`, `.vrma` など から GltfData をロードします。 | ||
|
||
GltfData が入手できたら中身に合わせた GameObject 生成へと分岐してください。 | ||
|
||
## `byte[]` からロードする | ||
|
||
```cs | ||
public sealed class GlbBinaryParser | ||
{ | ||
public GlbBinaryParser(byte[] data, string uniqueName) | ||
} | ||
|
||
// 使用例 | ||
using (GltfData data = new GlbBinaryParser(bytes, path).Parse()) | ||
{ | ||
} | ||
``` | ||
|
||
## filepath からロードする | ||
|
||
```cs | ||
public sealed class GlbFileParser | ||
{ | ||
public GlbFileParser(string glbFilePath) | ||
} | ||
|
||
// 使用例 | ||
using (GltfData data = new GlbFileParser(path).Parse()) | ||
{ | ||
} | ||
``` | ||
|
||
## Dispose | ||
|
||
- [0_95_dispose](/api/0_95_dispose) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# load glb | ||
|
||
[GltfData](/api/runtime-import/gltfdata) から Unity ヒエラルキーを構築します。 | ||
|
||
<!-- truncate --> | ||
|
||
:::info glTF形式 | ||
glTF は glb と比べてアプリケーションからの扱いが煩雑です。 | ||
複数のファイルへのアクセスが発生するためです。 | ||
mobile 環境、webgl 環境などディレクトリへの自由なアクセスが制限される環境で | ||
は特に難しくなります。 | ||
|
||
特別な目的が無い場合は gltf よりも glb をお勧めします。 | ||
(vrm や vrma は glb の拡張子を変更したものです) | ||
::: | ||
|
||
[glb_import](/api/0_82_glb_import) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# import URP | ||
|
||
オプションで urp material への差し替えができます。 | ||
|
||
[0_112_urp](/api/0_112_urp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# load vrm-0.x | ||
|
||
[GltfData](/api/runtime-import/gltfdata) から vrm-0.x ヒエラルキーを構築します。 | ||
|
||
<!-- truncate --> | ||
|
||
:::warning | ||
|
||
vrm-1.0 のモデルはロードできません。 | ||
|
||
::: | ||
|
||
[0_82_runtime_import](/api/0_82_runtime_import) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import DocCardList from '@theme/DocCardList'; | ||
|
||
# Runtime Import | ||
|
||
glb vrm vrma などのファイルを入力、 | ||
UnityEngine.GameObject のヒエラルキーを出力とする手順です。 | ||
2ステップに別れています。 | ||
|
||
はじめにファイルから中間データ[UniGLTF.GltfData](/api/runtime-import/gltfdata) の生成をします。この手順は glb, vrm-0.x, vrm-1.0, vrm-animation で共通です。 | ||
|
||
次に glb, vrm-0.x, vrm-1.0, vrm-animation などの glTF 拡張に応じた | ||
GameObject 構築手順を実行します。 | ||
|
||
:::info 便利関数 | ||
|
||
[0_95_highlevel](/api/0_95_highlevel) | ||
|
||
::: | ||
|
||
<DocCardList /> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import DocCardList from '@theme/DocCardList'; | ||
|
||
# Samples | ||
|
||
<DocCardList /> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# UniVRM サンプルをインストールする | ||
|
||
このセクションでは、[UniVRM パッケージをインストール](/univrm/install/univrm_install)したことを想定しています。 | ||
|
||
## UniVRM サンプルのパッケージ | ||
|
||
`v0.81.0` から UniVRM サンプルは UniVRM パッケージに含まれています。 | ||
最新の UniVRM バージョンがインストールされている場合は、**UniVRM サンプルのシーンを実行する**セクションをご覧ください。 | ||
|
||
### ~ v0.80.0 | ||
|
||
https://github.com/vrm-c/UniVRM/releases | ||
|
||
`UniVRM-samples-0.XX.X_XXXX.unitypackage` | ||
|
||
です。 | ||
|
||
### インポート | ||
|
||
メニューから `Assets -> Import Package -> Custom Package` で `UniVRM-samples-0.XX.X_XXXX.unitypackage` を選択します。 | ||
|
||
以下の画像ようにインポートウィンドウを見たら、`Import`ボタンをクリックしてください: | ||
|
||
![sample_package_import](/images/vrm/sample_package_import.jpg) | ||
|
||
## UniVRM サンプルのシーンを実行する | ||
|
||
`VRM.Samples`フォルダは`Assets`にあります。プロジェクトウィンドウに`SampleViewer`を選択します: | ||
|
||
![sample_scene](/images/vrm/sample_scene.jpg) | ||
|
||
`Game`タブをクリックして、`SampleViewer`のインタフェースを表示させます: | ||
|
||
![sample_viewer](/images/vrm/sample_viewer.jpg) | ||
|
||
`Play`ボタンをクリックして`SampleViewer`を有効になります。実行時に`Open`ボタンをクリックして VRM モデルをシーンにインポートします: | ||
|
||
![play_mode](/images/vrm/play_mode.jpg) | ||
|
||
![sample_viewer_activate](/images/vrm/sample_viewer_activate.jpg) | ||
|
||
`VRM.Samples`に[ランタイム VRM エクスポート](https://github.com/vrm-c/UniVRM/tree/master/Assets/VRM/Samples/RuntimeExporterSample)と[一人称レンダリング](https://github.com/vrm-c/UniVRM/tree/master/Assets/VRM/Samples/FirstPersonSample)のサンプルがあります。 | ||
|
||
Alicia モデルは[こちら](https://github.com/vrm-c/UniVRM/blob/master/Tests/Models/Alicia_vrm-0.51/AliciaSolid_vrm-0.51.vrm)。 |
Oops, something went wrong.