Author Topic: WARNING: Coordinate array is sparsely populated! Consider to pre-process it to s  (Read 16450 times)

Offline daemontus

  • byte
  • *
  • Posts: 4
    • View Profile
Hi. I am new to Bones and I am trying to load one quite big .DAE animated model (12k vertices, around 10MB file size) on Android and I get this warning in LogCat:

 WARNING: Coordinate array is sparsely populated! Consider to pre-process it to save memory!

 Since this model needs around 128MB heap memory just to be loaded successfully, I was wondering what the Warning means and how can I do such a thing. Also any other help on reducing the memory needed to load such model is highly appreciated :) (I am noob so I have just processed the .DAE to .bones using convertion scripts, loaded it using BonesIO.loadGroup() and then added it to world.)

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
besides other things, that warning means you load your Collada model directly in Android. instead try converting it to Bones' binary format in desktop. that would be faster, will require less memory and wont depend on Ardor3D's classes in Android.

for the warning itself, try playing with exporter options and look for a setting like use indexed geometry.

Offline daemontus

  • byte
  • *
  • Posts: 4
    • View Profile
Thanks for advice about exporter, I will definitely look at this.
But that part about native .bones file is interesting. I am actually using .bones format and I get this warning anyway. To be more specific, I am using following code to covert .DAE file to .bones on desktop:

Code: [Select]

                File Spectre = new File("/Users/daemontus/Downloads/pilsner.DAE");
URI uri = Spectre.toURI();
final SimpleResourceLocator resLocater = new SimpleResourceLocator(uri.resolve("./"));
        ResourceLocatorTool.addResourceLocator(ResourceLocatorTool.TYPE_MODEL, resLocater);
ColladaImporter Col = new ColladaImporter().loadTextures(true);
ColladaStorage Stor = Col.load(uri.toString());
AnimatedGroup A3D = BonesImporter.importCollada(Stor, 4, new Quaternion());
BonesIO.saveGroup(A3D, new FileOutputStream("test.bones"));

And this code to load it on android device:

Code: [Select]
                Resources res = mActivity.getResources();
        model = BonesIO.loadGroup(res.openRawResource(R.raw.test));
        for (Animated3D o : model) {
        o.build();
        }
        masterNinja.addToWorld(world);

I get this warning both on Android and desktop. Any suggestions how to get rid of that warning on Android device?

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
ah, sorry, I thought that warning is coming from Ardor's Collada loader. seems as it comes from jPCT itself. just to be sure, is there a jPCT-AE tag at that warning line?

if so, again playing with exporter settings may help. you can also ask Egon for further detail and advice

Offline daemontus

  • byte
  • *
  • Posts: 4
    • View Profile
Yes, it has jPCT tag. Thanks for info anyway.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
That message comes from the bulk data constructor in Object3d:

Code: [Select]
public Object3D(float[] coordinates, float[] uvs, int[] indices, int textureId)

What it basically means it that the coordinates array has room for more triangles than the indices array actually addresses. An example: The coordinates array has 3000 entries, i.e. room for 1000 individual triangles, but the indices array only contains indices for 100 triangles. In that case, you would get this warning, because much room in the coordinates array will be left unused. jPCT can't re-index and compact that data, so it uses a coordinate array which might be much too large for the geometry. The message should make you aware of this. If you can change it somehow, fine. If not...maybe that's not an issue either. How many polygons does your object have?

Offline daemontus

  • byte
  • *
  • Posts: 4
    • View Profile
Thank you for clarification. Object has around 12000 polygons, so I understand it is going to consume a lot of memory, but honestly I did not expect that much :D