We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

GLTF Save support material names

Hello,

When I export gltf I’d like to preserve material names but they seem to disappear:
image.png (5.2 KB)

See the spec: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#metallic-roughness-material
image.png (1.2 KB)

Could material name be added, or is there an option I am missing?

See following unit test:

    [Test]
    public void Gltf_supports_material_names()
    {
        Scene scene = new Scene();
        
        scene.RootNode.CreateChildNode("SomeCube", new Box(10,10,10).ToMesh(), new PbrMaterial(Color.Red)
        {
            Name = "RedMaterial"
        });

        string gltfContent;
        
        using (var ms = new MemoryStream())
        {
            scene.Save(ms, new GltfSaveOptions(FileFormat.GLTF2)
            {
                PrettyPrint = true,
                SaveExtras = true,
            });

            ms.Seek(0, SeekOrigin.Begin);


            using (var sr = new StreamReader(ms))
                gltfContent = sr.ReadToEnd();
        }
        
        Assert.True(gltfContent.Contains("RedMaterial"));
    }

@bortos

An issue as THREEDNET-903 has been logged in our issue tracking system for further investigation. We will look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.