[Unreal4] Get virtual camera image in unreal engine and import it into UI(UMG) for UI camera real-time display

Objectives: Real-time acquisition of virtual camera lens images in Unreal Engine and display in GUI, similar to left and right rearview mirrors display images in racing games, or real-time acquisition of camera image information display in GUI interface, or real-time capture of camera images in VR.

Test version: 4.26 (universal for most versions)

Knowledge needed:

1. SceneCaptureComponent2D

2. CanvasRender target material (CanvasRenderTarget2D)

3. Image module in UI

Function implementation approach: to obtain a virtual camera image real time display and import the UI, you need a real-time capture images and convert them into dynamic material, real-time images were obtained through the scene capture the component 2d flow, converts the render target material to ordinary material, finally to create the image in the GUI, and give the image for the module material.

【unreal 4】 虚幻引擎中如何让UI(UMG)在窗口实时显示

首先创建好UI文件 打开关卡蓝图 添加如上图节点连接:【事件开始运行】(event begainplay)——【创建控件】(create widget)——【添加到视口】(add to viewport) 在创建控件中选择第一步创建好的UI 运行程序 看看UI是不是已经在窗口上显示了。 注意【创建X……

【unreal engine 虚幻引擎 4】在ACTOR蓝图中给UMG中的按钮添加事件触发

上一篇文章我们说了如何在UMG蓝图中直接绑定事件,但是其实按钮或者勾选框之类的交互控件,有多种方式可以实现其交互触发,比如我们这次讲一下如何在ACTOR蓝图中给按钮什么的绑定事件。首先讲一下为什么要把UMG放在ACTOR蓝图里:

主要是因为便于移动,尤其是像VR交互界面中,我们的交互菜单并不是铺满整个屏幕的,而是经常出现在各种空间位置的,这时候将UMG丢到ACTOR里面,然后就可以向移动蓝图一样,随便移动交互屏幕的位置了!
总之这个功能可以帮助大家在三维空间场景中,在任意位置添加需要交互的UMG界面。

那么如何在actor蓝图里面添加UMG交互界面呢?