So, I’m cobbling together a Master Material for a project of mine where I’ve set up most common texture inputs as paramaters, as well as a switch and parameters for an additional material, masked by another texture parameter. At the moment I’ve got the material setups running through MakeMaterialAttributes nodes, which although (theoretically) functional, takes up a lot of space in the UI and as such isn’t all that user-friendly. I’d much rather be able to set up parameters for material functions in their place, splitting up the workflow a little bit.
My ultimate goal is to make the material as re-usable and user-friendly as possible, specifically being able to slot in Substance materials wherever you want.
So, TL;DR: Is there any way to make use of material functions as parameters in a material, either directly or through some fancy workaround?
I believe you want to pass in material function name, as a parameter?
Careful with over-complicating the shader this way, since ‘IF’ node actually executes all execution paths when it gets executed on the GPU. ‘Switch’ parameters don’t do that.
I’m adding a screenshot of part of my material setup. This particular part is set up to control wether or not you want to mask in another material on top of the base material defined in another part of the node network. Obviously everything is placeholder at the moment, but the basic ideas is to be able to mask out a portion of an asset and replace that portion with a different material. Example in bottom picture: I wanna be able to mask out the circle and the top row with a paper window material in order to let some light through.
Hopefully the setup is self-explanatory enough to illustrate my thought process, but if you focus on the “Null_Func” nodes; these are the ones I would like to be switchable parameters. For this particular project it’s actually fine that they’re constant, since they’re each only ever going to be one material, but I’m interested to know if there’s a slicker solution if I DID want there to be parameters availabe for those material definitions. The current, bulkier, solution as far as I can see, would be to replace the Material Functions with MakeMaterialAttributes nodes and run the material parameters through these.
I actually tried this before, but that caused me for some reason to lose acess to switches I’d set up for Metallic, Glossiness, and Emissive maps.
Are you saying you want a parameter to select which layer function to use? if so, the only way I am aware of to do that currently is to use a bunch of static switches for each layer you want to be able to choose.
What I want to have is a parameter where I can slot in a Material Function of my choosing, allowing me to define the characteristics of individual materials through a series of separate Material Functions, and then be able to slot them into instances from my Master Material.
What you are requesting, is probably quite a task to implement in the engine. There are a a lot of corner cases. Material functions can have varying type and number of outputs.
I wanted to express, that as you start working in the engine and its amazing node-based shader editor, you might be temped to create one master material and just use its instances with features enabled/disabled. Well, In long-term it actually proves to take more time and effort, as opposed to using a number of simple, yet specialized for given case materials.