umasteeringgroup / UMA

Unity Multipurpose Avatar
MIT License
727 stars 167 forks source link

Maximum vertex count #313

Closed rayuthebest closed 4 years ago

rayuthebest commented 4 years ago

Hello,

I am trying to use UMA 2 library to import high poly 3D models on my game. I am currently using v2.9 (although I have also tested v2.10 and problem persist)

When I tried the first time to import a helmet for my high poly 3D model on UMA, library reports me the next error:

Could not claim shared submesh buffer of size: 277572

Tracing this error, I found that it was related with the MAX_VERTEX_COUNT constant defined at UMA/Core/StandardAssets/UMA/Scripts/UMAMeshData.cs file.

Looking on changelog of v2.10, I see that this constant has been increased to allow importing high poly models. I download this version. but problem persist (it seems that although the buffer sizes have been increased, they are not enough for my game)

Due to this fact, I have increased the MAX_VERTEX_COUNT constant to 10.000.000 (on version 2.9 and v2.10) and the error reported by the app disapeared but a new issue appears.

Helmet

Shoulders

Helmet_Shoulders

It seems that there is something related with the vertex count on the model, but as no error appears, I cannot trace this issue easily.

Can you give me some support? Tell me if I can help you on anything to solve this issue.

Thanks in advance

rayuthebest commented 4 years ago

Hello again,

After investigating a little on this issue, I found that it was related with the mesh indexFormat field of the SkinnedMeshRenderer at UMAData.cs. This field is set on UInt16, so the number of vertex and triangles is limited in order to provide greater performances.

I have solved my issue on the method SetRenderers at UMAData.cs (I do not know if this is the best solution), adding the next modification:

public void SetRenderers(SkinnedMeshRenderer[] renderers) { this.renderers = renderers; foreach(SkinnedMeshRenderer render in renderers) { render.sharedMesh.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32; } }

KABBOUCHI commented 4 years ago

Did you try this from the doc?

Added support for 32 bit index buffers (large meshes). To enable, add UMA_32BITBUFFERS to the player defines. This is experimental at this time.

Jaimi commented 4 years ago

There is now a UMA preference item to enable 32 bit meshes. Closing.