From 21bcd140f8d913888ce0ddc7c0dfe3ec060629f6 Mon Sep 17 00:00:00 2001 From: Masataka SUMI Date: Thu, 20 May 2021 21:04:09 +0900 Subject: [PATCH] =?UTF-8?q?=E3=81=9F=E3=81=A8=E3=81=88=E5=90=8C=E3=81=98?= =?UTF-8?q?=20Texture=20=E3=82=A4=E3=83=B3=E3=82=B9=E3=82=BF=E3=83=B3?= =?UTF-8?q?=E3=82=B9=E3=81=A7=E3=81=82=E3=81=A3=E3=81=A6=E3=82=82=E3=80=81?= =?UTF-8?q?glTF=20=E3=81=AE=E3=83=97=E3=83=AD=E3=83=91=E3=83=86=E3=82=A3?= =?UTF-8?q?=E3=81=8C=E8=A6=81=E6=B1=82=E3=81=99=E3=82=8B=E8=89=B2=E7=A9=BA?= =?UTF-8?q?=E9=96=93=E3=81=8C=E9=81=95=E3=81=88=E3=81=B0=E5=88=A5=E3=81=AE?= =?UTF-8?q?=E3=83=86=E3=82=AF=E3=82=B9=E3=83=81=E3=83=A3=E3=81=A8=E3=81=97?= =?UTF-8?q?=E3=81=A6=E5=87=BA=E5=8A=9B=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VRMShaders/GLTF/IO/Runtime/TextureExporter.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Assets/VRMShaders/GLTF/IO/Runtime/TextureExporter.cs b/Assets/VRMShaders/GLTF/IO/Runtime/TextureExporter.cs index 1445896de..8be7489db 100644 --- a/Assets/VRMShaders/GLTF/IO/Runtime/TextureExporter.cs +++ b/Assets/VRMShaders/GLTF/IO/Runtime/TextureExporter.cs @@ -31,8 +31,10 @@ namespace VRMShaders enum ExportTypes { - // 無変換 - None, + // sRGB テクスチャとして出力 + Srgb, + // Linear テクスチャとして出力 + Linear, // Unity Standard様式 から glTF PBR様式への変換 OcclusionMetallicRoughness, // Assetを使うときはそのバイト列を無変換で、それ以外は DXT5nm 形式からのデコードを行う @@ -68,7 +70,7 @@ namespace VRMShaders } // cache - if (m_exportMap.TryGetValue(new ExportKey(src, ExportTypes.None), out var index)) + if (m_exportMap.TryGetValue(new ExportKey(src, ExportTypes.Srgb), out var index)) { return index; } @@ -85,7 +87,7 @@ namespace VRMShaders texture2D = TextureConverter.CopyTexture(src, TextureImportTypes.sRGB, null); } m_exported.Add((texture2D, ColorSpace.sRGB)); - m_exportMap.Add(new ExportKey(src, ExportTypes.None), index); + m_exportMap.Add(new ExportKey(src, ExportTypes.Srgb), index); return index; } @@ -102,7 +104,7 @@ namespace VRMShaders return -1; } - var exportKey = new ExportKey(src, ExportTypes.None); + var exportKey = new ExportKey(src, ExportTypes.Linear); // search cache if (m_exportMap.TryGetValue(exportKey, out var index)) @@ -141,6 +143,7 @@ namespace VRMShaders } // cache + // TODO 厳密なチェックをしていない if (metallicSmoothTexture != null && m_exportMap.TryGetValue(new ExportKey(metallicSmoothTexture, ExportTypes.OcclusionMetallicRoughness), out var index)) { return index;