Material Node Performance: Multiply vs Lerp vs Switch

Hey there! :smiley:

Just a simple performance Question, but in my example, is is very important.

I have two Materials for my trees.
One for the leaves, one for the trunk.
Then I have lots of instances of each material.
In this case, i use my leaf material for the leaves and for the Billboard LOD at verry far distance.
And i just would like to have the possibility to disable wind in the Material Instance.
I got 3 options:

Use a “Multiply” Node. Wind multiplied by 0 results 0.

Use the “Lerp” Node and Lerp between the Wind an 0.

Us a “static Switch” with a “static Bool” Node and compare between the wind and 0. (I know, it creates a new material by switching, but does it also create one my multiplying by 0?)

And also: can I save some performance by disabling Wind this way?

What sould I use, from what can i get the most performance out of it?

If you use multimply out lerp sistem aniway calculate all nodes you got in wind. If you use a switch node our switch parameter and in false set value to 0 our 1 depend what you want to be default value, it dont process the calculation until the condition become true. So you can make a realy complicated master material with alot of switch, and make them like parameters and with a mater material enable our disable what you need in different material istances, and it use minimum ammout of calculation in function what you enable.

I got a realy complicated master material that can arrive to more that 1000 calculation but if I got all disable it making 80 calculation

to see the difference

  • set a switch parameter
  • make a istance of your material (right click on material Create istance)
  • Double click your istance
  • After it calculate default material you got up on left side on the preview how much istruction your pc need to calculate to make this material
  • Now enable the switch and see the difference