[SHELVED] Material Layering Feedback for 4.19

By the way, would be there any possibility in the future to make “set material attributes” as a parameter?
That would give extreme flexibility to reduce unneeded nodes in layer instances.
I’m talking about this one:

For example, if I would want to at some point disable one of the elements, like roughness or metallicness in one of the instances of the layer, but without touching the parent layer.
I would just un-tick a checkbox and the whole node wouldn’t have to pass through the blending process when I decide to disable it in a specific material instance.
Right now I’ve come up with switches in blend function, but it’s not the ideal solution since instructions are still growing with each layer.
I hope I explained myself…
Here is what i mean:

Why isn’t it possible to use material instance Constants or Dynamics as Layers? I have tons of Material Instance Constants wich I would like to tweak with each other. If that is not possible for any reason, than I would like any option to change Master Materials + their instances into Layers and Layer Instances, but the best would be what i mentioned first.

I’m still working on these as we speak as they’re giving me somewhat inconsistent results, but here are some really simple layer definitions as well as a handful of additional blend operations (I’ll check in fixes/updates as I make them); I have things working, but it’s strangely unintuitive, despite being the same kind of stuff I’ve been doing ad hoc for years. Compile times seem to be kind of rough at times as well.

Mostly, though, being able to hide unused/unreferenced parameters would be lovely.

Anyway: joymachine-public/ue4/material_shaders/layers at main · trentpolack/joymachine-public · GitHub</titl

Additional notes after some more work: something seems off about the layer authoring process; I don’t really know if I’m just not properly setting up a material at the very start to give the following materials something to work off of, it’d be nice (and maybe this is possible and I just didn’t test it) to toss in a material layer to use as a preview while authoring another layer.

The blends that exist seem… Non-ideal. I’ve had to create a handful already and they’re about as fun to make as something not fun to make. I often just want to ignore a blend entirely and just handle a layer blending entirely in a layer itself (also: probably possible already).

The shader compile time seems to be both longer than that of non-layered materials, as well as just the hiding/unhiding of material layers in a stack for quick looks. I’m not sure how this would work, exactly, but the blend used for a bottom/top material seems to result in some non-obvious results and it’d be handy to have a better idea of what/why is getting lost in the mix in a layer chain.

I’m likely just approaching this from the wrong mindset, but the process seems unwieldy and time-consuming at the moment.

Not a half bad idea to have the blend function inside of a layer… :smiley: By the way, I noticed it doesn’t work well with baked lighting. The model becomes very dark, or most likely it looks like it has something to do with reflections, perhaps?

Another thing we need is a drop down menu with ‘move up/down’ layers, since right now we don’t have the possibility to change layers order. Not a big deal if you didn’t tweak any layer parameters, you can always just re-drag from content browser to another slots, but once you tweaked some parameters, you will lose them.

Hi,

I just played around with material layers and thought if BlendAsset could received parameters directly from master material, it would be nicer. Because right now, for each LayerAsset I have to assign the same blended texure, it’s quite annoying for repetitive task.

I might think it could be improved in next release of Unreal or you guys have any ideas to set blended texture as a parameter of master material which is the same thing with Tinted_Tex.

Thanks

This. I’m aware that this wasn’t possible before either, but I was kind of hoping that it would be now. Create a library of material instances (grass, wood, stone, dirt, metal etc.) and sometimes blend them in different combinations, but sometimes just drag & drop one of them directly onto a mesh.Right now you can’t drag & drop a layer onto a mesh, because it’s a material function, not a material.

So you’d have to have each of your materials twice in the project: once as a layer, and once as a material instance. Any possibility that it will change?

How do I get this feature working?

I thought it was part of the 4.19 release but I’m missing the option in the experimental options window that everyone has highlighted

Hi Guys. for some reason i can’t enable material layers in 4.19, i downloaded the engine with launcher and in the experimental tab i can’t find option name “Material Layering Enabled” in material section…
here is my screen shot, can some know whats going wrong :frowning:

Is there any information on how we will be able to update material layer parameters through blueprint yet?

It’s under: Project Settings > Rendering > Experimental > Support Material Layers, not in Editor Settings like before.

I noticed a lot of shader compilation going on while testing this system. Tried to compare the number of shaders that needed compiling for a simple single layer vs an equivalent regular material.

Test setup: I created a simple material with some PBR texture parameters, a few scalars etc. Then copied the same nodes into a Material Layer. Neither had any instances, I triggered shader compilation by simply moving a node a little in the graph and clicking Apply.

Here are the results from OutputLog window:
Regular material: 16 + 36 shaders
Layer: 31 + 77 shaders

For some reason it shows two compilations, but either way it’s much more for the layer system.

This test may be somewhat “synthetic”, but I also tested it more organically by putting a Cube with material into a scene and triggering shader compilation. A Layer packaged into a Material Instance with just the Background Layer, added about twice as many shaders to the compilation process, as a regular Material Instance with the same nodes as the Layer.

Is that expected? Is it because it’s just an experimental feature? Or am I doing something wrong? Could someone test it, please?

Shader compilation was a big issue for us later in our last project, with thousands of shaders needing to be recompiled. I don’t think we’ll be able to accept those numbers increasing even more just as an overhead, for our next project.

Hey SmartPolygon :slight_smile: For things like this, it really will differ from project to project, so it’s probably best for you to create the library of blends you will need. When we release this feature fully, we plan to ship a library of blends with the engine as well, but we expect a large number of project specific blends and people sharing their ideas for awesome blend setups!

Do you have an example material setup that is causing material parameters to not be hidden if they’re not connected? This would definitely be a bug we’d be interested in a repro case for. Thanks!

So, I’d definitely recommend checking out Alan Willard’s GDC learning theater presentation on Material Layers. :slight_smile: He covers workflows, as well as the flexibility that comes from isolating the blend from the layers. If you still have questions after that though, definitely post them here and we’ll take a look!

Blends really will be something that is project-specific - things like damage, grime, and scratches all will have a particular look and feel for each game. We do plan on shipping blends that correlate with existing “blend functions” for 4.20 - but there are so many potential possibilities that we look forward to seeing the community create!

For layer hiding/unhiding, that will compile the permutation once, but should be quick after that. Also, in 4.20, you’ll be able to alt-click on the eye icon to toggle off all other layers, which will make compiles faster when you are just wanting to isolate a layer.

Thanks so much for all the feedback!

If you have a repro case for this, please pass it along here! Thanks :smiley:

In 4.20 (and you can see in Alan’s video here: https://www.youtube.com/watch?v=7ieuiaZNwII) you will be able to drag and drop layers which should definitely make this easier. :slight_smile:

We do have plans to update the parameter system - to be able to pick up parameters set in the material in a layer or a blend. We’re still in the prototyping stage for this as we want it to be a really smooth workflow for the user, so we don’t have details yet, but it’ll definitely be in the release notes/documentation as we add them!