Three.js - 我可以在导入时检测几何“岛"吗? [英] Three.js - can I detect geometry 'islands' when importing?

查看:25
本文介绍了Three.js - 我可以在导入时检测几何“岛"吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将 .3DS 模型导入 Blender 2.72b,然后使用 Three.js 导入/导出插件导出它们.模型有多个几何岛"(连接面和顶点的单独组),每个都有自己的材料.我希望能够将每种材料与其对应的岛配对,而不必创建单独的 THREE.Geometry 对象.经过一番挖掘,我发现了这个问题这建议使用 THREE.MeshFaceMaterial 为一个对象实现多种材质.唯一的问题是该示例中的几何图形是一个简单的立方体,而我的模型有数百个面分布在 2-5 个岛屿上.

I'm importing .3DS models into Blender 2.72b, then exporting them with the Three.js import/export addon. The models have multiple geometry 'islands' (separate groups of connected faces and vertices), each with its own material. I'd like to be able to pair each material with its corresponding island, without having to create separate THREE.Geometry objects. After some digging, I found this question which suggests using a THREE.MeshFaceMaterial to achieve multiple materials for one object. The only problem is that the geometry in that example is a simple cube, whereas my models have hundreds of faces spread across 2-5 islands.

Three.js 是否具有识别网格中几何孤岛"的功能?

Does Three.js have functionality for identifying geometry 'islands' in a mesh?

推荐答案

没有.Three.js 没有识别网格中几何孤岛"的功能.

No. three.js does not have functionality for identifying geometry 'islands' in a mesh.

当使用 MeshFaceMaterial 时,WebGLRenderer 无论如何都会将几何体分成块——每种材质一个块.这样做是因为 WebGL 支持每个几何图形一个着色器.

When using MeshFaceMaterial, WebGLRenderer breaks the geometry into chunks anyway -- one chunk for each material. It does that because WebGL supports one shader per geometry.

我不会合并您所有的几何图形,然后使用 MeshFaceMaterial,只会让渲染器将单个几何图形分开.

I would not merge all your geometries, and then use MeshFaceMaterial, only to have the renderer break the single geometry apart.

如果您愿意,您可以合并共享单一材料的几何图形.

You can merge geometries that share a single material if you wish.

three.js r.69

three.js r.69

这篇关于Three.js - 我可以在导入时检测几何“岛"吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆