Author Topic: [resolving]distortion between two differnet model(landscape & po  (Read 629 times)

Offline cefengxu

  • int
  • **
  • Posts: 65
    • View Profile
[resolving]distortion between two differnet model(landscape & po
« on: November 18, 2015, 10:23:49 am »
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..

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: [resolving]distortion between two differnet model(landscape & po
« Reply #1 on: November 18, 2015, 02:39:39 pm »
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.

Offline cefengxu

  • int
  • **
  • Posts: 65
    • View Profile
Re: [resolving]distortion between two differnet model(landscape & po
« Reply #2 on: November 18, 2015, 04:34:20 pm »
Actually, I have calculated the FOV Value through the Camera Params and set via : 
Code: [Select]
  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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: [resolving]distortion between two differnet model(landscape & po
« Reply #3 on: November 19, 2015, 06:05:58 pm »
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.

Offline cefengxu

  • int
  • **
  • Posts: 65
    • View Profile
Re: [resolving]distortion between two differnet model(landscape & po
« Reply #4 on: November 21, 2015, 04:49:54 am »
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);
    ........
}


Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: [resolving]distortion between two differnet model(landscape & po
« Reply #5 on: November 21, 2015, 09:58:04 am »
The wiki contains an example where it deals with the difference in landscape/portrait mode. I don't see that in your code...