jPCT-AE - a 3d engine for Android > Support

Large obj file issue > 5mb

<< < (2/3) > >>

EgonOlsen:
The best solution would be to use smaller models in the first place. If that's not an option, serialized objects should help:

http://www.jpct.net/wiki/index.php?title=Differences_between_jPCT_and_jPCT-AE#Performance_and_memory_issues.2C_serialized_objects

Promyclon:
Take into account that Android puts some restriction on files larger than 5MB. The solution is to pack them into a zip. These files, as well as i.e. mp3, can be larger than 5MB. Then use ZipInputStream to read them as ZipEntries.

Reading .obj files uses much memory because an entire file is read to the buffer first and is kept until all objects it contains are constructed by parsing lots of strings to floating point data. Reading serialized objects is more merciful for memory and is faster, although some data is ignored during serialization (I've still to check the new beta).

mayuran.r:
Hi,

Thanks for your guidance. Sorry for the late reply.
Btw I am new to JPCT, I Managed to render the 3D models over the camera view. I have started trying out both the solution.

Thanks EgonOlsen, There are few doubts
1. Do we must need Eclipse to serialize the 3D models?
2. If we serialize the models, size of the model will be reduced?  [My Obj is comparably large (~73mb).]
3. If I have the code explanation to serialize model , it will be easy to follow and understand.

Thanks Promyclon, I am interested in this solution too.
1. I have compressed my 3D model, it came around 15mb.
2. But when I load the model , nothing is displayed. obj values are not retrieved it seems.
I could identify that by applying a texture for that model(Null value exception encountered)
If I get some code sample, I can try it out.

Also I have added  android:largeheap = true, in that scenario,
.obj values are read, but model is not rendered. I see a message in the stack as 'Suspending all threads took: 36.969ms'

I have tried out with .3ds model also(.obj converted as .3ds : ~20mb), in that case also ,
model is not rendered , but in the monitor I can see the values are read . Will it take too much of time? but in that case also I can see 'Suspending all threads took' message (but not often)

I am using Pixel for this purpose.
Hope you will guide me to a good solution

Thank you in Advance.

EgonOlsen:
Serialized objects are actually larger at times, but they compress very will. You can zip them and then load them via ZipInputStream.

An no, you don't need Eclipse for that but some IDE that can execute desktop Java. Android Studio might not be the best choice for this task.

What you basically do is to load your object with desktop Java/jPCT, call build() on it and then do


--- Code: ---new DeSerializer().serialize(obj, new FileOutputStream("storage/android/some_name.ser"), true);

--- End code ---

You can then zip the result and load it in Android similar to this


--- Code: ---zis = new ZipInputStream(<AssetManagerInstanz>.open("some_name.ser.zip"));
try {
zis.getNextEntry();
} catch (IOException e) {
throw new RuntimeException(e);
}

Object3D obj=Loader.loadSerializedObject(zis);

--- End code ---

mayuran.r:
Hi
I have done everything as you said.
But when I run, I got this error

"Can't deserialize object: [] - ERROR: Unsupported version: 6"

What could be the reason

Thanks

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version