From e265cd9ad267e7daf75752709af43355f5ed6a13 Mon Sep 17 00:00:00 2001 From: j-hirose Date: Fri, 10 May 2019 18:33:18 +0900 Subject: [PATCH] The standard shader's texture refers to the maintex tiling --- Assets/VRM/UniGLTF/Scripts/IO/MaterialExporter.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Assets/VRM/UniGLTF/Scripts/IO/MaterialExporter.cs b/Assets/VRM/UniGLTF/Scripts/IO/MaterialExporter.cs index d6c943e38..49960ff13 100644 --- a/Assets/VRM/UniGLTF/Scripts/IO/MaterialExporter.cs +++ b/Assets/VRM/UniGLTF/Scripts/IO/MaterialExporter.cs @@ -53,7 +53,7 @@ namespace UniGLTF index = index, }; - Export_TextureTransform(m, material.pbrMetallicRoughness.baseColorTexture, "_MainTex"); + Export_MainTextureTransform(m, material.pbrMetallicRoughness.baseColorTexture); } } } @@ -80,7 +80,7 @@ namespace UniGLTF index = index, }; - Export_TextureTransform(m, material.pbrMetallicRoughness.metallicRoughnessTexture, "_MetallicGlossMap"); + Export_MainTextureTransform(m, material.pbrMetallicRoughness.metallicRoughnessTexture); } } @@ -116,7 +116,7 @@ namespace UniGLTF index = index, }; - Export_TextureTransform(m, material.normalTexture, "_BumpMap"); + Export_MainTextureTransform(m, material.normalTexture); } if (index != -1 && m.HasProperty("_BumpScale")) @@ -138,7 +138,7 @@ namespace UniGLTF index = index, }; - Export_TextureTransform(m, material.occlusionTexture, "_OcclusionMap"); + Export_MainTextureTransform(m, material.occlusionTexture); } if (index != -1 && m.HasProperty("_OcclusionStrength")) @@ -173,11 +173,16 @@ namespace UniGLTF index = index, }; - Export_TextureTransform(m, material.emissiveTexture, "_EmissionMap"); + Export_MainTextureTransform(m, material.emissiveTexture); } } } + static void Export_MainTextureTransform(Material m, glTFTextureInfo textureInfo) + { + Export_TextureTransform(m, textureInfo, "_MainTex"); + } + static void Export_TextureTransform(Material m, glTFTextureInfo textureInfo, string propertyName) { if( textureInfo != null && m.HasProperty(propertyName))