Branch: Both builds from source and prebuilt
Build version: Any I have tried, but for example 4.1.0-2053896
Repro Steps
- In an empty scene, place a cube of size (100, 100, 100) at (0, 0, 0).
- Place a camera at (100, 0, 0), pointing towards (0, 0, 0).
- Make sure camera is perspective and set FOV to 90 degrees.
- Run and check whether the camera sees the full height of the box, but no more. (Which should be the case with 90 degree vertical FOV)
Analysis
Based on this question I started digging deeper in the source code, specifically looking for the projection matrix. It seem to me that the matrices in ProjectionMatrix.h are based on a horizontal FOV, unlike what the tooltip for the FOV property says.
Specifically, looking at FReversedZPerspectiveMatrix(float HalfFOV, float Width, float Height, float MinZ) which seems to be used for the actual play camera component, given that the specified FOV is supposed to be vertical I would expect it to look like this:
FORCEINLINE FReversedZPerspectiveMatrix::FReversedZPerspectiveMatrix(float HalfFOV, float Width, float Height, float MinZ) :
FMatrix(
FPlane(Height / FMath::Tan(HalfFOV) / Width, 0.0f, 0.0f, 0.0f),
FPlane(0.0f, 1.0f / FMath::Tan(HalfFOV), 0.0f, 0.0f),
FPlane(0.0f, 0.0f, 0.0f, 1.0f),
FPlane(0.0f, 0.0f, MinZ, 0.0f))
{
}
After trying this change the vertical FOV does indeed seem to be what I set it to in the camera. I also suspect three of the other constructors need to be changed similarly.
Of course the safer and easier change would be to just change documentation and the tooltip for the FOV property to specify that it is the horizontal FOV, which it appears it currently is.