Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

THREE js imported OBJ model [.CommandBufferContext]RENDER WARNING: Render count or primcount is 0

I get thousands of errors (google chrome):

[.CommandBufferContext]RENDER WARNING: Render count or primcount is 0.

OBJ and MTL files exported from Bledner, using OBJMTLLoader.js as loader After moving to R73.

Any experience?

like image 967
Martin Avatar asked Feb 09 '16 09:02

Martin


1 Answers

This happens when the low level render call was told to draw zero vertices/faces. It is because you have one or more meshes with a polygon that has zero faces/vertices, so on each draw call this error piles up.

The problem could be your model or it could be the export/import process. If it's the model, then below is a loose idea about how to find the problematic areas. I don't recommend using OBJMTLLoader with ThreeJS and Blender, because ThreeJS ships with a Blender plugin for exporting, and it works.

checkMesh = function(mesh, child_index) {
  if (
    mesh.geometry.faces.length > 0 &&
    mesh.geometry.vertices.length > 0
  ) {
    // do stuff here with the good mesh

    for (var i = 0; i < mesh.children.length; i++)
      if (!checkMesh(mesh.children[i], i))
        i--; // child was removed, so step back

    return true;
  } else // empty mesh! this causes WebGL errors
  {
    if (mesh.parent != null)
      mesh.parent.children.splice(child_index, 1);

    console.log(mesh.name + " has zero faces and/or vertices so it is removed.");
    mesh = null;

    return false;
  }
}
like image 190
DAG Avatar answered Oct 04 '22 06:10

DAG