www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: penprakash on June 25, 2013, 03:59:37 pm

Title: I have an issue in OBJ model scaling
Post by: penprakash 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?
Title: Re: I have an issue in OBJ model scaling
Post by: EgonOlsen 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() (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();
Title: Re: I have an issue in OBJ model scaling
Post by: penprakash 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.
Title: Re: I have an issue in OBJ model scaling
Post by: EgonOlsen 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).