Random color file included

   3284   9   0
User Avatar
Member
161 posts
Joined: Nov. 2018
Offline
Hello,

Can someone please explain to me how do i put random color on each object that i instanced on a grid?
Im browsing through forum, applying different setups but for some reason i can't get it to work.

I have object that i coppied with for each point loop on a grid, but i don't know how to randomise color of each those piece on a grid.

Attachments:
Random color.hipnc (119.7 KB)

User Avatar
Staff
3465 posts
Joined: July 2005
Online
Attribute Randomize SOP
Michael Goldfarb | www.odforce.net
Training Lead
SideFX
www.sidefx.com
User Avatar
Member
161 posts
Joined: Nov. 2018
Offline
Do connect it on the single object, outside, just before the stamp which is inside the for each loop ?
Edited by MilanB - Sept. 18, 2019 12:54:41
User Avatar
Member
2164 posts
Joined: Sept. 2015
Offline
You can drop down the Attribute Randomize SOP just before your Copy SOP and in the Global Seed parameter (under Options tab)
put this expression:

detail(“../foreach_begin1_metadata1” , “iteration”, 0)

Also, make sure under the Attribute tab of your copy SOP to enable “Use Template Point Attributes”
Edited by BabaJ - Sept. 18, 2019 13:20:45
User Avatar
Member
161 posts
Joined: Nov. 2018
Offline
@BabaJ
Hmm, it doesnt seem to work, i got the following error on Attribute Randomize SOP:
Error
Invalid source /obj/sphere_object1/attribrandomize1/attribwrangle2/attribvop1
Error: Unable to evaluate expression (Syntax error (/obj/sphere_object1/attribrandomize1/seed))..

Have you looked inside the project, any clues?

Attachments:
error.jpg (65.6 KB)

User Avatar
Member
2164 posts
Joined: Sept. 2015
Offline
Have a look.
Edited by BabaJ - Sept. 19, 2019 01:37:02

Attachments:
Random color.hipnc (213.8 KB)

User Avatar
Member
161 posts
Joined: Nov. 2018
Offline
BabaJ
Have a look.

It works now, with 1 problem
I even did the rotation of them through the transformation sop with $F

But, when i render, the objects that are now colored in the viewport are black and white color in the render.
First time i see this occour. What could it be?
Edited by MilanB - Sept. 19, 2019 07:15:12

Attachments:
Fixed Baba black and white.hipnc (483.0 KB)

User Avatar
Member
161 posts
Joined: Nov. 2018
Offline
And here is the screen of it.

Attachments:
black and white.png (345.1 KB)

User Avatar
Member
161 posts
Joined: Nov. 2018
Offline
When i add for example sphere in another object container, and add a color to it, it displays it correctly, however as shown above, i get black and white, that is, no color…
There is a Cd attribute on block end…i don't understand why is there no color?
User Avatar
Member
161 posts
Joined: Nov. 2018
Offline
I fixed it enabling the packed color on the shader.

Note that i didn't have previously a shader added to the objects. I thought that, using this setup as you can see in the file, with the attribute randomize will set the color. Is this really the route, to only be able to get the color with applying the shader (this example the principled shader, and tickig the packed color) ?

Attachments:
Fixed Packed Point.hipnc (520.0 KB)

  • Quick Links