PDK Issue with Setting camera FOV

srgriffiths
Posts: 36
Joined: Tue Aug 04, 2015 7:51 pm

PDK Issue with Setting camera FOV

Postby srgriffiths » Fri Nov 16, 2018 9:03 pm

For some reason when I try set the camera fov it doesn't get set to the desired values. Are there FOV restrictions? It is strange that the hfov get sets to the desired vfov. Any thoughts?


hfov_desired = 65.841419512000968;
vfov_desired = 40.021835855776025;

pCamera->SetFov(hfov_desired, vfov_desired); //For some reason the camera doesn't get set to what I tell it to.

pCamera->GetFov(hfov_actual, vfov_actual);

hfov_actual = 40.0218353
vfov_actual = 23.1542664

User avatar
Rob McCarthy
Lockheed Martin
Posts: 2294
Joined: Wed Aug 24, 2011 1:37 pm

Re: PDK Issue with Setting camera FOV

Postby Rob McCarthy » Tue Dec 04, 2018 1:18 pm

Hello,

Can you post more details or perhaps a code sample of how you are making this call?

Regards,
Rob McCarthy
Rob McCarthy
Prepar3D® Core Lead

User avatar
Beau Hollis
Lockheed Martin
Posts: 1887
Joined: Wed Oct 06, 2010 3:25 pm

Re: PDK Issue with Setting camera FOV

Postby Beau Hollis » Tue Dec 04, 2018 2:29 pm

Because default cameras use zoom rather than FOV to set up their projection, the GetFOV() function does not simply pull the fov values from data members. It extracts the fov from the projection matrix. The projection matrix is build from FOV, SideAngles, or Zoom/Aspect during the camera update. If you set the fov in the OnPreCameraUpdate() and get it in OnPostCameraUpdate(), the values should match unless another plugin is setting the FOV or SideAngles. If you're in VR for example, our VR system sets SideAngles via the PDK. Can you be more specific about the camera you are modifying? If it's a custom camera, SimdDirector camera, Observer, or part of a view group, there could be other systems trying to modify the FOV.

Thanks
Beau Hollis
Prepar3D Software Architect

srgriffiths
Posts: 36
Joined: Tue Aug 04, 2015 7:51 pm

Re: PDK Issue with Setting camera FOV

Postby srgriffiths » Thu Dec 13, 2018 5:42 pm

OnPreCameraUpdate, SetFov
hfov 33.7883224 float
vfov 19.3894024 float

OnPostCameraUpdate, GetFov
tmp_hfov 19.3894043 float
tmp_vfov 10.7491159 float

Isn't it odd that the hfov is what I set the vfov to be?

User avatar
Beau Hollis
Lockheed Martin
Posts: 1887
Joined: Wed Oct 06, 2010 3:25 pm

Re: PDK Issue with Setting camera FOV

Postby Beau Hollis » Sat Dec 15, 2018 12:18 am

Do you get the same result with wide-view-aspect checked or unchecked in UI?
Beau Hollis
Prepar3D Software Architect


Return to “Software Development Kit (SDK) Questions”

Who is online

Users browsing this forum: Bing [Bot] and 4 guests