Is there a way to utilise the same shader material on different meshes with different value assigned to it uniforms

I am creating a series of very complex materials for rayMarching. However, I am failing to figure out how to utilise the same raymarched material (assigned to different meshes), and give them different sets of data for their occurances.

Is there a way to do this? In my understanding instances is not appropriate way too many uniforms. I am assuming it can be done as you can instance animated models and I believe have them animated differently. Which means different streams of matrix data into each occurance.

Have done it via cloning the material. But will this cloned material also need to compile? The shaders can take a minute to compile, so if I want 6 occurrences of the same object don’t want to have six compilations, when all that is changing is their data set.

Cloning is ok.

As all the clones are using the same shader, the compilation will be done a single time and all shaders will reuse the already compiled code.

Marvelous. Thanks for your help.
Hers is a nice example of what I am trying to achieve.

1 Like