www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: Schwapp on August 14, 2011, 02:07:40 pm

Title: 3Ds loading Bug???
Post by: Schwapp on August 14, 2011, 02:07:40 pm
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:
Code: [Select]
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 (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.
Title: Re: 3Ds loading Bug???
Post by: EgonOlsen on August 14, 2011, 08:00:36 pm
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 (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) (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 (http://www.jpct.net/doc/com/threed/jpct/Config.html#maxPolysVisible)
Title: Re: 3Ds loading Bug???
Post by: Schwapp on August 14, 2011, 09:34:11 pm
Thanks for help,

I tried
Code: [Select]
Config.farPlane=3000;,
Code: [Select]
Config.maxPolysVisible = 10000;and
Code: [Select]
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
Title: Re: 3Ds loading Bug???
Post by: EgonOlsen on August 14, 2011, 09:56:07 pm
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.
Title: Re: 3Ds loading Bug???
Post by: Schwapp on August 14, 2011, 10:17:23 pm
Setting the maxPolysVisible before creating the world solved the problem!
Thanks a lot!!!
Title: Re: 3Ds loading Bug???
Post by: EgonOlsen on August 14, 2011, 10:19:34 pm
BTW: Are you using the hard- or the software renderer?
Title: Re: 3Ds loading Bug???
Post by: Schwapp on August 14, 2011, 10:37:37 pm
Eer, i took
Code: [Select]
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?
Title: Re: 3Ds loading Bug???
Post by: EgonOlsen on August 16, 2011, 10:36:20 am
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.