I am parsing and loading a 3d object file (similar to ColladaLoader in operation). This contains several objects, and many of the individual objects have several materials across different faces. So, I use MeshFaceMaterial. No problems so far.
我正在解析并加载一个3d对象文件(类似于操作中的ColladaLoader)。它包含多个对象,并且许多单个对象在不同的面上具有多种材质。所以,我使用MeshFaceMaterial。到目前为止没问题。
However, a handful of the objects re-use materials across them. Would it be appropriate to create a single MeshFaceMaterial and use it across all objects? There are about 120 objects per file. My concern is that if I go down this route it may impair performance (e.g. excessive draw calls, or maybe allocation of memory for each material per object?) as the majority of the objects use their own unique materials. Or, is this an undue concern and the renderer is suitability mature for this not to be a problem? The online documentation only mentions shared geometry, not entire shared Three.Mesh objects.
但是,少数对象会重复使用其中的材料。是否适合创建单个MeshFaceMaterial并在所有对象中使用它?每个文件大约有120个对象。我担心的是,如果我沿着这条路走下去,它可能会影响性能(例如过度的绘制调用,或者每个对象的每种材料可能分配内存?),因为大多数对象都使用自己独特的材料。或者,这是一个过分关注的问题,渲染器是否适合成熟,这不是一个问题?在线文档仅提及共享几何,而不是整个共享的Three.Mesh对象。
1 个解决方案
#1
Using renderer.info as suggested, I was able to take a look at the draw calls, and I'm happy to report they were the same regardless of if you used a single shared MeshFaceMaterial, or individual ones per object. That's not to say there may be other performance penalties, and it does seem logical in clearly separate objects to keep things separate, but for this usage case where there is some crossover, it was not a problem.
按照建议使用renderer.info,我能够看一下绘制调用,并且我很高兴地报告它们是相同的,无论你是使用单个共享的MeshFaceMaterial还是每个对象的单独的。这并不是说可能存在其他性能损失,并且在明确区分对象以保持分离方面似乎是合乎逻辑的,但对于这种使用情况,存在一些交叉,这不是问题。
#1
Using renderer.info as suggested, I was able to take a look at the draw calls, and I'm happy to report they were the same regardless of if you used a single shared MeshFaceMaterial, or individual ones per object. That's not to say there may be other performance penalties, and it does seem logical in clearly separate objects to keep things separate, but for this usage case where there is some crossover, it was not a problem.
按照建议使用renderer.info,我能够看一下绘制调用,并且我很高兴地报告它们是相同的,无论你是使用单个共享的MeshFaceMaterial还是每个对象的单独的。这并不是说可能存在其他性能损失,并且在明确区分对象以保持分离方面似乎是合乎逻辑的,但对于这种使用情况,存在一些交叉,这不是问题。