Object Index not working

Hey,
I just played around with some ways to randomize a material and now I was working on roofing tiles where I wanted to give them a random color controlled by a color ramp which is indepent from the “Random” value of the object info node.
I thought it could work if I put the object index (object info node too) into a modulo math-node, divide this value by the value I took for the modulo operation decreased by 1 and plug this value in a color ramp to determine my color.
Like this:



in the final render not with these colors of couse :slight_smile:

When I tried this for the first time, it worked, exactly with those node (I copied them), but everytime I try it NOW it doesn’t work.
This is what I get with the node from above:


Can anyone tell me what’s wrong there?

regards
Harle

Have you given each object its own object index? (in object properties panel)


1 Like

Well I don’t really know. Is the object index an internal value given for each object or is it the .xxx behind each object name? If case 2, yes each object has its own .xxx ending (don’t know if it’s even possible otherwise).
I can’t find something else relating to an index in the properties panel.

Object properties


Oh ok, well…that’s a problem.
Is there a fast way to give all of them a new object index? 999 Tiles (yes…exactly 999…) …well…that would be annoying.

Edit: just looked for some explanations on the blender wiki and tested in blender, seems like every object has 0 as default, but why was it working before? Got no screenshot or something but I’m 100% sure it worked with exact the same nodes before, i just copied them and I was never manipulating the object index by myself o.O
Was it just a bug?

Select all tiles, open Python console, type/paste this in:


for i, o in enumerate(C.selected_objects): o.pass_index = i+1

(would need to press Enter twice). This will assign indices 1…N to selected objects.

Thanks Stan, just played around with some modulo+multiply nodes to manipulate the “Random” value from object info to get a value that is not visible dependent on the random value. But thanks for the python command, that’s much better. I should start looking on the scripting part…

Btw. here’s a testrender with the roof and some other stuff of the scene i’m currently working on. Works pretty good with some randomized colors.