首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我使用objImporter,它不是问题创建的统一,而是导入创建的3dmax,这是问题

我使用objImporter,它不是问题创建的统一,而是导入创建的3dmax,这是问题
EN

Stack Overflow用户
提问于 2019-04-26 01:37:48
回答 2查看 272关注 0票数 0

我使用objImporter,它不是问题创建的统一,而是导入创建的3dmax,这是问题

사용한스크립트https://wiki.unity3d.com/index.php/ObjImporter

这个错误发生了

代码语言:javascript
复制
Mesh.vertices is too large. A mesh may not have more than 65000 vertices.
UnityEngine.Mesh:set_vertices(Vector3[])
ObjImporter:ImportFile(String) (at Assets/MyAssets/Scripts/ObjImporter.cs:52)
UIManager:Load() (at Assets/MyAssets/Scripts/UIManager.cs:50)
UnityEngine.EventSystems.EventSystem:Update()

Mesh.uv is out of bounds. The supplied array needs to be the same size as the Mesh.vertices array.
UnityEngine.Mesh:set_uv(Vector2[])
ObjImporter:ImportFile(String) (at Assets/MyAssets/Scripts/ObjImporter.cs:53)
UIManager:Load() (at Assets/MyAssets/Scripts/UIManager.cs:50)
UnityEngine.EventSystems.EventSystem:Update()

Mesh.normals is out of bounds. The supplied array needs to be the same size as the Mesh.vertices array.
UnityEngine.Mesh:set_normals(Vector3[])
ObjImporter:ImportFile(String) (at Assets/MyAssets/Scripts/ObjImporter.cs:54)
UIManager:Load() (at Assets/MyAssets/Scripts/UIManager.cs:50)
UnityEngine.EventSystems.EventSystem:Update()

Failed setting triangles. Some indices are referencing out of bounds vertices. IndexCount: 166833, VertexCount: 0
UnityEngine.Mesh:set_triangles(Int32[])
ObjImporter:ImportFile(String) (at Assets/MyAssets/Scripts/ObjImporter.cs:55)
UIManager:Load() (at Assets/MyAssets/Scripts/UIManager.cs:50)
UnityEngine.EventSystems.EventSystem:Update()
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2019-04-26 09:09:26

问题是脚本使用16位索引的网格,它只支持2^16个顶点大小的模型。然而,一致性支持32位索引,支持最多2^32个顶点=~40亿。您需要做的就是添加这一行:

代码语言:javascript
复制
mesh.indexFormat = Rendering.IndexFormat.UInt32;

在此之后:

代码语言:javascript
复制
Mesh mesh = new Mesh();

在函数ImportFile中。

注意,一些移动设备不支持32位索引。

https://docs.unity3d.com/ScriptReference/Mesh-indexFormat.html

票数 1
EN

Stack Overflow用户

发布于 2019-04-26 10:16:54

我相信你的问题与模型大小有关,因为网格可能有超过65000个顶点。你应该阅读65000个顶点的每一块,然后把它们放在一个网格中,然后把所有的网格块收集到一个网格中,即共享网格,

我强烈建议使用这个资产简单.OBJ,这样可以节省您的时间。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55859694

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档