I have an issue in OBJ model scaling

Started by penprakash, June 25, 2013, 03:59:37 PM

Previous topic - Next topic

penprakash

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?

EgonOlsen

Quote from: penprakash on June 25, 2013, 03:59:37 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


obj.setScale(xxx);
obj.rotateMesh();
obj.setScale(1);
obj.clearRotation();
obj.build();

penprakash

Can you please provide how to use bounding box to the object and how to find out min and max value from the screen.

EgonOlsen

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).