Loading model without indices


I am trying to load a model into Cesium (1.15) that has no indices defined.

I wrote the Gltf with an own converter that may have many other issues, but with the following error it seems like cesium expects models to have indices defined.

DeveloperError: attribute must have a vertexBuffer or a value.
at new DeveloperError (http://localhost:8080/Source/Core/DeveloperError.js:43:19)
at addAttribute (http://localhost:8080/Source/Renderer/VertexArray.js:39:19)
at new VertexArray (http://localhost:8080/Source/Renderer/VertexArray.js:290:13)
at createVertexArrays (http://localhost:8080/Source/Scene/Model.js:1864:74)

I looked through the code and found this. I think that only if a primitive has indices, indexBuffer gets a value and if not the VertexArray is created with indexBuffer = null and then an error occurs.


                var indexBuffer;
                if (defined(primitive.indices)) {
                    var accessor = accessors[primitive.indices];
                    indexBuffer = rendererBuffers[accessor.bufferView];
                rendererVertexArrays[meshName + '.primitive.' + i] = new VertexArray({
                    context : context,
                    attributes : attrs,
                    indexBuffer : indexBuffer


So can Cesium handle Gltf 1.0 without indices, like specified, and my Gltf file has just other issues that lead to this error?


Yes, Cesium should be able to load models with no indices.

Here’s the model we tested with, if you want to take a look: https://github.com/AnalyticalGraphicsInc/cesium/tree/master/Specs/Data/Models/Box-NoIndices

If you can’t find an error in your glTF file, we can look to see if there is a bug in Cesium.



Okey then my file has to have other issues that I can’t find, if Cesium is able to load the NoIndices Box. (Even though the accessor for the idices is still in the NoIndices file, but is not used)
Is there a nice way to debug gltf files, especially the binary blob?

The way I do it, is to load the model in Cesium and try to analyse the error messages. Then I look through the Cesium code and find out where and why the errors happened. But this is not very efficient.

Yeah, sorry. I’m not sure if there’s a better way to do it.
Once the model is loaded, you can set a breakpoint somewhere in inspect the Model.gltf property to see the JSON used to construct the model and compare that to the glTF spec for any errors. But you’re right, that’s not very efficient and it might take you some time to find the problem.


Okey thank you for your help!


I am having a similar issue.
Meshes without indices are partly not rendered at all.
My models are coming from a custom converter. The vertices are actually copied from an unidexed triange array so the GLTF indices are just generated on the fly, counting upwards (0,1,2,3,4,5,6,7,8....)

My meshes look like this:


in my application, either the first mesh without texcoords is rendered or the other one with texture and texcoords. Perhaps switching between untextured and textured meshes is messing up the WebGL state and confuses the renderer?

In the console the following error occurs:
Error: WebGL: drawArrays: bound vertex attribute buffers do not have sufficient size for given first and count Cesium.js:125006:17

        if (defined(indexBuffer)) {
            offset = offset * indexBuffer.bytesPerIndex; // offset in vertices to offset in bytes
            count = defaultValue(count, indexBuffer.numberOfIndices);
            if (instanceCount === 0) {
                context._gl.drawElements(primitiveType, count, indexBuffer.indexDatatype, offset);
            } else {
                context.glDrawElementsInstanced(primitiveType, count, indexBuffer.indexDatatype, offset, instanceCount);
        } else {
            count = defaultValue(count, va.numberOfVertices);
            if (instanceCount === 0) {
    125006 >> context._gl.drawArrays(primitiveType, offset, count);
            } else {
                context.glDrawArraysInstanced(primitiveType, offset, count, instanceCount);

best regards,