Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

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?

Product Version: UE 4.11
more ▼

asked May 01 '16 at 02:12 AM in Rendering

avatar image

Commander Shepard
802 62 82 219

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

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 alt text

more ▼

answered May 02 '16 at 07:19 PM

avatar image

Commander Shepard
802 62 82 219

avatar image VictorBurgos May 02 '16 at 07:20 PM

That +1 !!!

avatar image TungstenX Aug 16 '16 at 03:00 AM

Hi,I am a newcomer to ue4 and c++,could you show me the function code in c++?

avatar image Nonlin Feb 26 '19 at 10:24 PM

Why would you prefer to do this over changing what mesh the WidgetComponent can render on? The way I understand it, you tweak the widgetcomponent to create a material for you to apply on whatever mesh you want but since it also has the ability to tell it what Mesh to render on couldn't you also tweak that instead preserving all the clicking logic potentially?

avatar image Magneto Apr 04 '19 at 04:39 PM

Could you give an example how to use umg on materials please i've been searching for a simple way to get the output of a widget to materials and so far this is the only thing i found but it's not clear? Thanks!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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.

more ▼

answered May 01 '16 at 02:22 AM

avatar image

2.4k 60 27 112

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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++.

more ▼

answered May 01 '16 at 02:55 AM

avatar image

9.6k 320 205 449

avatar image Commander Shepard May 02 '16 at 11:27 AM

ayy ! that's a good point , I think Changing the render target for umg itself is a better way, but it'll mess up the mouse input in some cases due to the curvature. gonna give this a try.

avatar image Commander Shepard May 02 '16 at 05:48 PM

alt text Got proof of concept working without extra render targets by extending UWidgetComponenet :)

avatar image ScottSpadea May 02 '16 at 06:56 PM

wow, could you explain how you did it? i haven't actually tried, but was it as simple as just replacing a static mesh asset?

avatar image Commander Shepard May 02 '16 at 07:20 PM

@ScottSpadea Answered

avatar image VictorBurgos May 02 '16 at 06:57 PM

Good job! Glad we were of help!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question