UMG as Mateiral?
How would one go about using a UMG widget as material that can be applied on a mesh surface?
For example if I want the menu list to be displayed on a page of a book (looks fancy) it should follow the curve of the page etc, so what would be the proper way to do this or is it possible using default engine features?
asked May 01 '16 at 02:12 AM in Rendering
For those who stumble upon similar scenarios:
I did two things (It was pretty easy)
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
Heh, what you're wanting is not 100% possible in engine at the moment. You can fake it though. Or you could try 3D widgets. 3D Widget Docs
The only other thing I can think of, is actually modeling the book/page and then texture it accordingly to how the player would see it, but fake it to "curve" around the page, so you still have it as a UMG button.
answered May 01 '16 at 02:22 AM
to get UMG on a texture applied to a mesh, you would have to spawn an actor with a 3D widget component, and render it with a SceneCaptureComponent, which will update a texture you can use in a material applied to your book.
i think it would be more efficient if 3D widgets allowed you to replace their plane mesh, but currently, you would need to add that functionality with c++.
answered May 01 '16 at 02:55 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here