4
$\begingroup$

Is there a way with the material compositor to make it so that when I have multiple objects (duplicated) within a scene that their materials change just because of the simple fact that they are duplicated?

EG. I have 2000 AirSoft pellets in this scene (some are duplicated for precise positions, others are within a particle system. But all use the same exact material), I don't want them all to be red, I want them to be either of the three colors; red,blue,purple.

I want to also choose that a majority are red (50%) and blue & purple would be 25% each. So 1,000 red and 500 blue and 500 purple.

$\endgroup$
6
$\begingroup$

You can use the Random output of the object info node to get random values between 1 and 0 that are unique to each object with the material. You can use this to change the color of an object using a color ramp node:

enter image description here

However, this only works for objects (you convert your particle system to objects with CtrlA> Make Duplicates Real, but they will no longer be animated).

You can kind of do the same thing for particles with the index output of the Particle info node (dividing it by the number of particles), however the output will not be random; the first particle will have a value of 0 and the last will have a value of 1.

If your particles move around and get mixed up enough, it may not be noticeable, especially if you chop up the color ramp node:

enter image description here

$\endgroup$
  • $\begingroup$ You might also add more variation by sending the divided values through some high-frequency sin / cos math nodes. $\endgroup$ – maddin45 May 2 '14 at 20:17
  • $\begingroup$ @maddin45 Hmm.. I couldn't get that to work, perhaps I did something wrong . . . $\endgroup$ – gandalf3 May 2 '14 at 20:35
  • $\begingroup$ Try this setting. The "high frequency" is actually acieved by multiplying the particle index by a large random value. $\endgroup$ – maddin45 May 2 '14 at 21:54
  • $\begingroup$ That setting is for the particle simulator as well, maddin? $\endgroup$ – Starius May 3 '14 at 8:14
  • $\begingroup$ @John It is especially for the particles, since it only uses the particle index and not a random value. You could probably add a random input as well, but I don't know how the particle info node behaves when no particle system is present. $\endgroup$ – maddin45 May 3 '14 at 17:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.