Big question about complex character materials with *hazard* effects

Let’s say that I have a character with a material. The regular material is what it is. Now let’s say that I have a bunch effects for things like when they are on fire, drenched in water, being electrocuted etc etc. What is the best way to handle this? Is it cheaper to have a low poly “inflated” version of the mesh, with all of the effects on it, or is it cheaper to just make one huge master material with all of the effects on it for the actual character mesh?

Going with the big complex material route, I’d obviously have to rely on lerps or some kind of real-time switching(if-thens). This leads me into another question: If there is a chain of commands behind some kind of lerp/if-then like that, do they count toward performance if they are essentially switched off? Like if a lerp is at zero or one, does it still have to perform all the math for the other input; even though it’s essentially deactivated?

On the other hand, going with an “inflated” low poly mesh, that has a material with all of the various hazard effects, would I be paying more to render it out; due to the increased polygons and having to handle the translucency shading? I can see that having an extra mesh+extra material+overdraw from translucency is going to cost something, but is it going to cost more than just using one big complex material?

If any of this effects can appear at any moment in game, so they must be always loaded and will use some memory.

I think easiest way is to create bunch of dynamic material intances and apply them on mesh when character takes damage.

Maybe if effects have the same structure, for example emissive color and panning texture mask, it is better to create one dynamic instance and only change this parameters in it.

Well memory-wise is one thing, I’m more concerned about cpu/gpu-wise. I definitely agree with dynamic materials being great for stuff like this, but I’m trying to weigh out costs. Panners/dithering/etc would likely be used for these kinds of effects and would have textures swapped in and out. Going that route would mean going with the one complex material though; from which you’d make the dynamic instance of.

Which again, leads me to the same question of lerps/if-thens, that have things hooked up to them, and whether or not it’s having to perform the cycles on things that aren’t currently active. For example, you have a lerp node, with huge trees of nodes connected to inputs A and B. Let’s say the alpha is at zero or A=100% and B=0%. Would the engine still be trying to perform all of the math for the stuff hooked up to input B? Same kind of question would apply for if-then nodes as well.

I think if you have Bool’s which you switch on and off it deactivates anything before the Bool (so it does not compute), you can kind of see this when you use Material Instances with Bools. If you have a parameter before the Bool switching it to false means that material instance does not show that parameter.

I would go with the material Instance method, I think adding in extra meshes etc will get messy when you start doing additional things to the character, when you can just use one material instance to control all the effects.

I think the CPU vs GPU cost saving either way would be negligible, but with anything you should do some tests

Correct me if I’m wrong, but the problem with bools is that they require a recompile when you switch them.

Sorry, not a Bool I meant a switch

Still the same thing. Toggling a switch node forces a shader recompile, as far as I know.