Error: WebGL warning: drawArrays: Vertex fetch requires 1380, but attribs only supply 1290

Hello Everybody!

I am working to figure out .mtl texturing with Three.js and have been experiencing some issues with little documentation (that I can find).

I am working with two separate objects, both of which appear entirely black with the loaded .mtl files.
attached below are copies of these files, both with the .mtl file attached and removed.

While uploading the iPhone .obj files, I receive the following error message: Error: WebGL warning: drawArrays: Vertex fetch requires 1380, but attribs only supply 1290.

I’ve been unable to find documentation as it pertains to this error, so if you can - please offer some direction.

Additionally, here’s an example of my code with and without the .mtl files:

// var phoneMTL = new THREE.MTLLoader();
// phoneMTL.load("../models/phone/Iphone.mtl", function(materials){
//     materials.preload();
    var phoneOBJ = new THREE.OBJLoader();
    // phoneOBJ.setMaterials(materials);
    phoneOBJ.load("../models/phone/Iphone.obj", function(mesh){
        scene.add(mesh)
    });
// });

Is there something I’m overlooking here? Or is this related to the error message, referenced above?

Can you please share the OBJ/MTL file of the iPhone model in this thread?

This can happen when webgl expects 1380 vertices to be drawn, but you’ve provided only 1290. Most of the time these buffers in WebGL that represent memory have to have matching sizes and be properly formatted.

Hey @Mugen87
Here are both sets of files for the phone. phone.zip (2.3 MB)

Additionally, here are the files for the plant tooplant.zip (3.9 MB)

Thanks, @pailhead!
Though, forgive my ignorance. Is this the fault of my model? Or is it likely that have I overlooked something during the page set up?

1 Like

I can reproduce the warnings in the three.js editor so it’s not a problem in your app. However, the OBJ looks suspicious since the amount of vertex normals for certain mesh geometries does not match the amount of vertices (this circumstance causes the WebGL warnings). Such definitions are unusual and exporters should actually not allow such corrupt exports.

That is really great to know, thank you! I’ll disregard the iPhone for any future projects.
Though, as the warning does not appear the plant (in addition to my other objects); is there something wrong with my script that is resulting in the models to appear entirely black?

In most cases, users forget to add light sources to their scene.

1 Like

As mugen has explained, this is most likely a fault with the obj itself. Can you verify that it works in a modeling app? Can you re-export?