switching between material functions
I'm currently working on a customizer that allows the user to switch materials on different objects/configurations throughout the level. The problem I'm facing at the moment is that some objects have a unique normal map that needs to be applied no matter what material the user selects. My way of doing this at the moment is having all "base materials" as material functions that a master shader uses:
My problem is however, I'm having trouble figuring out how to change the Mat_Leather input based on what the user selects. Is there a way to set up a switch case(with more then 2 materials functions) that I can access and change using external factors(like a blueprint).
asked Aug 30 '16 at 06:21 PM in Rendering
It looks like you are looking for the LerpMultiple node. Depending on the output of your material function you can use different LerpMultiple nodes and a scalar parameter to choose which is displayed. I've attached a screenshot showing off a very simple application of the node. If you want to access this with Blueprint I would create a material instance dynamic (MID) and set the scalar parameter value assigned to the lerp node's alpha input.
answered Aug 30 '16 at 09:52 PM
It looks like your normal map is a material parameter. If you give that parameter the same name in all of your materials, then the object's Blueprint can create a dynamic material instance and then set that material instance's texture parameter (which is the same name in all of your materials) to the normal map for that object.
answered Aug 30 '16 at 10:58 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here