Input: Object Info
|Function||Returns information about an object|
|Nearest C4D equivalent||Compositing tag returns some of this data|
This node returns certain pieces of information about an object which you can then use to input to other nodes.
The object's position in the 3D world.
The object ID, assigned by a cyObject tag. Note that this is not an index value, it is the numeric value (1 by default) given to the object if you add a cyObject tag to it. Blender refers to this parameter as 'Index' rather than 'ID'. Be aware of this when reading Blender tutorials or documentation.
In the above example, there are three spheres each with a cyObject tag. In the tags, the ObjectID has been set for the values 0, 1 and 2 from left to right in the scene.
The node tree looks like this:
For each object, the Object ID - which will range from 0 to 2 - is converted into a range from 0 to 1 and that is used as the input into a Color Ramp node, the resulting colour being different from each object. In this way, the same material can generate different colours for the three objects.
This is the material ID number set in the Material Settings tab in the right-hand pane of the node editor. Consider this node tree:
The colour returned is now controlled by the material ID value. (Again, Blender uses 'Index' for this parameter, so remember this when reading Blender tutorials.)
If the Material ID is keyframed from 0 to 100 over 60 frames, we can use the Math node to convert this into a range from 0.0 to 1.0 and link that to the Fac input of the Color Ramp. When the animation is played, we get this result:
A random value between 0.0 and 1.0. If the Random output is linked directly to the Fac input of the Color Ramp, the colours are selected randomly and might look like this:
Note that you cannot alter the random seed for the returned value. However, the random value is generated when the material is assigned to the object, so if you don't like the colour on an object, delete the texture tag and reassign the material to the object. A new random number will be generated. You can do this as often as you like until you are happy with it.