Instances and duplicates vs. random colors

Blender (Export script developed by yoyoz; Integrated Plugin developed by JimStar)
Andreas_Resch
Posts: 319
Joined: Sat Jul 28, 2018 6:29 am

Something about the way that random colors are assigned to objects is a bit weird.

When I duplicate an object via ALT-D (Duplicate Linked) a new random color is assigned as it should be. However, when I duplicate an object via SHIFT-D (Duplicate Object), all the duplicated objects have the same color. It would be great is those duplicates have a random color as well.

Another weird thing happens when you duplicate object via SHIFT-D. Take a look at the example below. The center row has random colors for all the cubes. When I select all of them and duplicate them (SHIFT-D) at the same time, they have the same colors as the original object (boxes in the top row). However, if I duplicate each box individually, every box has the same color (bottom row). Even if I copy an orange cube, the copy will turn to green (in this example).
RandomColor_01.jpg
As you can imagine this is very confusing to work with. Somehow this logic seems reversed. I would rather expect a duplicate-linked object to keep the same color as the original and the one with is an independent duplicate object to have a different color. This would also help when you transform an array of object (via the modifier) into singular objects. They would all have different colors. Right now, they are all the same. And as it seems I would have to manually assign random color seed values to all of them, which in bigger scenes is a real problem. On top of that, every newly created object that the random color material is assigned to, has the same color. Again I would have to manually assign random seed values to object.

Maybe somebody can share some insight into this behaviour. And what would be a quick way to make the random color material work properly, no matter which object you assign to that matterial? For example 100 objects created by an array modifier.
linograndiotoy
OctaneRender Team
Posts: 1353
Joined: Thu Feb 01, 2018 7:10 pm

The random color node specifically works with instances, using the IDs.

To do what you asked for, we should try to implement the Random parameter in the Obejct Data Octane node. We'll see what we can do about it.

That will not help with the Array modifier, by the way, since is generating a whole mesh, not the single "instances".

Best practice would be to use the Instancing options to get what you need.
Last edited by linograndiotoy on Fri May 12, 2023 11:07 am, edited 2 times in total.
Andreas_Resch
Posts: 319
Joined: Sat Jul 28, 2018 6:29 am

That would be a valuable addition. Blender has got a random node value that is linked to the object info. Such a thing would really help. I use it all the time to randomize materials.
Andreas_Resch
Posts: 319
Joined: Sat Jul 28, 2018 6:29 am

I've created a little addon (using Serpens) that randomizes the value of "Random Color Seed" for all selected objects. This will help if one wants to randomize colors for any object in the scene (not just instanced ones).

It's free and can be downloaded here ... http://www.argfx.at/upload/octane_tools_0.1.0.zip

After using the addon, you need to reload the scene. The changes are not updated in the viewport immediately. You can also move the affected objects and cancel the movement via ESC. This will also update the changed values.

Works like a charm. Those cubes were created via an array.
RandomColor_02.jpg
linograndiotoy
OctaneRender Team
Posts: 1353
Joined: Thu Feb 01, 2018 7:10 pm

Looks great, thanks!
TheBricksburgTheatre
Licensed Customer
Posts: 44
Joined: Thu Sep 07, 2023 9:13 pm

Hi Andreas,

Man, this is what I was looking for! Unfortunately I just don't understand how to use your script. I've already installed it but haven't figured out how to use it. Can you briefly describe to me how you randomized these cubes in your image? that would be great thanks alot
Andreas_Resch
Posts: 319
Joined: Sat Jul 28, 2018 6:29 am

My addon basically just assigns random numbers to the "Random Color Seed" value of the selected objects. Once that is done, you can use the "Random Color Texture" node in the Material Editor to drive certain values. As for the random rotations, I have to use an OSL node that I downloaded from the Silverwing repository. I wish it was easier, but that's how we need to work around that for now.

Silverwing Repository ... http://www.silverwing-vfx.de/free_stuff.html

Here's an example for the material node tree.
Octane_Nodetree_01.jpg
TheBricksburgTheatre
Licensed Customer
Posts: 44
Joined: Thu Sep 07, 2023 9:13 pm

Thank you very much for the support. I will check it out and see how it can be done.

thx a lot!!



cheerz
TheBricksburgTheatre
Licensed Customer
Posts: 44
Joined: Thu Sep 07, 2023 9:13 pm

Hi Andreas,


so this works very well for me. Now I can randomize my textures. TY for the tip. So cool!

Only one thing i do not get. It works only when I link the objects to each other. You mentioned with your script it also works out without linking the objects.

I just installed it and activated in the add-on menu. Im pretty noob in Scripts and these things. Do I have to do something special to use your script?

thx very much,

cheerz
Andreas_Resch
Posts: 319
Joined: Sat Jul 28, 2018 6:29 am

After installing, you should have a button in the flyout menu on the right. Like that ...
Octane_Addon_10.jpg
After that just select all the objects that you want to randomize and click the button of the addon. You will not see the changes immediately. Not sure how to refresh the scene from within the script. But just start to move the objects by hitting "G" and abort it by hitting "ESC". After that the objects should refresh and the randomization should be visible.

Hope that helps.
Post Reply

Return to “Blender”