zturtleman / mm3d

Maverick Model 3D is a 3D model editor and animator for games.
https://clover.moe/mm3d
GNU General Public License v2.0
115 stars 23 forks source link

Remove Exported MD3 vertex/triangle limit #58

Closed Peach1 closed 4 years ago

Peach1 commented 5 years ago

Hey is it possible to remove the restriction on md3 triangle & vertex count export?

mm3d can load high resolution md3's just fine, but places artificial limits on the export

https://github.com/zturtleman/mm3d/blob/master/src/libmm3d/md3filter.cc#L1997

if ( numTris > MD3_MAX_TRIANGLES )
   {
      log_error( "Number of triangles(%d) is larger than %d\n.\n", numTris, MD3_MAX_TRIANGLES );
      m_model->setFilterSpecificError( transll( QT_TRANSLATE_NOOP( "LowLevel", "Too many faces in a single group for MD3 export" ) ).c_str() );
      return Model::ERROR_FILTER_SPECIFIC;
   }

MD3_MAX_TRIANGLES is 8192 but that's an arbitrary limit Quake engine imposed on itself, you can have basically int32max amount of tris in the md3 format and other applications, including maverick can import md3s that are far over that limit of 8192

Can the error messages for MD3_MAX_VERTS, MD3_MAX_TRIANGLES, MD3_MAX_FRAMES be removed?

zturtleman commented 5 years ago

I made the vertex and triangle limit apply to individual meshes (as indicated by Quake 3 source code comments and MM3D error message) instead of the whole model. https://github.com/zturtleman/mm3d/commit/422b69d51eeae3c41a23dc5fec10ce0894415d52

32 meshes × (4096 vertexes | 8192 triangles) is a lot of geometry. Though ideally one would not have to break up mesh to get around vertex limit. (Which is now occurring to me that I should of just 32× the limit applied to the whole model.)

The only limits that Quake 3 enforces are 999 vertexes / 1999 triangles per-mesh… which is lower than the MD3 limits. Increasing them isn't really an issue aside from needing to calculate how much they can increase them while still fitting in 2GB (int32max).

Peach1 commented 5 years ago

I think 32x the limit to the whole model would be a cleaner limitation, because realistically some users are having issues exporting a 28k triangle md3, and it's literally just an arbitrary error message, not an actual 'export process failed' problem

m-7761 commented 5 years ago

@Peach1 Do you know where to find MM3D users? I'm curious to know who is using it, and how. If there are plugins.

zturtleman commented 4 years ago

Removed MD3 limits in https://github.com/zturtleman/mm3d/commit/aa55fb2edfb3a53480ce6e914b33ab523bb6b29e. Calculating filesize ahead of time to avoid invalid MD2 and MD3 export [larger than 2GB file] is now a separate issue: https://github.com/zturtleman/mm3d/issues/83.