更新。colon_fence 拡張追加

This commit is contained in:
ousttrue
2023-04-12 13:49:45 +09:00
parent 306fad4d49
commit 4e614faca4
2 changed files with 58 additions and 26 deletions

View File

@@ -1,21 +1,37 @@
# `v0.76` ITextureDeserializer(テクスチャーローダー)
このインタフェースを使うとテクスチャーロードをカスタマイズできます。
このインタフェースを使うと, glTF のテクスチャーロードして Unity の Texture2D を作成する工程をカスタマイズできます。
## UnityTextureDeserializer
UniVRM の実装は`UnityTextureDeserializer` です。
UniVRM が使用するデフォルトの実装は `UnityTextureDeserializer` です。
<https://github.com/vrm-c/UniVRM/blob/master/Assets/VRMShaders/GLTF/IO/Runtime/Texture/Importer/UnityTextureDeserializer.cs>
[ImageConversion.LoadImage](https://docs.unity3d.com/ja/2020.3/ScriptReference/ImageConversion.LoadImage.html) を使用して `png``jpeg` をロードできます。
通常の `glTF` はテクスチャー形式として `png``jpeg` を格納できます。
[ImageConversion.LoadImage](https://docs.unity3d.com/ja/2020.3/ScriptReference/ImageConversion.LoadImage.html) を使用して `png``jpeg` から Texture2D に変換します。
`ImageConversion.LoadImage` はメインスレッドをブロックします。
大きなテクスチャーや大量のテクスチャーをロードすると画面が固まることがあります。
:::{admonition} ITextureDeserializer でパフォーマンスを改善
Texture2D の生成には複数のステップがあります。
`png``jpeg` から `raw pixel` を取得する部分をスレッドに乗せて非同期処理にすることで
- `png``jpeg` から `raw pixel` を取り出す
- 取り出した `raw pixel` を使って `Texture2D` を作成する
前者をスレッドに乗せて非同期処理にすることで
パフォーマンスを向上させる余地があります。
:::
:::{warning}
`ImageConversion.LoadImage``raw pixel` 取り出しと `Texture2D` 作成を一度に実行し、
その間メインスレッドをブロックします。
大きなテクスチャーや大量のテクスチャーをロードすると画面が固まりやすくなります。
:::
:::{admonition} ITextureDeserializer で対応する画像形式を拡張する
通常の `glTF` はテクスチャー画像として `png``jpeg` を格納できます。
もし、`EXT_texture_webp` `KHR_texture_basisu` などで別の形式の画像を利用する場合は
`ITextureDeserializer` で対応可能です。
:::
## 差し替え方法
@@ -25,7 +41,7 @@ UniVRM の実装は、`UnityTextureDeserializer` です。
public ImporterContext(
GltfData data,
IReadOnlyDictionary<SubAssetKey, UnityEngine.Object> externalObjectMap = null,
ITextureDeserializer textureDeserializer = null, // 👈 これ
ITextureDeserializer textureDeserializer = null, // 👈
IMaterialDescriptorGenerator materialGenerator = null)
```
@@ -35,7 +51,7 @@ UniVRM の実装は、`UnityTextureDeserializer` です。
public VRMImporterContext(
VRMData data,
IReadOnlyDictionary<SubAssetKey, Object> externalObjectMap = null,
ITextureDeserializer textureDeserializer = null, // 👈 これ
ITextureDeserializer textureDeserializer = null, // 👈
IMaterialDescriptorGenerator materialGenerator = null,
bool loadAnimation = false)
```
@@ -46,7 +62,7 @@ UniVRM の実装は、`UnityTextureDeserializer` です。
public Vrm10Importer(
Vrm10Data vrm,
IReadOnlyDictionary<SubAssetKey, UnityEngine.Object> externalObjectMap = null,
ITextureDeserializer textureDeserializer = null, // 👈 これ
ITextureDeserializer textureDeserializer = null, // 👈
IMaterialDescriptorGenerator materialGenerator = null,
bool useControlRig = false
)

View File

@@ -16,42 +16,58 @@
# -- Project information -----------------------------------------------------
project = 'UniVRM Programming'
copyright = '2021, VRM Consortium'
author = 'VRM Consortium'
project = "UniVRM Programming"
copyright = "2021, VRM Consortium"
author = "VRM Consortium"
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['myst_parser', 'gitinclude']
extensions = ["myst_parser", "gitinclude"]
myst_enable_extensions = [
# "amsmath",
# "attrs_inline",
"colon_fence",
# "deflist",
# "dollarmath",
# "fieldlist",
# "html_admonition",
# "html_image",
# "linkify",
# "replacements",
# "smartquotes",
# "strikethrough",
# "substitution",
# "tasklist",
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = 'ja'
language = "ja"
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'furo'
html_theme = "furo"
html_sidebars = {
'**': [
"**": [
"sidebar/scroll-start.html",
'language.html',
"language.html",
"sidebar/brand.html",
"sidebar/search.html",
"sidebar/navigation.html",
@@ -63,17 +79,17 @@ html_sidebars = {
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]
locale_dirs = ['locale/']
locale_dirs = ["locale/"]
gettext_compact = False
github_url = "https://github.com/vrm-c/UniVRM"
html_context = {
"language": language,
'display_github': True,
'github_user': 'vrm-c',
'github_repo': 'UniVRM',
'github_version': 'master/docs/'
"display_github": True,
"github_user": "vrm-c",
"github_repo": "UniVRM",
"github_version": "master/docs/",
}