How to add/remove Color effects to model at runtime?


I need to add color effect to spatial and be able to remove it conveniently. For example, suppose that mage casts ice spell on other character. I need to visualize the cold debuff by making it bit more blue. After cold debuff is over, spatial has to look normal again. If character is poisnoned, I want it to turn green and make it look normal when poison debuff is over.

Problem is that I don’t know where to start. Should I do something in control’s controlRender-method or change material somehow?

I’ve already read documentation about Post-Processor Filters and Effects, Materials, Shaders and Shader Nodes.

I’m not entirely sure at this point if I wan’t to be able to combine these color effects or not. If it doesn’t cause too much trouble, I’d like to keep that option open.


[java]spatialMaterial.setColor(“Color”, ColorRGBA.Blue);[/java]

when debuff is active…

[/java]to restore initial state.

[EDIT] : for an unshaded material of course, change the parameter name accordingly to your shader…(“Diffuse” for lightning material).


Thank you very much!

Your tip made things easier than I would have imagined.

Since my model used lighting material, setting Diffuse-color solved the problem.
However, calling

turned model black. To turn model back to normal, I have to call

[java]spatialMaterial.setColor(“Diffuse”, ColorRGBA.White);[/java]


Thanks again!