[resolving]distortion between two differnet model(landscape & po

Started by cefengxu, November 18, 2015, 10:23:49 AM

Previous topic - Next topic

cefengxu

hi master:

i have import the obj via JPCT basic on ARTookit, however, the model has a peculiar distortion between two differnet model(landscape & portrait) , such like the cut picture shown.

i have refered the artical " Integrating JPCT-AE with Vuforia - Additional corrections " ,
but it seem not a reason to cause such distortion.

do you have another idea ?

Thanks..

EgonOlsen

The "distortion" is caused by the fov (field of view) settings. Obviously, they are not correct in landscape mode in your case. The wiki article should actually cover that issue IIRC.

cefengxu

Actually, I have calculated the FOV Value through the Camera Params and set via : 
  cam.setFOV(xxx.f);   
  cam.setYFOV(xxx.f);

so, the model can be move and stand at right position( on the middle of mark ) when i move the camera.

EgonOlsen

The question is not whether you set fov or not. You obviously do. The question is to which values. The wiki example actually covers the landscape case and calculated different values for it. Are you doing that as well?
By default, jPCT-AE takes the x-fov and calculates an y-fov that provides an 1-to-1-scale, so that a sphere remains a sphere. If you set y-fov directly, you have to calculate it in a way that this is given as well. If you don't, your objects will look distorted.

cefengxu

i have checked again my code and the FOV Value have been set according the wiki example definitely :

where:
   preview_size_x = 640; ( my preview size )
   preview_size_y = 480; ( my preview size )
   camera_params_focalLength_x = 678.29;
   camera_params_focalLength_y = 637.77;
so:
   float fovRadians  = 2 * atan(0.5f * 640/ 678.29) = 0.882627f ;
   float fovyRadians = 2 * atan(0.5f * 480/ 637.77) = 0.719839f ;

and then,  i added the code here ( i think that is correctly):

public void onSurfaceChanged(GL10 unused, int width, int height) {
    ........
     cameraController.setFOV(0.882627f);
     cameraController.setYFOV(0.719839f);
    .......
}

or here

public void onDrawFrame(GL10 unused) {
    ........
     cameraController.setFOV(0.882627f);
     cameraController.setYFOV(0.719839f);
    ........
}


EgonOlsen

The wiki contains an example where it deals with the difference in landscape/portrait mode. I don't see that in your code...