Is it possible to make existing materials (e.g., steel, gold, wood, etc…) into instances of a new material made by me? highlight(material)
The first image is the (code) emissive colour I want to apply in my items (on mouse over or click).
What am I missing? I am certain there is a better way to do this :\ Need access to the variable “turn-on-emissive”. Should I do all of this in a BP instead?
Sample of Highlight.material
Sample of an item. Steel. Has a Inherited BP. However, I need access to the highlight(material) and the already existing steel(material)
Am I forced to use material parents and instances?I don’t think it is possible to force the existing “steel material” to be an instance of “highlight material”.
Here is the example I am following, but trying to make changes to it:
You can actually change an instanced materials parent and it should keep things that share the same names. So if you make your highlight master material have the same names as your steel/ wood etc then you can just switch the parents.
But it might be simpler to do this in a postprocess material idk
in your case you might wanna look into material layering.
Reviewed Post process, inheritance, and material layers.
Testing material layers cause it might have a similar logic to my BP_BaseItem. It seams to have a mature logic and order of how to do things.
How I set it up:
Conventional Material: BaseMaterial
Material Layer: ML_Highlight. Passed the emissive logic to this layer (might have to remove it, and pass it to the instance).
Material layer blend: MLB_Highlight
The process now is to create instances of the BaseMaterial.
- I can’t use the existing materials as layers. Need to convert them into layers. (e.g., convert existing steel material into a layer)
My current solution, in case any one else has similar issues:
Create dynamic material instance(s) on the BP_Actor_Item constructor; (Don’t go wild on the constructor, it is very easy to crash and break when messing around within class constructors.)
Create an array of material instances and add them; (You are still in the BP_Actor Item. made it as an array, in case some meshes might have multiple materials.)
From now on, your BP will have an array of dynamic material instances ready to use. Just call the method when ever u need it.
- Most of the code/BPs is re-usable. With the exception of the constructor which needs manual input of what material to create.
My problems with the current solution:
- I don’t know the impact of this solution (resources wise… vs similar solutions);
- I don’t know why dynamic materials can only be created through scripts. In my opinion, most of the effort here, would have been mitigated if I could “check the material as dynamic” through the editor;
- I am not a fan of writing code/nodes on the class constructor.
Can this be improved? what u guys think?
It also works on materials assigned to a Image on widgets. And to my surprise, you do not need to create them as dynamic material instances on the constructor:
If you wish to highlight the widget like so: