PDK Issue with Setting camera FOV

SDK supports Prepar3D’s philosophy of an open development architecture and encourages third parties to bring new innovations with improved add-ons and training content.
Post Reply
srgriffiths
Posts: 36
Joined: Tue Aug 04, 2015 7:51 pm

PDK Issue with Setting camera FOV

Post by srgriffiths »

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: 3703
Joined: Wed Aug 24, 2011 1:37 pm

Re: PDK Issue with Setting camera FOV

Post by Rob McCarthy »

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: 2452
Joined: Wed Oct 06, 2010 3:25 pm

Re: PDK Issue with Setting camera FOV

Post by Beau Hollis »

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

Post by srgriffiths »

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: 2452
Joined: Wed Oct 06, 2010 3:25 pm

Re: PDK Issue with Setting camera FOV

Post by Beau Hollis »

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