A licensee has reported that the ZoomFactor variable inside of the DrawPoint function is being calculated incorrectly. It currently is calculated using the lesser of the projection matrix's horizontal or vertical scale. Later in the function when the point is being drawn, horizontal values are used in either case. This causes points to grow in size when the viewport is taller than it is wide.

This is where the ZoomFactor is calculated

bool bIsPerspective = (ViewInfo->ViewMatrices.GetProjectionMatrix().M[3][3] < 1.0f) ? true : false;
	if( !bIsPerspective )
		const float ZoomFactor = FMath::Min<float>(View->ViewMatrices.GetProjectionMatrix().M[0][0], View->ViewMatrices.GetProjectionMatrix().M[1][1]);
		ScaledPointSize = ScaledPointSize / ZoomFactor;

This is where the point is drawn:

// Generate vertices for the point such that the post-transform point size is constant.
 const uint32 ViewportMajorAxis = ViewportSizeX;//FMath::Max(ViewportSizeX, ViewportSizeY);
 const FVector WorldPointX = CameraX * Point.Size / ViewportMajorAxis * TransformedPosition.W;
 const FVector WorldPointY = CameraY * -Point.Size / ViewportMajorAxis * TransformedPosition.W;

The licensee proposes that this can be fixed by changing the following line:

 const float ZoomFactor = FMath::Min<float>(View->ViewMatrices.ProjMatrix.M[0][0], View->ViewMatrices.ProjMatrix.M[1][1]); 


 const float ZoomFactor = View->ViewMatrices.ProjMatrix.M[0][0]; 

Regression?: No
This was present in 4.13 as well

Steps to Reproduce

Code issue - N/A

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-42157 in the post.

Login to Vote

ComponentUE - Graphics Features
Affects Versions4.
Target Fix5.5
CreatedFeb 20, 2017
ResolvedMay 27, 2021
UpdatedJan 18, 2024
View Jira Issue