3Ds loading Bug???

Started by Schwapp, August 14, 2011, 02:07:40 PM

Previous topic - Next topic

Schwapp

Hello!
I'm an absolutly beginner in jPCT and have a problem:
I'm trying to load a 3D Model which is exportet to .3ds from Blender.
So i load that model with a method from a tutorial:
private Object3D loadModel(String filename, float scale) {
Object3D[] model = Loader.load3DS(filename, scale);
Object3D o3d = new Object3D(0);
Object3D temp = null;
for (int i = 0; i < model.length; i++) {
temp = model[i];
temp.setCenter(SimpleVector.ORIGIN);
temp.rotateX((float) (-.5 * Math.PI));
temp.rotateMesh();
temp.setRotationMatrix(new Matrix());
o3d = Object3D.mergeObjects(o3d, temp);
o3d.build();
}
return o3d;
}

I downloaded the model there: http://e2-productions.com/repository/modules/PDdownloads/singlefile.php?cid=2&lid=161
But some parts of the model dissapear, depending on the camera-position.
An arm, the head or the whole body...
I never see the complete Figure, only peaces of it...

Any ideas?

Edit:
I see now, the figure just dissapears like every other Model, when the camera moves too far away.
But this model begins earlier to dissapear than the others do.

EgonOlsen

This is neither a  bug nor has it anything to do with the loader for 3ds as a file format. If you move farer away, the far clipping plane kicks in. You can set the far clipping plane to another value but either tweaking the config (http://www.jpct.net/doc/com/threed/jpct/Config.html#farPlane) or in your instance of World (http://www.jpct.net/doc/com/threed/jpct/World.html#setClippingPlanes(float, float)).

Another reason for disappearing polygon might be that you've reached the configured maximum of polygons. You can adjust this in Config: http://www.jpct.net/doc/com/threed/jpct/Config.html#maxPolysVisible

Schwapp

Thanks for help,

I tried

Config.farPlane=3000;
,
Config.maxPolysVisible = 10000;
and
world.setClippingPlanes(1, 2000);
but the model still reduces itselv... i tried an other model, same effect.
The thing is, i have 2 Object3Ds, one is the terrain and one the character.
And only the caracter model reduces itselv, the terrain doesnt.
I just don't understand it

EgonOlsen

Setting the far plane and calling world.setClippingPlane is redundant. Your 2000 in the latter overrides the 3000 in the former. Also make sure to set the maxPolysVisible BEFORE creating the World-instance. If that doesn't help, i would like to see a screen shot to see about what exactly we are talking here.

Schwapp

Setting the maxPolysVisible before creating the world solved the problem!
Thanks a lot!!!

EgonOlsen

BTW: Are you using the hard- or the software renderer?

Schwapp

#6
Eer, i took FrameBuffer.SAMPLINGMODE_HARDWARE_ONLY)
EDIT:
As i can see in the Version History of jPCT exists since 2004 (even longer i guess), why isn't it as well-known as the JMonkeyEngine or Ardor3D?

EgonOlsen

Quote
As i can see in the Version History of jPCT exists since 2004 (even longer i guess), why isn't it as well-known as the JMonkeyEngine or Ardor3D?
Not sure. Maybe because it's free but not open source, maybe because i favour coding over creating press release like blog entries, maybe because the website kinda sucks or maybe because the website has no image showing a virtual box of the product? However, the Android version is another story. It does pretty well, i even saw a tutorial on it in a german magazine for mobile devices.