Perspective projection matrices not correct?

Branch: Both builds from source and prebuilt

Build version: Any I have tried, but for example 4.1.0-2053896

Repro Steps

  1. In an empty scene, place a cube of size (100, 100, 100) at (0, 0, 0).
  2. Place a camera at (100, 0, 0), pointing towards (0, 0, 0).
  3. Make sure camera is perspective and set FOV to 90 degrees.
  4. 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.

Hi Panda,

Sorry for the delayed response. Thank you for reporting this issue to us. I have notified our developers to have this looked into further.

Hi!

I was changed projection matrix value ( Red box )
by using 'View->ViewMatrices.ProjMatrix’.
Then occured blurry effect.

I have to use changed value, but I want to remove blurry effect.

How can i do that?

Hi 황용수,

Your issue looks like it may actually be different from the original post. Would you be able to create a new post where we would be able to focus on your issue specifically?

Ok.
I created new post.

Title is “How do i set perspective matrix to another value?”

Thanks…