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

Free Support Forum - aspose.com

Gltf/Glb conversion with draco compression - corrupted output

I’m working with cesium’s 3d tiles and trying to enable draco compression. Unfortunately the output files are either invalid, or very broken.

The output files also cannot be loaded by the default windows 3d viewer, blender or VSCodes’ GltfTools

Code is pretty simple, but here a snippet:

            scene.Open(inputFile, cancellationToken);

            if (OutputFormat == FileFormat.GLTF2)
            {
                saveOptions = new GltfSaveOptions(OutputFormat)
                {
                    SaveExtras = false,
                    BufferFile = fileName + ".buffer.bin",
                    DracoCompression = true
                };
            }
            else if (OutputFormat == FileFormat.GLTF2_Binary)
            {
                saveOptions = new GltfSaveOptions(OutputFormat)
                {
                    SaveExtras = true,
                    DracoCompression = true
                };

                extension = ".glb";
            }

            var outputFile = Path.Combine(Output, fileName + extension);
            var dir = Path.GetDirectoryName(outputFile);
            if (!string.IsNullOrWhiteSpace(dir))
                Directory.CreateDirectory(dir);

            Logger.LogInformation($"Saving scene to file {outputFile}");

            if (saveOptions != null)
                scene.Save(outputFile, saveOptions, cancellationToken);
            else
                scene.Save(outputFile, OutputFormat, cancellationToken);

Does not work with either glb or gltf. The vast majority of input files fail.

Have also found that https://threejs.org/editor/ has draco support, but also has an issue:

2abd9806-d0c8-4ed6-9155-a09cbdf4b20d:158 Error: THREE.DRACOLoader: Decoding failed: Failed to decode point attributes.
at decodeGeometry (2abd9806-d0c8-4ed6-9155-a09cbdf4b20d:204:10)
at 2abd9806-d0c8-4ed6-9155-a09cbdf4b20d:148:24

See example attached file below:

Input.zip (92.4 KB)

Unsure if this is important, but gltf validator spits out these:

 {
                "code": "UNSATISFIED_DEPENDENCY",
                "message": "Dependency failed. 'bufferView' must be defined.",
                "severity": 0,
                "pointer": "/accessors/0/byteOffset"
            },
            {
                "code": "UNSATISFIED_DEPENDENCY",
                "message": "Dependency failed. 'bufferView' must be defined.",
                "severity": 0,
                "pointer": "/accessors/1/byteOffset"
            },
            {
                "code": "UNSATISFIED_DEPENDENCY",
                "message": "Dependency failed. 'bufferView' must be defined.",
                "severity": 0,
                "pointer": "/accessors/2/byteOffset"
            },
            {
                "code": "UNSATISFIED_DEPENDENCY",
                "message": "Dependency failed. 'bufferView' must be defined.",
                "severity": 0,
                "pointer": "/accessors/3/byteOffset"
            },
            {
                "code": "MESH_PRIMITIVE_INVALID_ATTRIBUTE",
                "message": "Invalid attribute name.",
                "severity": 0,
                "pointer": "/meshes/0/primitives/0/attributes/COLOR"
            },
            {
                "code": "ACCESSOR_USAGE_OVERRIDE",
                "message": "Override of previously set accessor usage. Initial: 'VertexAttribute', new: 'PrimitiveIndices'.",
                "severity": 0,
                "pointer": "/meshes/0/primitives/0/indices"
            },
            {
                "code": "MESH_PRIMITIVE_INDICES_ACCESSOR_INVALID_FORMAT",
                "message": "Invalid indices accessor format '{VEC3, FLOAT}'. Must be one of ('{SCALAR, UNSIGNED_BYTE}', '{SCALAR, UNSIGNED_SHORT}', '{SCALAR, UNSIGNED_INT}').",
                "severity": 0,
                "pointer": "/meshes/0/primitives/0/indices"
            },
            {
                "code": "MESH_PRIMITIVE_INCOMPATIBLE_MODE",
                "message": "Number of vertices or indices (44695) is not compatible with used drawing mode ('TRIANGLES').",
                "severity": 1,
                "pointer": "/meshes/0/primitives/0"
            }

@bortos

An investigation ticket as THREEDNET-1076 has been logged in our issue tracking system to further analyze this case. We will look into its details and keep you posted with the status of ticket resolution. Please be patient and spare us some time.

We are sorry for the inconvenience.