# Is there a way to reset the seed of random material in Blender 2.8 Viewport?

In the 3d-view workspace, we can use a random color to give our separated object a distinct look.

What if I don't like the result and I want to randomize the color again?

Swapping the setting doesn't change the random seed in color.

(Blender 2.80.64.)

There is non as far as I know, at least currently though it would definitely be a very desirable feature, along with customizing the color ramp used to color them.

It does seem to use the same technique employed by the Random output socket of the Object Info shader node uses, which is uses object name as unique identifier.

So while you can't just randomize the global solution easily, or on several objects at once, it does seem to respond directly to object name changes, like the shader tree version.

That means if you rename your object it will change colors. It is trial and error process, since you don't have direct control over which color is assigned, but as a workaround you can iteratively change names until a color that pleases you is assigned.

If you like to keep your scene organized or dislike random names, you can still keep your names descriptive by appending some random string or number at the end to force change the assigned hash like my object 001 or my object #afhpo.

• What a pity. Didn't know that the name will change the color. It seems to use some hash function on the object name for unique and stable color (and super fast). I'll go into the code for it and add some information in another answer, thanks for the knowledge. – HikariTW Jun 21 '19 at 17:31

If you want, paste this in a .py file and install it as addon :

import bpy;

bl_info = {
"name": "Reset Selection Seed",
"category": "Object",
"blender": (2, 80, 0),
}

class ResetSeed(bpy.types.Operator):
"""Reset name to reset seed and change random colors"""
bl_idname = "object.reset_seed"
bl_label = "Color Seed Reset"
bl_options = {'REGISTER', 'UNDO'}

def execute(self, context):
for obj in bpy.context.selected_objects:
temp = obj.name;
id = temp.find('.');
if(id >= 0):
nom = temp[:id];
id += 1;
chiffre = int(temp[id:]);
chiffre += 1;
obj.name = nom + '.' + str(chiffre);
else:
obj.name = obj.name + '.' + '1';
return {'FINISHED'}

def register():
bpy.utils.register_class(ResetSeed)

def unregister():
bpy.utils.unregister_class(ResetSeed)

if __name__ == "__main__":
register()

• Why this 'temp' magic? I think appending one additional character should be enough right? – brockmann Jul 22 '19 at 16:59
• No because if you wanna reroll several times, add a new char each time will quickly become a chaos. There, the.[number] is each time re-processed – Henri B. Jul 22 '19 at 17:04
• Ok, thanks for the explanation @HenriB. However, what if there is no number? The operator will rename it anyway right? Python nitpicking: you can remove the semicolons and I'd suggest using rsplit() instead of find(). – brockmann Jul 22 '19 at 17:12
• @brockmann If there is no number, the find() will return -1 and a ".1" will be appended at the end of the name (the else statement) – Henri B. Jul 22 '19 at 17:14

It seems the color is somehow depending on the number you're adding. As in, when only adding a .1 to your object name, the color will change only slightly, while with an added .5 there is a change from (in this instance) green shading to purple. Seems to me these changes are replicable; at least when I tried this three times, I always got the same shades of colors. (Would add this as a comment, but do not have enough reputation).

• Yes in code algorithm Hash Function, adding a little change may lead to a closed result, which depend on algorithm. Thanks for the reporting – HikariTW Aug 7 '19 at 12:04