How to reduce the size of 3D .obj file

13,493

Solution 1

  • 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

Solution 2

You should use ready binary data instead of parsing .OBJ files on mobile device - that's way too slow.

Share:
13,493
David
Author by

David

Updated on June 24, 2022

Comments

  • David
    David almost 2 years

    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