diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/TextureIO/OcclusionMetallicRoughnessConverter.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/TextureIO/OcclusionMetallicRoughnessConverter.cs index 72ad2d1af..514ed6067 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/TextureIO/OcclusionMetallicRoughnessConverter.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/TextureIO/OcclusionMetallicRoughnessConverter.cs @@ -69,7 +69,11 @@ namespace UniGLTF } else if (occlusionTexture != null) { - throw new NotImplementedException("occlusion only"); + var copyTexture = TextureConverter.CopyTexture(occlusionTexture, glTFTextureTypes.OcclusionMetallicRoughness, null); + copyTexture.SetPixels32(copyTexture.GetPixels32().Select(x => ImportPixel(default, metallicFactor, roughnessFactor, x)).ToArray()); + copyTexture.Apply(); + copyTexture.name = occlusionTexture.name; + return copyTexture; } else { diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/TextureIO/TextureFactory.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/TextureIO/TextureFactory.cs index 70872c48c..24f999f5b 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/TextureIO/TextureFactory.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/TextureIO/TextureFactory.cs @@ -178,7 +178,11 @@ namespace UniGLTF case GetTextureParam.TextureTypes.StandardMap: { - var baseTexture = await GetOrCreateBaseTexture(awaitCaller, gltf, param.Index0.Value, false); + TextureLoadInfo baseTexture = default; + if (param.Index0.HasValue) + { + baseTexture = await GetOrCreateBaseTexture(awaitCaller, gltf, param.Index0.Value, false); + } TextureLoadInfo occlusionBaseTexture = default; if (param.Index1.HasValue) {