How can I set vertical AND horizontal FoV independent from each other with a cine camera in C++?

I need this for implementing a sensor with abitrary vertical/horizontal FOV.

I tried to set Filmback.SensorWidth/Filmback.SensorHeight and the values are shown in the Editor, but only width is applied correctly in the visual output. If I try to set the second variable over Filmback.SensorAspectRatio that is overwritten.

1 Like

If I use
PlayerCamera->SetConstraintAspectRatio(false);
both the values will be changed. But what I want would be an image filling the whole choosen window size, which is distorted depending on the vertical/horizontal field of view.

Maybe this post can help:

https://forums.unrealengine.com/t/manipulate-horizontal-fov-without-affecting-vertical-fov/621443

But what I want would be an image filling the whole choosen window size, which is distorted depending on the vertical/horizontal field of view.

Do you want screen size to resize your image?

Anyway, I had problems with the Camera’s FoV, that how I set my Camera:

SceneCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("SceneCamera"));
SceneCamera->bOverrideAspectRatioAxisConstraint = true;
SceneCamera->AspectRatioAxisConstraint = AspectRatio_MajorAxisFOV; // Important
SceneCamera->SetupAttachment(SceneSpringArm, USpringArmComponent::SocketName);

To get the image to stretch to fill the window, no matter what the window dimensions are, you will have to use a render target to render from the camera, and then map the rendered part of that render target as a texture onto the window using a simple GUI widget bound to the target.

Found a solution that worked:

You can overwrite CalcSceneView to get non-square pixels.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.