Assigning a per-object random value with ICE

Suppose you want to use an ICE attribute to drive some behavior in the render tree. For example, you may want to introduce some randomization to a procedural texture. Here’s one way to go about it.

First, create an ICE attribute on each object. You’ll use this object as the seed for the Random Value node (you need a different seed for each object, otherwise you’ll get the same “random” number for each object).

si = Application
i = 0
for o in si.Selection:
	a = o.ActivePrimitive.Geometry.AddICEAttribute("_seed1", 2, 1, 1  )
	a.DataArray = [ (i) ]
	i = i + 1

Now apply a simple ICE compound to each object.

Seed and random scalar value for each object

Seed and random scalar value for each object

All the compound does is feed the seed into a Random Value node, and store the random value in another ICE attribute.