Animated models

I encountered some issues regarding animated models on Android. (Samsung Galaxy S, Android 2.2)



I used the TestOgreConvert example to save the animated model in the jme binary format (both with the original model of the example and a custom made model by myself) and loaded them on android.



Unfortunately, when the model SHOULD be visible, the screen is black (even if the background is set to white).

When I move the camera away from the model, the scene renders fine. and when the model is rendered partially, it seams to work. (this behavior is caused even when I did not start any of the model animations)



Did anyone else had some issues with importing (animated) models on Android and solved them?

Sounds like a culling problem, for some reason the bounding volume of the model is not computed right. Since the ogre importer for desktop and android is basically the same thats kind of strange, did you make sure this is not only occurring on the android platform? If it happens in desktop as well, can you please upload the model file somewhere and post a link?

Well I do not use the OgreImporter but the BinaryImporter. (I thought the binary importer is the best way to load models on Android)

When I use the exported binary (converted from Ogre) model in a test application, everything works fine (both the animated model from the TestOgreConvert app and my own animated model).



When I place the files used by OgreImporter on my Android assets and load via assetManager.loadModel(ModelKey), I get this exception:



[java]

05-10 14:33:33.585: ERROR/Application(5960): Uncaught exception thrown in Thread[GLThread 9,5,main]

05-10 14:33:33.585: ERROR/Application(5960): java.lang.UnsupportedOperationException: Not supported yet.

05-10 14:33:33.585: ERROR/Application(5960): at com.jme3.asset.AndroidAssetManager.loadModel(AndroidAssetManager.java:247)

05-10 14:33:33.585: ERROR/Application(5960): at foo.com.NewTestApp.simpleInitApp(NewTestApp.java:85)

05-10 14:33:33.585: ERROR/Application(5960): at foo.com.MySimpleApplication.initialize(MySimpleApplication.java:321)

05-10 14:33:33.585: ERROR/Application(5960): at com.jme3.system.android.OGLESContext.initInThread(OGLESContext.java:129)

05-10 14:33:33.585: ERROR/Application(5960): at com.jme3.system.android.OGLESContext.onSurfaceCreated(OGLESContext.java:214)

05-10 14:33:33.585: ERROR/Application(5960): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1317)

05-10 14:33:33.585: ERROR/Application(5960): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1116)

[/java]

Yeah, binary importer is the best way, I suggest just trying to update the bounds of the model after loading… model.updateModelBound() should do it… Question is why that is necessary :confused:

So this is what I observed:

When the model is displayed at the center of the screen, it works fine (the framerate is about 15) but sometimes (looks like it somehow depends on where the model is displayed on the screen) the framerate drops radically to 5 FPS and the Garbage Collector goes havoc like…

[java]

05-11 08:51:37.429: DEBUG/dalvikvm(12351): GC_FOR_MALLOC freed 1777 objects / 379896 bytes in 46ms

[/java]

… every some seconds and models start shaking up and down frequently (GC works at least two times as often as when the screen does not shake like hell). So it looks to me that there are more objects created (or at least destroyed :)) .

Uh, you sure your code is correct? Never heard of anything like this.

I can remember having the same problem a few months ago, but it went away since im using the colladaloader.

And i cant remember what it was, i think it was some small difference in the nio libs on android.

Is the bounding box stored inside the j3o file or is it calculated during import?



Regarding the GC: dalvik doesnt like it if new objects are allocated in the GL thread!

As the GC stopps all threads during garbage collection, you see this jumping each few seconds.



Avoid at all costs to allocate new objects in your update function!

And update jme3, it got much better a few weeks ago.

Hi guys, thanks for your input.

So here is some new information.

So far I loaded the model into the scene AND I left two of the textured spheres from the basic example for testing purposes.

Now, when I remove these two spheres, the scene runes WITHOUT problems (the framerate fluctuates between 9 and 18 FPS when an animation is running).

I made some changes and I am shure that there is no problem with the textures (removed them and it still did not work).

So displaying the model AND some other stuff seams to cause these problems.

Maybe there is just too much going on behind the scenes because I use the phone sensors to align the camera view in JME, but I fairly doubt it because the scene still had problems even when I removed that code.



Btw, the model loading and adding is done in the SimpleInitApp method just before adding the spheres.

And I think I downloaded the library last friday did any changes occures since then?

Did you download the jar or checkout from svn? I suggest you get the source from svn and compile yourself.

Last friday would be ok from svn, but i dont know when the distribution jars have been build last.



You could also try the renderer that i am using:

https://colladaviewer.googlecode.com/svn/trunk/AndroidRenderer

larynx said:
Did you download the jar or checkout from svn? I suggest you get the source from svn and compile yourself.
Last friday would be ok from svn, but i dont know when the distribution jars have been build last.

The nightly build (as well as the normal jme3 build) now always calls the android build too, so in the nightly the jMonkeyEngine3.jar in opt/android is up to date.