Yes, the question seems silly. But the answer is vital for me. That's why I asked you professionals to clarify it.
I am making a car paint shader, and I want to put into it as much as parameters I can. Thus I'm adding parameters for stop lights, rear lights and blinkers to it. Or I can make a new shader only for the lights. But I'm not sure which way is better. So that is why I asked this question.
Looking for an answer,
Regards.
Replies
The answer is really interesting. If you make a 3D model with 4 meshes for Unity3D and that each of these meshes use one material (means thet use one shader and one material), in the runtime you are going to have four different materials of one shader in memory with the same material properties as the one in the disk. You can change a material properties in runtime but the other 3 materials wouldn't get affected and the original material (that those 4 materials had been instanced by this one) would not get affected, neither.
Would be glad to hear your comments about this topic.
It'll depend on how the renderer batches materials and what effect changing parameters has as to what happens at render time. That simple material colour change could mean you're quadrupling the render cost of the car but equally it could mean you're not.
In most cases a single shader on a single mesh is going to be the cheapest option.
However, If you want to do something interesting like have transparency or flashing lights it's almost always going to be cheaper to only apply that shader to the bits of mesh that need it because by doing this you're reducing the number of pixels on screen that need extra processing.
As I said above, the cheapest solution will depend on what the renderer is doing and what the target hardware is good at so the only way to be sure is to profile it.