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

匿名 (未验证) 提交于 2019-12-03 02:24:01

问题:

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?

回答1:

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;   } }


回答2:

It's hard to say what could be wrong without seeing your code, but I would suggest trying JSON export and import. In three.js sourse, go to utils/exporters/blender and install JSON exporter (check readme.md). Then export your model to JSON checking carefully exporting options (type of geometry, UVs, textures). Then, you can import your model like this:

var loader = new THREE.JSONLoader(); loader.load("model.json", function(geometry, material) {     var m = new THREE.MultiMaterial(material);     var o = new THREE.Mesh(geometry, m);     scene.add(o); }); 

I did not compare to OBJ/MTL, but in comparison to Collada, JSON loader is way faster.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!