So, currently I'm changing my landscape material to be more complex. And although this is probably not even necessary as I guess won't use them all, I want to have a rich palette of material layers I can use. 39 layers for now to be precise (the materials/textures of 2 DLCs). But is there a limit to how many layers I can use or in other words: Does it costs much more performance the more material layers I have? And how many layers do you use actually for your route projects and/or you think is enough? --------------------------------------------------------------------------------------- In case you're wondering about the question, my main thought about this concern was initiated by this post my Mail Goltz in this thread: And Maik if you read this, sorry if I have to quote you again and again, but I just wait for answers to my questions.
I think the better question to ask is how many layers can you have in a single tile. Internally, the landscape material uses something called Static Switches, which means that for each tile, it only enables the layers that are actually being used and skips the rest at basically no cost in terms of shader complexity. Still try to keep each of the layers lightweight though without a lot of fancy features. What I would be more worried about though is memory usage, specificly VRAM. I don't know how does the engine keep track of all the landscape layer masks and having 100+ tiles could make the memory usage go through the roof if it's not particularly efficient. I'm currently using 10 layers and feel like it's going to be enough for everything. Best thing is probably to try and see. Create the material (most of it is copy-pasted anyway) and apply it to a bunch of tiles on a test route.
This is how it actually looks now. I just used a simple setup first, but I would like to add your tips from adding a Texture Variation Node and changing the Alpha Blend to Height Blend (plus using each of the Metallic texture RGBs for Metallica, Roughness amd Ambient Occlusion), but I don't if this would be too much fency. Also there are 4 materials which I think are the same in each DLC. I guess I should them take them off of the Layer Blend. Another question: Does it only matter if the textures are connected to the LayerBlend to affect performance? Or does any node and connection matter to impact performance? Because I have made separate LayerBlends for the materials of each, which I only use in case something won't work but like to already have them preconfigured to use. But is this actually a bad technique so that I only should have the connections and nodes I need within the landscape material?
As far as I know, any nodes that don't have their outputs connected (and therefore don't affect the final result) will be ignored by the shared compiler so you can just leave them there as long as it doesn't hinder the graph's readability. Also the texture variation node is pretty lightweight so I don't think you will have any issues. Not to mention that it's only going to be calculated for layers that are visible (because it's behind the Static Switches aka the Layer Blend node). That makes me wonder, do you think the Layer Blend uses some sort of lazy evaluation? Not sure if that's a proper term in this case but basically if it skips calculating other layers in a specific spot if their blend weight is 0.
The problem is me without having any Unreal experience, creating materials and everything which might affect performance and potentially could lead me into trouble is still a big mystery. I have no clue if a texture sampler is rendered before I even connect it to the LayerBlend node or whether a texture which isn't used on the landscape even has an impact on the performance at all. Since I wanted to have quite a rich palette of textures/materials for my project and giving the said statements of Maik which I don't quite understand and make me insecure, it was worth for me to ask before. And your tips all have been very helpful to me as you're probably the one in this forum which has the most experience with materials (maybe even more than the actual developers).
Nah. I wouldn't say I have more knowledge than the actual TSW devs but on the other hand, I generally don't do advanced material features so, who knows what I could implement if I needed to. Good thing about materials is that almost everything is non-destructive in a sense that you can use them in the world and when you change something, it updates everywhere. Though I do understand the concern that you might find a material to be too heavy in terms of performance and don't know what feature is causing it.