From 4e614faca4616f91ee40b76a6a831d0be10da874 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 12 Apr 2023 13:49:45 +0900 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E3=80=82`colon=5Ffence`=20?= =?UTF-8?q?=E6=8B=A1=E5=BC=B5=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/api/0_76_texture_deserializer.md | 36 ++++++++++++++------ docs/conf.py | 48 ++++++++++++++++++--------- 2 files changed, 58 insertions(+), 26 deletions(-) diff --git a/docs/api/0_76_texture_deserializer.md b/docs/api/0_76_texture_deserializer.md index 0d1ef3f09..42176112e 100644 --- a/docs/api/0_76_texture_deserializer.md +++ b/docs/api/0_76_texture_deserializer.md @@ -1,21 +1,37 @@ # `v0.76` ITextureDeserializer(テクスチャーローダー) -このインタフェースを使うとテクスチャーロードをカスタマイズできます。 +このインタフェースを使うと, glTF のテクスチャーをロードして Unity の Texture2D を作成する工程をカスタマイズできます。 ## UnityTextureDeserializer -UniVRM の実装は、`UnityTextureDeserializer` です。 +UniVRM が使用するデフォルトの実装は `UnityTextureDeserializer` です。 -[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 externalObjectMap = null, - ITextureDeserializer textureDeserializer = null, // 👈 これ + ITextureDeserializer textureDeserializer = null, // 👈 IMaterialDescriptorGenerator materialGenerator = null) ``` @@ -35,7 +51,7 @@ UniVRM の実装は、`UnityTextureDeserializer` です。 public VRMImporterContext( VRMData data, IReadOnlyDictionary 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 externalObjectMap = null, - ITextureDeserializer textureDeserializer = null, // 👈 これ + ITextureDeserializer textureDeserializer = null, // 👈 IMaterialDescriptorGenerator materialGenerator = null, bool useControlRig = false ) diff --git a/docs/conf.py b/docs/conf.py index 7b4b4f45c..f7304507a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -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/", }