Three.js - can I detect geometry 'islands' when importing?

落爺英雄遲暮 提交于 2019-12-24 02:45:09

问题


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.

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


回答1:


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

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.

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



来源:https://stackoverflow.com/questions/26849791/three-js-can-i-detect-geometry-islands-when-importing

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