www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: AGP on June 25, 2011, 11:28:36 pm

Title: AdditionalVisiblityList Problems
Post by: AGP on June 25, 2011, 11:28:36 pm
I'm getting WAY too many visibility lists created. I'm loading the OBJ model on the here copied loadModel method. It's a very simple 1k poly model, but I'm getting no animation whatsoever. The whole thing seems fairly straightforward, so what might I be doing wrong?
CONSOLE:
Object 'Hair_jPCT6' created using 395 polygons and 252 vertices
Additional visibility list (2) created with size: 4096
...
Additional visibility list (61) created with size: 4096

LOADING METHOD:
Code: [Select]
      private void loadModel() {
TextureManager.getInstance().addTexture("LindyModelBellybutton.png", new Texture("LindyModelBellybutton.png"));
TextureManager.getInstance().addTexture("Lindy_HighResHair.png", new Texture("Lindy_HighResHair.png"));
lal3d = Object3D.mergeAll(Loader.loadOBJ("Head.obj", "Head.mtl", 1f));
// lal3d.getMesh().compress();
Object3D openMouth = Object3D.mergeAll(Loader.loadOBJ("MouthOpen.obj", null, 1f));
Object3D blinks = Object3D.mergeAll(Loader.loadOBJ("Blink.obj", null, 1f));
lal3d.build();
openMouth.build();
blinks.build();
Animation animation = new Animation(6);
animation.createSubSequence("Talks");
animation.addKeyFrame(lal3d.getMesh().cloneMesh(false));
animation.addKeyFrame(openMouth.getMesh());
animation.addKeyFrame(lal3d.getMesh().cloneMesh(false));
animation.createSubSequence("Blinks");
animation.addKeyFrame(lal3d.getMesh().cloneMesh(false));
animation.addKeyFrame(blinks.getMesh());
animation.addKeyFrame(lal3d.getMesh().cloneMesh(false));
animation.setInterpolationMethod(Animation.LINEAR);
lal3d.setAnimationSequence(animation);
Object3D hair = Object3D.mergeAll(Loader.loadOBJ("Hair.obj", "Hair.mtl", 1f));
hair.build();
lal3d.addChild(hair);
lal3d.rotateAxis(lal3d.getXAxis(), (float)Math.toRadians(160));
world.addObject(lal3d);
world.addObject(hair);
      }

Afterwards, I attempt to play the animation with:
Code: [Select]
     if (keepTalking) {
lal3d.animate((currentFrame+=Time.deltaTime()), TALKS);
if (currentFrame >= 1.00f)
     currentFrame = 0.00f;
     }
     else if (blinking) {
lal3d.animate((currentFrame+=Time.deltaTime()), BLINKS);
if (currentFrame >= 1.00f)
     blinking = false;
     }
     if (!keepTalking && Math.random() > .9 && System.currentTimeMillis() > timeSinceBlinked+4000) {
blinking = true;
currentFrame = 0.00f;
     }
Title: Re: AdditionalVisiblityList Problems
Post by: EgonOlsen on June 25, 2011, 11:32:16 pm
That's usually the symptom of your render loop causing some exception that you just swallow. In that case, each iteration causes a new visibility list being created because the former one has never been rendered. See if you swallow any exception and...don't do that... ;)
Title: Re: AdditionalVisiblityList Problems
Post by: AGP on June 25, 2011, 11:35:08 pm
Not that I can tell. The entire loop consists of the animation bit and the following three lines:
Code: [Select]
     draw();
     paint(this.getGraphics());
     Thread.yield();

By the way, I'm only using the software renderer.
Title: Re: AdditionalVisiblityList Problems
Post by: EgonOlsen on June 25, 2011, 11:56:41 pm
If there's no exception, you are omitting the actual draw call. None of these methods in the code snippet is from jPCT, so i've no idea what draw() or paint() are actually doing.
Title: Re: AdditionalVisiblityList Problems
Post by: AGP on June 26, 2011, 12:29:05 am
OK, I solved the matter of the visibility lists by switching back to AWT components (I had a reason for going with Swing, but not anymore). But my animate() call (above) is not producing any animation. Any clue why (the models themselves are right and should work)?
Title: Re: AdditionalVisiblityList Problems
Post by: EgonOlsen on June 26, 2011, 12:32:15 am
What's Time.getDeltaTime() returning?