Author Topic: 3Ds loading Bug???  (Read 1547 times)

Offline Schwapp

  • byte
  • *
  • Posts: 11
    • View Profile
3Ds loading Bug???
« 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
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.
« Last Edit: August 14, 2011, 02:18:54 pm by Schwapp »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11747
    • View Profile
    • http://www.jpct.net
Re: 3Ds loading Bug???
« Reply #1 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) 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

Offline Schwapp

  • byte
  • *
  • Posts: 11
    • View Profile
Re: 3Ds loading Bug???
« Reply #2 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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11747
    • View Profile
    • http://www.jpct.net
Re: 3Ds loading Bug???
« Reply #3 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.

Offline Schwapp

  • byte
  • *
  • Posts: 11
    • View Profile
Re: 3Ds loading Bug???
« Reply #4 on: August 14, 2011, 10:17:23 pm »
Setting the maxPolysVisible before creating the world solved the problem!
Thanks a lot!!!

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11747
    • View Profile
    • http://www.jpct.net
Re: 3Ds loading Bug???
« Reply #5 on: August 14, 2011, 10:19:34 pm »
BTW: Are you using the hard- or the software renderer?

Offline Schwapp

  • byte
  • *
  • Posts: 11
    • View Profile
Re: 3Ds loading Bug???
« Reply #6 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?
« Last Edit: August 14, 2011, 10:41:32 pm by Schwapp »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11747
    • View Profile
    • http://www.jpct.net
Re: 3Ds loading Bug???
« Reply #7 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.