HDR开启后花屏

使用PIX等工具发现,是UI部分出现了问题,CompositeUIWithSceneHDRTexture这张图片在开启HDR后本应每次绘制都先clear变成纯黑,再往上重新画东西;但是在出现花屏的帧上,发现这些帧没有clear,因此使用了这些错误的数据,导致花屏问题

正确的帧:图中的DiscardResource执行了两次,一个是CompositeUIWithSceneHDRTexture,一个是SlateViewportCopyTexture

[Image Removed]

<br/>

[Image Removed]

<br/>

出现花屏的帧:DiscardResource只执行了一次,是后面的SlateViewportCopyTexture。CompositeUIWithSceneHDRTexture在之后直接使用了这个错误的数据,导致花屏的出现。

[Image Removed]

<br/>

查看了代码后(位置应该对应SlateRHIRenderer.cpp 约738行开始)发现代码确实是写了都会clear,但是与游戏中实际观察到的现象相悖。

请问有同学遇到过类似现象吗? 可能的原因是什么?我们该如何解决该问题?

重现步骤
在开启HDR后,发现在游戏进程中,出现了花屏的现象;在游戏过程中有时会出现花屏的问题

[Image Removed]

您好,

感谢您的咨询。

我们无法复现这个开启HDR后绘制UI出现花屏的问题。

您可以提供一个简单测试工程文件并附带上问题截图吗?

[Content removed] 。

Andrew: The problem can be reproduced in every project that uses Slate UI in HDR including the Valleys of the Ancient demo. It cannot be reproduced in the editor, only in standalone.

If you want to speed up your investigation, look at line 1592 of SlateRHIRenderingPolicy.cpp. It’s not handling the case when the output texture is not the elements texture and is thus doing a wrong discard.

您好,

感谢您分享解决方案。

如果上面的方案能解决这个问题的话,我们现在可以关闭这个工单吗?如果您后续对这个问题需要任何帮助,可以随时重新开启这个工单。

Thank you! We have already noticed this line.Compared with other normal scene, it seems that ElementsTexture hasn’t been Produced, which make BlurInputs.SDRCompositeUITexture to NULL.

Maybe it is because blur is the first element in our UI?

Most probably yes. There is a fix in ue5-main which always use ERenderTargetLoadAction::ELoad in this specific case. You can either integrate the fix, reproduce the same logic, or you can do it like I did and explicitly test if the output is the ElementsTexture or not. If it is then you can consume otherwise you have to do a ERenderTargetLoadAction::ELoad.

Sorry if I can’t write in Mandarin. I used translation to read the post and noticed it was an issue which I had a solution to :slight_smile:

可以关闭,不过我们的修改方式和上面那位建议的略有出入,是在ElementsTexture的HasBeenProduced()为false时调用了AddClearRenderTargetPass(),这样操作确实解决了问题,对ConsumeAction没有改动

Thank you for your advise! We try to ​call AddClearRenderTargetPass() when HasBeenProduced(Inputs.ElementsTexture) return false, and the artifact just disappear.