Hi,
EDIT: Short and simple form of question :
My question is about using material functions within other material functions. For example, I have a material function that allow you to adjust the tiling of a material and I use it in a material function for a grass layer. I use the function for tiling again in another material function such as for a rock layer. Then I add both the rock and the grass layer to a material for my landscape.
How do I make it so that when I create an instance of the landscape material, I can adjust the tiling of the individual material functions? For example, I would able to change the tiling for the grass function to 0.5 and the rock function to 0.02. I can not change the parameter defaults in within the material because when I do that, thousands of shaders have to compile.
OLD:
I am trying to create an auto landscape material and I have having some difficulty with dealing with parameters and functions.
So in my landscape material, I have different material functions for layers such as grass, dirt, rock and snow. Each of these functions have their own parameters such as tiling, albedo controls, displacement controls, and many others.
However, these parameters are created and adjusted through their own functions. Specifically, I have a function called “MF_MapAdjustments” to adjust things such albedo, roughness, normal, ambient occlusion, and displacement of the material and I have another function called “MF_tiling” to adjust tiling. Since I am using these controls over multiple material functions (grass, dirt, rock…), it makes sense to make them into a function (Full disclosure: I did not create the entire functions myself. They came with an asset.).
The difficulty I am having is that I want to adjust the parameters inside of these functions (parameters such as tiling and displacement) for individual material functions inside of an instance of the master auto material. Say I want to change the tiling for the rock layer to 0.01 and the tiling for the grass layer to 0.25, I want to be able to do this in an instance of the master auto material.
My auto material is called “M_Landscape_Auto_Material” and I have an instance of this material called “MI_Callaghan_Terrain_Material.” One of my material functions is called “Grass_01”.
I want to be able to change the tiling for Grass_01 in MI_Callaghan_Terrain_Material. However, when I look inside MI_Callaghan_Terrain_Material, I see these variables (I see the tiling variable, etc) but these are global to the material and if I make any changes, they apply to all the material functions and the entire material.
How can I make it so that I can change the parameters of individual material functions within the material instance? I know I am repeating myself but I just want to be very clear with this question. I am pretty sure this is possible because I found a material from an asset that is similar and it allows you to adjust the parameters of individual material functions in an instance. I have attached images below:
Hopefully this question makes sense, if you need more clarification please comment below.