Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - gururise

#1
Bones / Re: Bones - Skeletal and Pose animations for jPCT
February 11, 2011, 06:54:00 PM
Quote from: EgonOlsen on February 11, 2011, 01:20:25 PM
Quote from: raft on February 11, 2011, 12:54:35 PM
Quote from: gururise on February 11, 2011, 07:55:38 AM
Would I be able to use the NDK to allocate space for the AnimatedGroup object to bypass the 16MB heap on older android phones?
i'm not aware of such a thing.
There is no such thing. The limit is compiled into the VM by the phone's vendor. You can't even be sure that Android version x.y always supports the same limit...it depends on the vendor's choice.

I found an interesting blog post on how to work around the 24mb heap limit in Android by using the NDK.  Apparently, memory allocations in c/c++ via the NDK are not subject to the java heap limit.  There is also a great thread where one of the Google developers chimed in and basically said the same thing, but suggested not going over 32MB via the NDK.

I'm wondering if its possible to declare an AnimatedGroup on the java side, pass it over to the NDK via JNI and then allocate say 24MB via malloc (or new), and then pass it back to Java and instantiate the AnimatedGroup by loading the Bones file... Not sure if that would work or not.
#2
Bones / Re: Bones - Skeletal and Pose animations for jPCT
February 11, 2011, 07:55:38 AM
Quote from: raft on February 11, 2011, 12:15:33 AMhow many polygons are your model? the ninja model is more than 500 polygons and 8 ninjas run without any memory problems. maybe there is some other thing that consumes memory, big textures maybe?

I've got complex model.  I currently got it down to about 6000 polygons, and am now able to load it on my Nexus One.  When I had it at about 10,000 polys, it would crash upon loading.  
I also only have one texture at 512x512.  I tried making the texture larger, the desktop version seems to handle 1024x1024 w/o problems, but on Android, it crashed on loading the texture if I have it larger than 512x512, perhaps thats a limit.

Edit: I think I was bumping into the Android Java heap limit (16MB, and 24MB on some phones).  As it stands now, after loading (but before GC), I need about 18MB of heap, which is why it works on my nexus one. Would I be able to use the NDK to allocate space for the AnimatedGroup object to bypass the 16MB heap on older android phones?
#3
Bones / Re: Bones - Skeletal and Pose animations for jPCT
February 10, 2011, 11:52:52 PM
Well, I have successfully loaded a collada model into the Desktop JPCT w/Bones. Everything is working great, and I am able to manipulate the skeleton procedurally.

Now, I want to load the same model into JPCT-AE (Android) w/Bones. I noticed, in the Android example with the ninja, you loaded a ninja.group.bones from the /raw/ directory.

In the desktop Jpct/Bones, I load my collada model, then use BonesIO.saveGroup(animatedGroup, output) to save my model to model.group.bones and then imported it into Android. The first time I did this, I got an out of memory error.  After spending hours reducing the number of polygons in the model, I was finally able to get it to load in Android, but with very little memory to spare.. and my model looks quite ugly now due to the low poly count.  I am wondering if the exported file is being serialized??

In Jpct-AE, it is recommended to first serialize the object on the desktop, then load the serialized object into Android.  When I call BonesIO.saveGroup, does it perform this serialization step?  Are there any other optimizations I should perform on the AnimatedGroup before I export it to the bones format to be loaded into Android?  

Thank You
#4
Bones / Re: Bones - Skeletal and Pose animations for jPCT
February 09, 2011, 10:32:48 PM
Got it! I guess I need to import these collada models into a 3d program and work on creating a skeleton.

Thanks again for all your help!
#5
Bones / Re: Bones - Skeletal and Pose animations for jPCT
February 09, 2011, 09:30:14 PM
Thanks for the response! I have given up on trying to export models from Daz 3d, to trying to use the Collada Models in the Google 3d Warehouse; however, every time I try to load one of those collada models into Bones, I keep getting the following exception:
Exception in thread "main" java.lang.IllegalArgumentException: ColladaStorage contains no skins.
at raft.jpct.bones.BonesImporter.importCollada(BonesImporter.java:49)


I tried the following collada models from Googles 3d Database, and they all resulted in the same exception:
Collada Model 1
Collada Model 2
Collada Model 3

Can we not use the Google Collada models in Bones?

Thanks
#6
Bones / Re: Bones - Skeletal and Pose animations for jPCT
February 04, 2011, 09:55:28 AM
I've got one more issue that I hope someone can help me with (sorry to bombard the forum with these)..

I just tried out the the ProceduralAnimationSample and it looks pretty straightforward, all except that it seems the mesh does not follow the bones (as can be seen in this photo), it seems as if the applySkeletonPose() is not working.  Is there something else that needs to be done to get the mesh to follow the skeleton?  Thanks!



protected void update(long deltaTime) {
   totalTime += deltaTime;
   updateBallLocation();
   currentPose.updateTransforms();
   skeletonDebugger.update(currentPose);
   animatedGroup.applySkeletonPose();  // *** This line seems to have no effect.
       
   cameraController.placeCamera();
}
#7
Bones / Re: Bones - Skeletal and Pose animations for jPCT
February 04, 2011, 07:23:45 AM
Thank you for the quick answer.

I have another problem trying to export the base DAZ Victoria 4.2 model. I'm using the FREE Daz Studio 3.1, and have been exporting using the Autodesk FBX Collada exporter, and thus far, the V4 models load with Bones just fine (minus the texture issue I reported in the last post); however, the Autodesk FBX Collada exporter on Daz Studio does not save the animation for some reason (even if you check the save animation & poses tab).

So I switched to using the default DAZ Collada Exporter with the following options:


Which results in the following exception:
java.lang.RuntimeException: Unable to load collada resource from URL: URLResourceSource [url=file:/home/gene/temp/vicky.dae, type=.dae]
at com.ardor3d.extension.model.collada.jdom.ColladaImporter.load(ColladaImporter.java:154)
at com.ardor3d.extension.model.collada.jdom.ColladaImporter.load(ColladaImporter.java:91)
at bones.samples.SimpleBones2.getModel(SimpleBones2.java:342)
at bones.samples.SimpleBones2.access$4(SimpleBones2.java:329)
at bones.samples.SimpleBones2$Eve.init(SimpleBones2.java:292)
at bones.samples.SimpleBones2$Eve.<init>(SimpleBones2.java:251)
at bones.samples.SimpleBones2.init(SimpleBones2.java:126)
at bones.samples.SimpleBones2.runIt(SimpleBones2.java:57)
at bones.samples.SimpleBones2.main(SimpleBones2.java:52)
Caused by: com.ardor3d.extension.model.collada.jdom.ColladaException: Collada problem for source: [Element: <skin/>]: Unable to find joint with sid: GlamourHairV4_21847
at com.ardor3d.extension.model.collada.jdom.ColladaAnimUtils.buildSkinMeshes(ColladaAnimUtils.java:288)
at com.ardor3d.extension.model.collada.jdom.ColladaAnimUtils.buildController(ColladaAnimUtils.java:157)
at com.ardor3d.extension.model.collada.jdom.ColladaNodeUtils.getVisualScene(ColladaNodeUtils.java:115)
at com.ardor3d.extension.model.collada.jdom.ColladaImporter.load(ColladaImporter.java:134)
... 8 more


If I try unchecking the "Merge Skeletons" checkbox, I get the following:
java.lang.IllegalArgumentException: There are more than one skeletons in ColladaStorage.
at raft.jpct.bones.BonesImporter.findUniqueArdorSkeleton(BonesImporter.java:339)
at raft.jpct.bones.BonesImporter.importCollada(BonesImporter.java:63)
at bones.samples.SimpleBones2.getModel(SimpleBones2.java:344)
at bones.samples.SimpleBones2.access$4(SimpleBones2.java:329)
at bones.samples.SimpleBones2$Eve.init(SimpleBones2.java:292)
at bones.samples.SimpleBones2$Eve.<init>(SimpleBones2.java:251)
at bones.samples.SimpleBones2.init(SimpleBones2.java:126)
at bones.samples.SimpleBones2.runIt(SimpleBones2.java:57)
at bones.samples.SimpleBones2.main(SimpleBones2.java:52)


Do you have any suggestions?  
#8
Bones / Re: Bones - Skeletal and Pose animations for jPCT
February 04, 2011, 04:47:41 AM
Thank you for the Bones Collada importer. Its a godsend! =)

Now, hopefully you can help me. I'm trying to load some pretty big models (DAZ Victoria) that I exported in Wavefront Collada format. The models import just fine through Bones; however, I can't get the textures...

I've tried
ColladaImporter colladaImporter = new ColladaImporter().loadTextures(true);
which results in:
WARNING: Unable to read image of type: .jpg
Feb 3, 2011 7:38:08 PM com.ardor3d.image.util.ImageLoaderUtil loadImage
WARNING: loadImage(String, InputStream, boolean): no imageData found.  defaultTexture used.

The textures are in .jpg format, and it seems that the Ardor3d loader can only support TGA and DGA texture formats...

So I guess I have to load the textures manually, so in my code:

AnimatedGroup skinnedGroup;
try {
ColladaImporter colladaImporter = new ColladaImporter().loadTextures(false);
ColladaStorage colladaStorage = colladaImporter.load(uri.toString());

skinnedGroup = BonesImporter.importCollada(colladaStorage, 1f, new Quaternion().rotateX((float)Math.PI));
} finally {
ResourceLocatorTool.removeResourceLocator(ResourceLocatorTool.TYPE_MODEL, resLocater);
}
TextureManager tm = TextureManager.getInstance();
tm.addTexture("tex2_SkinHipf_1_Diff", new Texture("/temp/victoria.images/V4SmplTorsoM_NG.jpg"));
tm.addTexture("tex2_SkinTorsof_1_Diff", new Texture("/temp/victoria.images/V4SmplTorsoM_NG.jpg"));
// .... load a bunch more textures here ...

for (Animated3D o : skinnedGroup) {
  o.setTexture(o.getName());  // HOW CAN I GET THE NAME OF THE OBJECT TO ASSOCIATE WITH THE TEXTURE?? o.getName() does not match the texture name!
  o.build();
  o.compileAndStrip();
  o.discardMeshData();
}


Now my problem above is, I've got a TextureManager object full of textures, how can I know which objects correctly associate with which texture?  Unfortunately, the Animated3D object names are generic (ie. Object11), so I don't know which texture to assign to what object.  I'm new to this whole 3d programming stuff, so maybe there is a simple way to solve this problem.

Thanks!