Author Topic: proper tutorial for model animation  (Read 3584 times)

Offline MrYogi

  • byte
  • *
  • Posts: 21
    • View Profile
proper tutorial for model animation
« on: June 20, 2012, 08:03:08 am »
hi all,
I gone through forum and wiki for finding how can I animate my models specially md2 with in build animation but finally got bit confused.
I used  model.animate() but no result. can anyone simply suggest how to use in build multiple animations of md2.
and another question ,my md2 models are not fully rendering some small portions are transparent ,what could be reason for that?
thanks in advance
« Last Edit: June 20, 2012, 08:10:30 am by MrYogi »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: proper tutorial for model animation
« Reply #1 on: June 20, 2012, 08:57:17 am »
"no result" is a bit vague...please be more specific or all i can say is "do stuff right" in response... ;)

About the rendering: Do you have a screen shot of this?

Offline MrYogi

  • byte
  • *
  • Posts: 21
    • View Profile
Re: proper tutorial for model animation
« Reply #2 on: June 20, 2012, 09:13:06 am »

hey no result means i'm talking about no animation
here is my code:
Code: [Select]
public void onSurfaceChanged(GL10 gl, int w, int h) {
if (fb != null) {
fb.dispose();
}
fb = new FrameBuffer(gl, w, h);
world = new World();
world.setAmbientLight(20, 20, 20);

sun = new Light(world);
sun.setIntensity(250, 250, 250);
Resources res = ImageTargets.getImageTarget().getResources();
TextureManager tm = TextureManager.getInstance();

Texture ogro1 = new Texture(res.openRawResource(R.drawable.ogrobase));
tm.addTexture("ogro", ogro1);
ogro = Loader.loadMD2(res.openRawResource(R.raw.ogro), 1f);
ogro.setTexture("ogro");
// ogro.rotateY(-20);
// ogro.rotateZ(110);
ogro.rotateX(90);
world.buildAllObjects();
world.addObject(ogro);
Camera cam = world.getCamera();
cam.moveCamera(Camera.CAMERA_MOVEOUT, 50);
cam.lookAt(ogro.getTransformedCenter());
SimpleVector sv = new SimpleVector();
sv.set(ogro.getTransformedCenter());
sv.x -= 300;
sv.z -= 0;
sun.setPosition(sv);
MemoryHelper.compact();
}
public void onDrawFrame(GL10 gl) {
ogro.animate(anim, 0);
if (anim>1) {
anim=0;
} else {
anim+=0.1f;
}
fb.clear();
world.renderScene(fb);
world.draw(fb);
fb.display();

if (System.currentTimeMillis() - time >= 1000) {
Logger.log(fps + "fps");
fps = 0;
time = System.currentTimeMillis();
}
fps++;
}
}
« Last Edit: June 20, 2012, 09:22:30 am by MrYogi »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: proper tutorial for model animation
« Reply #3 on: June 20, 2012, 09:27:49 am »
Looks ok at first glance. Can you post the log output?

Offline MrYogi

  • byte
  • *
  • Posts: 21
    • View Profile
Re: proper tutorial for model animation
« Reply #4 on: June 20, 2012, 10:35:47 am »
hey i can't guess where was  the problem but now it's animating,
i'm attaching screen shot,in which you can see that some portion are transparent,every model facing the same problem.

[attachment deleted by admin]

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: proper tutorial for model animation
« Reply #5 on: June 20, 2012, 11:08:24 am »
That's because the model textures contain black parts, which jPCT will default to zero alpha. This doesn't matter if you render into an opaque buffer, but in your case, it does. Solution should be simple: create the textures with "new Texture(..., true);"

Offline MrYogi

  • byte
  • *
  • Posts: 21
    • View Profile
Re: proper tutorial for model animation
« Reply #6 on: June 20, 2012, 11:16:55 am »
That's because the model textures contain black parts, which jPCT will default to zero alpha. This doesn't matter if you render into an opaque buffer, but in your case, it does. Solution should be simple: create the textures with "new Texture(..., true);"
ya that was the problem ,thanx a lot