Tutorial: Intuitive material building with the UI Material Lab - Part 1

An artist and beginner friendly approach to building 2D materials using the functions and examples provided in the UI Material Lab collection.
Part 1 gives you an introduction and shows you how to get and use the project. It also gives you some base knowledge of materials to ensure you can understand and use the material functions provided.

https://dev.epicgames.com/community/learning/tutorials/Wz8V/unreal-engine-intuitive-material-building-with-the-ui-material-lab-part-1

4 Likes

Looking forward to this stream on 27th!
@IreneZanon That link seems to be invalid. Will it be available only after the live stream begins?

1 Like

Hey @Raptcha911
yes, the content will be unlocked on the day of the stream :slight_smile:
Sorry for the confusion!

Any advice on how to keep a bevel composed from combining two sdf rects from misaligning when ratio or size of widget changes? Iā€™m trying to use the Box paint mode but still itā€™s being weird:

ps. Iā€™ve watched the stream, itā€™s really awesome project for someone that likes to build stuff in code.

Hey @laggyluk ! Thatā€™s an interesting problem.
If you expect your container to be always horizontal (width always bigger than height), you could set the stroke thickness to be relative to the size, and choose the vertical dimension for it. By doing this, it will always refer to the height to determine the stroke thickness, so even if the box width changes, the stroke remains the same.
Keep in mind that this will not work if the container becomes vertical (height bigger than width). If thatā€™s your need we can find a bespoke solution for it that will require you to slightly change (or make a duplicate) the SDF Box material function.
Hereā€™s how youā€™d set up the parameters for the first approach (having the stroke outline depend on vertical size):


box outline

Let me know if you need a solution for a container that could also be vertical!

2 Likes

Thanks for the answer, it fixes the thickness varying with widget size and for second problem being sdf box with slightly smaller size used as shadow bevel growing slower than the bigger box as size changes and going ā€˜out of syncā€™ Iā€™ve made a function that tries to fix it and it kind of works most of the time :wink: I suspect it happens because box size is calculated from the center and not from edges but Iā€™m bad at math and donā€™t really understand whatā€™s going on there haha

Thank you very much @IreneZanon for your presentation during the stream, I found it was a very good and clear introduction to UI Material Lab !

I am currently stuck though : I have made a kind of radial progress gauge which can be controlled through scalar parameters (percentage of the gauge, display options, etc.)
I made it a material instance, created a UI widget, and although I can access to the MaterialInstance scalar parameters in the BP (I can print values returned by ā€œGet Scalar Parameter Valueā€) when I set them, changes canā€™t be seen on screen.

Any idea of what I am doing wrong ?

Here is my widget BP :

looks like you create material instance but donā€™t actually apply that material to anything?

1 Like

oh, this is embarrassing :smiling_face:
Thank you very much for your reply, I see now where my confusion was : I thought that creating a DynamicMaterialInstance from my MaterialInstance was enough.
Now using a ā€œSet Brush from Materialā€ works perfectly fine. Thanks again !

1 Like

Hi @IreneZanon! Firstly, thanks for this resource, itā€™s been really useful in a bunch of ways and really given me a fresh take on constructing UI in Unreal in more efficient and optimal ways.

I have been doing some tests building out UI which will run on multiple platforms. When it comes to switch I really suffer from bad resolution issue when using the sdf shapes. We find they either look very aliased and crunched or too soft if we use something like smoothstep.

It feels like the issue we have is authoring something for very varied resolutions (playstation versus switch for example), the materials look great for a 4k display which I author for but nowhere near as clean / crisp for lower resolution screens. Is this something you have ever encountered or would have any tips for?

Again, thanks for the tutorial, any help much appreciated! :slight_smile:

Any chance the project on FAB gets updated to 5.5?