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 - lancew

#1
Support / Re: animation performance
February 03, 2012, 08:56:01 PM
After further testing it seems that 22 animations is very doable.

10fps on HTC Aria (old phone), 18-26fps on LG Optimus (newer but bargain phone), 36-38 on htc inspire,58-60 fps on samsung galaxy nexus (very high end phone), 60 fps on samsung tablet,
#2
Support / Re: animation performance
February 02, 2012, 11:14:10 PM
Quote from: EgonOlsen on February 02, 2012, 11:09:37 PM
I did a quick check on my old Galaxy, which is less powerful than your phone (same cpu clock, but no fpu) with Android 1.6 but using a VM with a JIT: It can display 22 models @ 13 fps in my test case. Maybe your performance penalty comes from something else like the rest of your test case? If you want to test animation performance, maybe you should focus on that for now and skip the terrain and such.

Well, the problem with that is that my end product won't be just the animations.  There will be other static models that need to be taken into account.

btw, I'm not intending to use that md2.  It is just for testing purposes, with about the same complexity as I think the models in my product should have.
#3
Support / Re: animation performance
February 02, 2012, 11:11:43 PM
Thanks for the quick and detailed reply.  I did update my phone to android 2.2, but I'm not sure how much benefit that would provide.

I figured the fact that my phone is 1.5 years old was making a difference (especially since it was the low-end, free with contract phone), but I couldn't be sure exactly how much. 

I'm going to test this on a friends newer phone, and if what you say proves to be true, then this engine meets my needs perfectly =P
#4
Support / Re: animation performance
February 02, 2012, 10:08:39 PM
re-sizing the texture to 64x64 showed no improvement.
#5
Support / animation performance
February 02, 2012, 09:43:35 PM
Before committing to this engine I needed to verify that it could handle 22 uniquely animated meshes (same base model) concurrently.    Here's the setup code:


models = new Object3D[22];
for(int i = 0; i < 22; i++)
{
models[i] = new Object3D(model, false);
        //spread them out in a line for viewing them all at once
        models[i].translate(i*30, 0 0);
models[i].build();
world.addObject(models[i]);
}


I also have the app setup with a Primitive Plane representing the ground:


Object3D ground = Primitives.getPlane(10, 200);
ground.build();
ground.setTexture("grass");
ground.calcTextureWrap();
//function from http://www.jpct.net/wiki/index.php/Advanced_example
tileTexture(ground, .5f);
//rotate by 90 degrees to put it on the x-z plane
ground.rotateX(0.0174532925f * 90f);

world.addObject(ground);


as well as the exact skydome model and code from http://www.jpct.net/wiki/index.php/Advanced_example

and then later in the render function:


//repeat the animation every 5 seconds
float anim = (float)(System.currentTimeMillis() % 5000)/5000;

for(int i = 0; i < 22; i++)
{
        //set them all to a slightly different key frame
float index = anim + (float)(i*5)/1000;
if(index > 1f)
index -= 1f;
models[i].animate(index);
models[i].build();
}


The compiled app comes out at 488kb.

When all the animations are visible I am getting ~6-10 fps.  With only 1 animation running, it runs at 58-60 fps.  My phone is http://www.htc.com/us/support/aria-att/tech-specs/
Is this low fps what you would expect, or might I have some other problem going on?

The animation I am using is attached (i got it from http://jpct.de/download/mesh/quake2_models.7z)

[attachment deleted by admin]
#6
Support / Re: question about object3d.translate
January 29, 2012, 02:46:26 PM
Thanks, that did the trick.  Heres the code for reference:


//only move if the touch move was greater than the tolerance.
//this eliminates the minute moves that occur when holding finger
//still.
if(Math.abs(yd) > MOVE_TOLERANCE || Math.abs(xd) > MOVE_TOLERANCE)
{
SimpleVector xMove = horse.getXAxis();
xMove.scalarMul(-yd * MOVE_INCREMENT);
SimpleVector zMove = horse.getZAxis();
zMove.scalarMul(-xd * MOVE_INCREMENT);
moveVec = xMove;
moveVec.add(zMove);
}


and later...

horse.translate(moveVec);
#7
Support / Re: question about object3d.translate
January 28, 2012, 10:06:38 PM
Alright, I'm having another issue.  Heres the code in question:


//rotate horse according to user input
horse.rotateY(turn);
if(moveVec.x > 0 || moveVec.z > 0)
{
        //rotate the move vec to match the horses orientation so the movement is propagated properly
moveVec.rotateY(turn);
horse.translate(moveVec);
}


The problem was that the horse was always moving according to his original orientation.  ie, moving forward moved the horse in the same direction (along x axis) regardless of which way the horse was facing.  So I added moveVec.rotateY(turn), thinking that would fix the problem, but it didn't.  Any ideas?
#8
Support / Re: question about object3d.translate
January 28, 2012, 09:39:41 PM
Worked like a charm, thanks =P  Heres the code for reference:


horse.translate(moveVec);
cam.setPosition(horse.getTranslation());
cam.align(horse);
//horse's 'forward' is actually his side.  rotate to compensate
cam.rotateCameraY(0.0174532925f * 90f);
//move back according to zoom input
cam.moveCamera(Camera.CAMERA_MOVEOUT, currentZoom);
//move up, but move up less if looking up
cam.moveCamera(Camera.CAMERA_MOVEUP, (currentZoom - lookUp) * .5f);
#9
Support / Re: question about object3d.translate
January 28, 2012, 06:43:39 PM
OK, now it makes sense.  I'll try it out in a bit.  thanks for your help guys.
#10
Support / Re: question about object3d.translate
January 28, 2012, 05:16:39 PM
Thanks for the reply.  So am I supposed to be calling clearTranslation() at all?  I still don't get why the camera isn't following the horse.
#11
Support / question about object3d.translate
January 27, 2012, 10:33:02 PM
I basically want to move the horse based upon user input, and have the camera follow the horse.  moveVec.y will always be 0 so that the horse will always move in the x-z plane.  The problem is that the horse moves, but the camera doesn't follow it.  The camera just sits at its initial position.  Heres the code:

horse.translate(moveVec);
horse.translateMesh();
SimpleVector horsePos = horse.getTransformedCenter();
horsePos.add(horse.getTranslation());
cam.setPosition(horsePos);
//want cam up to match horse up
SimpleVector up = horse.getYAxis();
up.y *= -1;
//horse is facing along x axis
SimpleVector dir = horse.getXAxis();
cam.setOrientation(dir, up);
//move back according to zoom input
cam.moveCamera(Camera.CAMERA_MOVEOUT, currentZoom);
//move up, but move up less if looking up
cam.moveCamera(Camera.CAMERA_MOVEUP, (currentZoom - lookUp) * .5f);
SimpleVector look = horse.getXAxis();
//look at position ahead of horse
look.scalarMul(currentZoom * 2f);
//look at position above horse if user input indicated to do so
look.y -= lookUp;
cam.lookAt(look);
horse.clearTranslation();


I'm assuming I'm doing the translation wrong in some way, but have no idea how, or what else it could be.
Thanks in advance
/lance