How to reduce the size of 3D .obj file

David picture David · Jun 1, 2014 · Viewed 10.6k times · Source

I'm developing a game using Android OpenGLES2. Making use of .obj files to draw 3D models, and the load time is too much because of the size of .obj file i.e., 3MB. Please suggest a method to minimize the obj file size

Answer

Maurizio Benedetti picture Maurizio Benedetti · Jun 5, 2014
  • First option, reduce the complexity of the object by cutting the number of triangles that form it
  • Second option, try to read the OBJ file in a single chunk instead of line by line. This would benefit the read time from the device
  • Third option, try to build a basic converter for OBJ into binary format. This sounds silly but it can very easy to be implemented since you already do the initial conversion (text to binary) when you load the model in memory. At this point, you just need to dump the binary in memory to a file. From there, you write the new loader (which is identical in logic to the dumper).
  • Fourth option. It is very unpractical, try to compress with you own algorithm the content of the file on disk. Read it compressed. Expand in memory. This is pretty much what happens in the apk file. Theoretically it is a lot of efforts that could result at the end of the day in a waste of time and in poor performances.

These are the only options available unfortunately