本文介绍了三个js导入OBJ模型[.CommandBufferContext] RENDER警告:渲染计数或primcount为0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到数以千计的错误(谷歌浏览器):

I get thousands of errors (google chrome):

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

从Bledner导出的OBJ和MTL文件,使用OBJMTLLoader.js作为加载程序
搬家后到R73。

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

任何经验?

推荐答案

这种情况发生在低级渲染调用被告知绘制零顶点/面。这是因为你有一个或多个具有零面/顶点的多边形的网格,所以在每次绘制调用时,这个错误都会堆积起来。

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.

问题可能是你的模型或者它可能是出口/进口过程。如果它是模型,那么下面是关于如何找到问题区域的松散想法。我建议不要使用带有ThreeJS和Blender的OBJMTLLoader,因为ThreeJS附带了一个Blender插件用于导出,它可以工作。

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

这篇关于三个js导入OBJ模型[.CommandBufferContext] RENDER警告:渲染计数或primcount为0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 07:46