1
\$\begingroup\$

I have a situation in unity where I have a custom shader with some properties where every object that uses this shader will want different values for those properties.

As far as I can tell, that means that I need to make a unique material for each object, which is a lot of materials and a tedious pain to set up.

Is there a way to make it so that I don't need to create and use a unique material for each object that uses this shader?

Also, if there is, are there downsides to doing so?

\$\endgroup\$
3
  • \$\begingroup\$ You could probably do it programmatically when the game starts, but that would be a lot of code. Duplicating the material a lot of times and then changing them sounds teduous tedious. Do you have an intern? ;-) \$\endgroup\$
    – simbabque
    Commented Jan 22, 2017 at 11:59
  • 1
    \$\begingroup\$ Check this out :) \$\endgroup\$ Commented Jan 22, 2017 at 15:26
  • \$\begingroup\$ Note that in the end, you have different configurations and thus, always, different 'materials', whether this is implicit or explicit. Different materials can generally not be used in the same drawcall, with the exception of using instanced rendering (I'm not sure if this is even an option nowadays in Unity). I.e. more materials or more configurations = often more draw calls. This may hurt performance, depending on your target and such \$\endgroup\$
    – Athos vk
    Commented Jan 23, 2017 at 18:12

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.