Download

[SHELVED] Material Layering Feedback for 4.19

Fo you mind sharing thoughts on how they affect performance too?

having the ability to bake the materials into a VT would be killer!!
another question: i’m basically using the same macro variation texture on my big surfaces for each material layer. having the same texture sampler in each material layer is quite costly, i assume? is there a way to enable shared texture samplers across layers?

With 4.24 out for a while now, did anyone get a chance to sink their teeth into finding out whether there’s actually anything new with that feature, or did it just get un-shelved (something that this thread still doesn’t reflect)?

Release Notes say:

It got upgraded from experimental to beta, so that’s something.

i want to use this workflow to create a material library - so it would be great to just be able to apply a material layer as a material on a mesh, so i m free to use it in an layer stack or just put it on a material slot.
right now i have to create a material with a layerstack in it and apply one material layer to the background, if i want to apply a Layer directly to a mesh and then, if i want to make changes to the material, of course change the Material Layer and not the material - really confusing. Also with this workflow, the created material doesnt update somehow when editing the material layer instance, until ive reassigned the material layer to the background, which is a big issue.
a nother issue ive encountered: we are now able to have multiple shading models on one material, saving a lot of draw calls. when i’m trying to make a layer using cloth shading model, i cant set the material attributes, because the pins “fuzz color” and “Cloth” are missing in the material attributes.

I figured I should drop a little note in this thread as an update since I haven’t found a more recent one concerning this feature. I don’t think it is something that has had much active use.

Our project has been working with the Material Layering feature since its introduction as we found it to have a lot of potential and we plan to make heavy re-use of materials to help manage texture budgets. Up until 4.24 this feature was in Experimental and had a few issues, the most notable being that the state of the Material Instances which had a layer stack would often not properly reflect its state in the world, and also you would have to sometimes force a change to get it to recompile properly.

We actually updated to 4.25 because we saw the feature was made Beta, and there was a few vague notes about them addressing the state of materials updating properly.

Sadly with 4.25.1 this functionality is for us pretty much broken. Our old MI’s that used the Material Layer Instances are broken, and this is understandable we were working with experimental code and they likely made enough changes which are not backward compatible, I was planning to rebuild the Material Layer master anyways to be much cleaner so this didn’t phase me or affect our plans.

There are a few other more serious problems we have found that makes this feature broken for us.

One is that MLI’s either created from the Master/Parent or as a Sibling which includes parameter changes like new Texture maps, Scalar Values, Booleans, that are not default will not propagate into the MI Stack when they are added the values revert to the defaults. There is another post which notes this as well.

Another is that any Material Layer master that is even a little complex is susceptible to crashing. Creating a Child of the Parent can make the parent when it is added to the layer stack crash the editor, and potentially a child in the stack which is edited to enable a parameter, or material function in the master can cause corruption of the Material Instance in which it is used and any attempts to open the MI will crash the editor forcing it to be deleted and started over.

So as it stands currently the Material Layer Stack feature is pretty unusable until these issues are resolved. The experimental version was much more stable, I’m not sure why this was put into beta in this state, but I am hopefully they are once again working on this feature and there will be updates to make it functional again. Someone on our team is looking into trying to fix these problems so if there is some resolution I will be certain to update this thread. Otherwise if he fails I will likely submit some bugs and provide an example project to help.

If anyone has been able to effectively use this feature without issues in 4.25.1 I’d love to hear about how you have done it.
Thanks,

I can confirm, while I was trying to create a basic setup based on this system, the editor crashed a lot, so sadly I had to disable it again and revert to using traditional workflow…

just started learning about this feature and it looks amazing in terms of workflow improvements alone for layering materials. Is it possible to have dynamic layers yet or control things with blueprints? Great to see this hit beta and hopefully gain some traction to release soon.

IDK about dynamic layers, but the 4.25 docs say you can control parameters from Blueprints. But it’s so unstable, it’s not worth it yet.

If you have more than 16 texture samples in master material and layers in stack with theese settings: Shared: Texture Objects, editor crashes - there is no window with log, etc. When you are making master material and layers and you want to use more than 16 texture samples, you need set the Texture sample’s Source for texture sample to Shared: wrap. Its a bug (it should not crash).

For example:
If you have master material with 4 texture samples and then you assign three new layer where each have 4 new texture samples.
Its 4 + 4 + 4 + 4 = 16
Thats ok.
But then, if you put new layer to the stack with new texture objets, it will crash (you need to fix the settings first to prevent this from happening).

Texture / sampler source
image_46528.jpg](https://docs.unrealengine.com/en-US/Engine/Rendering/Materials/ExpressionReference/Textures/index.html)

After that was very stable for me and its working very well (tested on 4.22).

Nice! Thanks for sharing!

Basically, it was just a bug and it worked for me, but its not a real solution if already worked wrong. If it crashed several times and it didn’t work properly (layers were missing, materials looked weird), i had to delete Unreal cache - if i remembered correctly, i think it was somewhere in
Users\YourProfileName\AppData\Local\UnrealEngine\Common
or something like that. I don’t remember exactly. But it was definitely in windows Users folder. Then all shaders will be recompiled and it worked normally again.

It appears that the material fixes in 4.25.2 have addressed most of the crashing, and parameters not properly propagating their values on addition to the stack. So we are back to using this feature in our project again. Thanks for the fixes Epic team!

Do you mean it feels stable? Really?? If so, that’s amazing news! I’m super excited!

hey did you ever find a way to use Material Layers together with Landscape Layers? I tried setting it up like on your screenshots and while the landscape layers do show up in the landscape tool, painting with them has no effect (you only ever see the Background material layer in the terrain)

also,

@Chris.Bunner now that we’ve actually reached the first release in 4.25 (marked as Beta feature now), could you please provide a status of Material Layering + Landscape usage?

Yes I’ve not had any major issues so far with it, the only notable ones that I can think of is that a stack does not appear to always respect changes in the preview window, there have been a few occurrences where I was making a change in the master material and after recompiling there and then going back to the Layer stack Material Layer Instance based off it the changes did seem to force a full recompile of the shader properly seeming to prefer to hold onto the old value/states. But generally if I feel something strange is occurring I will unload the MLI from the stack and re-add/rebuild it and this seems to resolve the issue, also it only appears to happen in the preview window of an MI so another approach I’ve taken is to drop an item in the world which has the MI on it and update the values in the stack seem to be properly reflected on the object in world view.

The only other minor issue I’ve noticed is the thumbnail will often not reflect the current state of an MLI usually just looking like the default setup from the Master.

Other then that nothing major, like crashing the editor on replacing values or textures in samplers from the stack.

I guess I can soon answer my own question since Material Layers in 4.26 are considered production-ready. will report back once I try the 4.26 p1

alright, sadly Material Layers in 4.26 (preview1) do not include any further compatibility with Landscape. Every combination I tried to make a MaterialLayerBlend asset read or use Landscape layer nodes produces no results :frowning:

I don’t think Material Layering was ever intended to be used with landscapes, so they likely just closed off that point of confusion.

if you see some posts above the comment from @Chris.Bunner states “landscape compatibility isn’t something that’s been directly targeted for this preview version but is something we’ll aim to address for the first release”. this tells me it was actually a wanted thing from the development side, and really the usage of Material Layers seems such a good use case on Landscapes that it was only natural to hope for the feature

So if it’s production ready in 4.26, is it generally stable and working now? What downsides are there to using the new system? Does it allow runtime parameter changes like MID? What’s the performance like?

Just trying to get an idea of the state of things, since I haven’t been following this feature since its initial removal.