The proportional scaling part would be the most complex part here. Someone with more experience in the material editor may be able to advise how to do that there, but in this example I’ve just scaled the mesh to match the ratio.
-
Create a new material, imageMaterial_Mat. Add a texture sample, right click it and convert it to a parameter. Name it ImageTexture. Plug that into BaseColor.
-
Create a new Blueprint class which will be the cube that the image will be applied. Add a static mesh component and call it PlaneMesh. Here I would recommend a plane, of known size that has square UVs. A regular plane from 3ds Max at 100cm x 100cm will work. This plane will be scaled to fit the texture, it will scale down on the shortest side, so you could have a second mesh to maintain the border effect.
UpdateImage is a custom event. Click it and add an input parameter of type Texture2D, name it Texture and promote that to a variable. Also promote the dynamic material instance returned by CreateDynamicMaterialInstance to a variable on BegingPlay.
- Create your widget blueprint. Mine is just a button, with this event:
Add a Texture2D variable. You can set that to be whatever you want, and when you click the button it will update the material on the plane.

