Author Topic: I have an issue in OBJ model scaling  (Read 2156 times)

Offline penprakash

  • byte
  • *
  • Posts: 26
    • View Profile
I have an issue in OBJ model scaling
« on: June 25, 2013, 03:59:37 pm »
Hi,

 I have integrated JPCT-AE with vuforia and showing dynamic 3d models, my issue is each model has its own scaling, when i load it with scale 1

Loader.loadOBJ(new FileInputStream(objFiles),
                  new FileInputStream(mtlFiles),1)[0];

each model displayed with own scale and some of them showing very little, how to i uniform the scale?

Should i scale the modelViewMatrix from vuforia?
« Last Edit: June 25, 2013, 04:07:40 pm by penprakash »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: I have an issue in OBJ model scaling
« Reply #1 on: June 25, 2013, 08:52:05 pm »
Should i scale the modelViewMatrix from vuforia?
It might be better to make sure that the models you import are almost equal in size. You can, for example, get their bounding box (http://www.jpct.net/jpct-ae/doc/com/threed/jpct/Mesh.html#getBoundingBox()) and scale them according to its size. You can make a scale permanent by doing something like

Code: [Select]
obj.setScale(xxx);
obj.rotateMesh();
obj.setScale(1);
obj.clearRotation();
obj.build();

Offline penprakash

  • byte
  • *
  • Posts: 26
    • View Profile
Re: I have an issue in OBJ model scaling
« Reply #2 on: June 26, 2013, 02:57:42 pm »
Can you please provide how to use bounding box to the object and how to find out min and max value from the screen.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: I have an issue in OBJ model scaling
« Reply #3 on: June 26, 2013, 09:40:20 pm »
Couldn't you just find the right scale for your meshes based on trial and error...? Or are you dealing with user selected models? Or maybe you can rescale them in your modeler? I don't see the need for any min/max on screen. If you have one model that fits nice, just get it's bounding box, note the min/max-values and calculate a scaling based on these values for other meshes, so that the bounding boxes match (height ignored).