Notifications
Clear all
[Closed] Assign material through variable
Mar 03, 2016 1:43 am
How would you assign a material via a variable that contains the current material that’s being overwritten? That is;
myMaterial = meditMaterials[1]
myMaterial = Multimaterial()
Something like that, except for overwriting the material instead of the variable.
2 Replies
Mar 03, 2016 1:43 am
Thanks! That did the trick
Just in case anyone else comes across this topic in the future, this is basically how it works:
curMat = meditmaterials[1] --Create initial variable
newMatInst = createInstance (DirectX_9_Shader) --Create an instance of what you want to apply.
replaceinstances curMat newMatInst --replace the old node in scene with the new instance.
newMatInst.useshaderfx = 2 --Do stuff to the new node.