Hi,
I am using Prepar3D as IG. Prepar3D generates the images according to the CIGI packet which I send. However, the zoom function doesn't work when the CIGI host responds to SOF.
Here is what I do
Step1: Start Prepar3D, start IG(Networks->CIGI->Start IG). At this point, the P3D is sending SOF packets and the CIGI host is not started yet. On the keyboard, I press '-' or '=', Zoom in/out works fine.
Step2: Start CIGI host. Now the CIGI host will respond to SOF sent by P3D. The images are generated accordingly. But, when I press '-' or '=', the zoom in/out doesn't work now. I have tried calling simconnect APIs like CameraZoomIn() and CameraZoomOut() from the host software, the zoom levels didn't change.
My requirement involves the CIGI host to control zoom levels on IG. Kindly, help me to figure this out.
Zoom in/out doesn't work when Prepar3D run as IG(Image Generator)
-
- Posts: 10
- Joined: Sat May 02, 2020 6:32 am
-
- Lockheed Martin
- Posts: 1207
- Joined: Tue Sep 25, 2012 2:34 pm
Re: Zoom in/out doesn't work when Prepar3D run as IG(Image Generator)
Hi sunilhalvi,
Which version of CIGI are you targeting? Does the host support View Definition packets? If so, does the View Definition packets have the near, far, left, right, top, and bottom FOV flags enabled? There is a single bit for each parameter.
Regards,
Clifton
Which version of CIGI are you targeting? Does the host support View Definition packets? If so, does the View Definition packets have the near, far, left, right, top, and bottom FOV flags enabled? There is a single bit for each parameter.
Regards,
Clifton
Clifton Crane
Prepar3D® Software Engineer Sr.
Prepar3D® Software Engineer Sr.
-
- Posts: 10
- Joined: Sat May 02, 2020 6:32 am
Re: Zoom in/out doesn't work when Prepar3D run as IG(Image Generator)
Hi Clifton Crane,
Thank you for your help. Enabling all FOV flags did help now we can zoom in/out. We need one more help here. Enabling FOV made us obligated to provide appropriate FOV values in the view definition packet. could you please provide us with the default FOV values?
Thank you for your help. Enabling all FOV flags did help now we can zoom in/out. We need one more help here. Enabling FOV made us obligated to provide appropriate FOV values in the view definition packet. could you please provide us with the default FOV values?
-
- Lockheed Martin
- Posts: 1207
- Joined: Tue Sep 25, 2012 2:34 pm
Re: Zoom in/out doesn't work when Prepar3D run as IG(Image Generator)
Hi sunilhalvi,
Your FOV values will vary based on the IG's aspect ratio.
You could start with a desired horizontal field of view and calculate the vertical field of view based on the IG's aspect ratio. An example 16:9 ratio in side angles would be -60 left, 60 right, -33 bottom, and 33 top.
Regards,
Clifton
Your FOV values will vary based on the IG's aspect ratio.
You could start with a desired horizontal field of view and calculate the vertical field of view based on the IG's aspect ratio. An example 16:9 ratio in side angles would be -60 left, 60 right, -33 bottom, and 33 top.
Regards,
Clifton
Clifton Crane
Prepar3D® Software Engineer Sr.
Prepar3D® Software Engineer Sr.
- Beau Hollis
- Lockheed Martin
- Posts: 2452
- Joined: Wed Oct 06, 2010 3:25 pm
Re: Zoom in/out doesn't work when Prepar3D run as IG(Image Generator)
I believe if a view has no zoom or other overrides set, the default would be about 33 degree vertical fov. Horizontal would be based on aspect ratio as Cliff already noted. So assuming 16:9 default side angles would be something like -30 left, 30 right, -16.5 bottom, and 16.5 top.
Since your required to handle zoom in the host, you'll need to set up your own math for converting from zoom to fov but you can find many resources online for this.
We use a fairly standard perspective projection similar to the one described here:
https://docs.microsoft.com/en-us/window ... -transform
The important bit there being:
You can replace the 1 in that equation with a zoom scale factor and work your way back to calculate fov from zoom.
Since your required to handle zoom in the host, you'll need to set up your own math for converting from zoom to fov but you can find many resources online for this.
We use a fairly standard perspective projection similar to the one described here:
https://docs.microsoft.com/en-us/window ... -transform
The important bit there being:
Code: Select all
w = (float)1/tan(fov_horiz*0.5); // 1/tan(x) == cot(x)
Beau Hollis
Prepar3D Software Architect
Prepar3D Software Architect