helloluxx

Random Colours with Mograph

`
This tip shows you how you can apply random colours from a gradient to your objects in Cinema 4D.

Random Colours with Mograph

Creating Random Colours with Mograph is a simple task these days thanks to the addition of Fields.  In this tutorial, Tim shows you a few methods of achieving this.

Random Effector

The first solution could be to use a Random Effector. By default this is set to use Effector Color under the Parameter Tab – Color Mode.  This results in a multi-colour array which you can adjust by using the seed, or changing the min/max values, but there is no control over the hue of the generated colours.  Controlling the hue is quite essential, but you could remap this to a gradient ramp in your material.

 

Random Colours

Under the Random Effector’s Effector Tab, change the Min/Max values to be Min 0% and Max 100%.  This sets the range of colours from Black to White (for each RGB channel).  If you then choose Random Mode – Sorted, the Random Effector will assign a unique greyscale value to each clone.  This is perfect for using in your materials.

Random Colours with Mograph

The advantage of using the Random Effector in Sorted mode is that you get an even distribution of values, plus you can move the Cloner Object around (or whatever generator you’re using) and the colours will stick.

Unfortunately there’s no animation option with Sorted.

For animated values you can use Noise.  This will allow you to animate the random effect, either locally using UV Space or Global Space.  If you choose global, then the colour will change if you move the Cloner around, but the colour will stick if you choose UV.  You will need to fiddle with the Min/Max values to get an even distribution of values from dark to light, Noise will generally produce mid-grey luminance values which limits the range available when remapping the colour.

Random Field

An alternative approach which is probably more flexible is to use Fields for this.  Add a Plain Effector, disable everything under the Parameter tab with the exception of Color Mode(which should default to Fields Color). Next add a Random Field to the Falloff – Fields list. Enable the Colour icon in the Fields layers, then switch to Color Remap and choose Gradient.

 

The Random Field offers the same settings as the Random Effector, Random, Sorted and Noise. You get access to all the Maxon Noises, plus they can be looped, so there is a lot more control there.   In the images below you can see the Random Field result for Sorted and then Cell Noise.

Depending on the noise you choose, the values could be mid-grey as I mentioned above, but it is easy to adjust the gradient knots to crush this, or you can add an adjustment layer such as Curves.

A big problem with using the Random Field is that the space is linked to the Field Object (or Globally), so if you move your Cloner around, the colours will change.  Parent the Random Field to the Cloner for this to work. Most of the time you probably won’t move your Cloner Object anyway, you’ll use Effectors to move the Clones which will work fine if the Effectors are in the correct order in the Cloner Effector list.  But if you clone onto an object for example, as the object moves the colours will change.  Solution is to make the Random Field a child of the object and then they’ll all move together, unless the geometry is deformed…

Finally you need to be able to transfer this colour or greyscale information from your Clones to your material.  This is simple with the Cinema 4D material system, the Mograph Color Shader will read the colour from your mograph object, if you want to remap those values, use a Colorizer Shader.

With Redshift, you use the RS Color User Data node. You need to make sure you specify which attribute you are reading, this could be object display color, particle color or in this instance you should use Mograph / Color (RSMGColor).  These colour values can then be piped directly into your material channels or for more control wire this through a Ramp node and this works just like the C4D Coloriser Shader.  You can define the colour range directly in the Field’s Color Remap Gradient or in the RS Ramp, both options offer different benefits.

Anyway, that should be enough to get you going, have fun!

learn. Cinema 4D Fields in One Day

Fields and OpenVDB bring an incredible toolset full of exciting features to Cinema 4D. The already powerful Mograph module has evolved into a powerhouse of opportunity, opening the doors of creativity to the 3D artist. Tim Clapham, an established expert at working with Mograph, is the perfect partner to guide you through this creative feature set.