Free Support Forum - aspose.com

PBR material in GLTF

Hi all,

We would like to load a GLTF file (this bottle: https://github.com/alteous/glTF-Sample-Models-Official/tree/master/2.0/WaterBottle) with Aspose.3D.

Unfortunately, we do not know how to access the PBR material stored in this GTLF.
When debugging the material object of the first child node in Visual Studio, we see the following values:
image.png (155.2 KB)

The second value #=z8frC1ic= shows the correct PBR material object, but how to access it in code?
image.png (227.7 KB)

Below you can find our code how we try to read the material. The object pbrMat is null:

 private void LoadGLTF()
    {
        var scene = new Aspose.ThreeD.Scene();
        scene.Open(@"C:\temp\WaterBottle.gltf");

        var root = scene.RootNode;
        if (root != null && root.ChildNodes != null)
        {
            var child = scene.RootNode.GetChild(0);
            if (child != null)
            {
                var curMat = child.Material;
                var pbrMat = curMat as Aspose.ThreeD.Shading.PbrMaterial;
                Console.WriteLine("AlbedoTexture: " + pbrMat.AlbedoTexture);
                Console.WriteLine("EmissiveTexture: " + pbrMat.EmissiveTexture);
                Console.WriteLine("MetallicRoughness: " + pbrMat.MetallicRoughness);
                Console.WriteLine("NormalTexture: " + pbrMat.NormalTexture);
                Console.WriteLine("OcclusionTexture: " + pbrMat.OcclusionTexture);
                Console.WriteLine("SpecularTexture: " + pbrMat.SpecularTexture);
                Console.WriteLine("---");
            }
        }
    }

@Twinsity

We have logged an issue as THREEDNET-697 in our issue tracking system to further investigate the scenario. We will check this in details and keep you informed about the its resolution status. Please be patient and spare us some time.

We are sorry for the inconvenience.