I am trying to do rocks and I want them to have a random base color from within the colors that look "rocky". The only method I know of is to duplicate the base objects over and over and give each a different color in the node editor, then group them all and use them as the group input for the particles. This is slow, inefficient to change, duplicates a lot of data, and comes out with a uniform distribution of the colors. Is there a way to have give particles a random color from a set or range?
I'm going to keep this short and simple. Do everything Duane Dibbley did but use an Object Info node instead of a Particle Info node. Connect the random output directly to the color ramp, no math node needed.
Pro Tip: Make sure that if you are using a color ramp set to constant that you don't put any colors at position 1 (all the way to the right). They won't end up being used.
In Cycles, you can achieve this with a Particle Info node and a color ramp. It has an Index output socket, which gives you a integer from zero to one less than the total number of particles emitted, so you'll need to divide the index by one less than the total number of particles, to get a value between 0.0 and 1.0 which will drive the color ramp. This material goes on the dupli object, not on the emitter. If you set the particle emission to Random, each new particle emitted will appear in a random location, meaning the indices will not be ordered. This in turn makes the differently colored particles appear randomly accross the emitter.
The color ramp can be defined in several different ways: Ease, Cardinal, Linear, B-Spline and Constant. With the first four, the colors will smoothly transition between the control points, and they differ only in what formula is used to calculate the transition, and with Constant the color changes abruptly at each control point and remains unchanged between the control point (any point which is not a control point will have the color defined by the control point to its left). I will show Linear and Constant here.
This is with Linear
Here's a rendered preview of a very bland scene with only a plane emitting 250 duplicates of the same object, using a linear color ramp.
This is with Constant
Here's a rendered preview of a very bland scene with only a plane emitting 250 duplicates of the same object, using a constant color ramp.