After a bit of investigation, the way to fix this would be to modify MergeMaskIntoAlpha to pass in the actual resolution scale and the requested size, and only mask the overlapping pixels. Currently MergeMaskIntoAlpha only compares overall total pixels to check for masking. Not clear on why it works proportionally to the size requested currently.

[Image Removed]
[Image Removed]

Steps to Reproduce

Download licensee repro from here - [Link Removed]

Open in editor and enter PIE

A screenshot will be taken but an error message pops up:
[2021.09.06-17.05.25:985][272]LogOutputDevice: Error: Ensure condition failed: bMaskMatches [Link Removed] [Line: 137]

If you then go to BP_Highres and change the resolution request to 3840*2160, or 1920*1080, the screenshot works as expected (although there still appears to be masking of the background, but this may be desired behaviour?)

>	[Inline Frame] UE4Editor-Engine.dll!FHighResScreenshotConfig::MergeMaskIntoAlpha::__l2::<lambda_7c881376fad684749fd73790beca9015>::operator()() Line 137	C++
 	UE4Editor-Engine.dll!FHighResScreenshotConfig::MergeMaskIntoAlpha(TArray<FColor,TSizedDefaultAllocator<32>> & InBitmap) Line 137	C++
 	UE4Editor-Engine.dll!UGameViewportClient::ProcessScreenShots(FViewport * InViewport) Line 1895	C++
 	UE4Editor-Engine.dll!FViewport::HighResScreenshot() Line 1304	C++
 	UE4Editor-Engine.dll!FViewport::Draw(bool bShouldPresent) Line 1519	C++
 	UE4Editor-UnrealEd.dll!UEditorEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 1945	C++
 	UE4Editor-UnrealEd.dll!UUnrealEdEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 426	C++
 	UE4Editor.exe!FEngineLoop::Tick() Line 4922	C++
 	[Inline Frame] UE4Editor.exe!EngineTick() Line 62	C++
 	UE4Editor.exe!GuardedMain(const wchar_t * CmdLine) Line 178	C++
 	UE4Editor.exe!LaunchWindowsStartup(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow, const wchar_t * CmdLine) Line 262	C++
 	UE4Editor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * pCmdLine, int nCmdShow) Line 320	C++
 	[Inline Frame] UE4Editor.exe!invoke_main() Line 102	C++
 	UE4Editor.exe!__scrt_common_main_seh() Line 288	C++
 	kernel32.dll!BaseThreadInitThunk()	Unknown
 	ntdll.dll!RtlUserThreadStart()	Unknown

Have Comments or More Details?

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

Login to Vote

ComponentUE - Rendering Architecture - RHI
Affects Versions4.25plus4.26.24.27
Target Fix4.27.2
Fix Commit17905470
Release Commit17905470
CreatedSep 6, 2021
ResolvedOct 25, 2021
UpdatedDec 1, 2022