UMG as Mateiral?

For those who stumble upon similar scenarios:

short version:

I did two things (It was pretty easy)

  1. Replaced the internal render target material with my own
  2. applied that material to the mesh of my own choice

Long version:

The normal WidgetComponent internally directly renders to a RenderTarget and uses this render target with a material (as texture parameter) then applies this material to a plane mesh (It makes the plane mesh in real time).

The material it uses for render target was hard-coded and are /Engine/EngineMaterials/Widget3DPassThrough_xxxx (see UnrealEngine/Engine/Source/Runtime/UMG/Private/Components/WidgetComponent.cpp line 458 and onwards)

Those materials were made unlit meaning the light would have no effect on them nor I could mix ui with other cool material effects. Hence I made my own materials for render targets

So for this proof of concept I made few custom C++ (BP callable) functions that allows me to set the material with which the FWidgetRenderer’s render target is used and another function to grab the dynamic material instance of it back from the component.

On start I set the material of my choice with a render target parameter and then grabbed its dynamic instance from the widget component and applied it to the book.

Ue4 is very flexible , you can extend it to a full fledged custom component and use UV mapping to determine the hit location for the click and other interaction.

Hope this helps people