Randomizing Materials with Switch node

   3387   4   2
User Avatar
Member
10 posts
Joined: Feb. 2018
Offline
Hello everyone,

I have set up geo node which looks like
this [scr.hu]

In switch node I have put : stamp(“./copy1”,“switch”,0)
screen [scr.hu]

In copy node I have put “switch” as Variable 1 and “fit01(rand($PT),0,(opninputs(”../switch1“)))” as Value 1.
screen2 [scr.hu]

In a viewport I can see my spheres but nothing is showing on render view.
screen3 [scr.hu]

I would love to get effect like in this example


But instead of random colors I would like to get my materials on random spheres.

I would love to hear from anyone who knows what I'm doing wrong.
Edited by PatrykC - March 12, 2018 12:55:08
User Avatar
Member
10 posts
Joined: Feb. 2018
Offline
Ok I figured it out with my friend.

First:
I had to change Primitive Type to Polygon instead of Primitive.

Second:
in Switch node I had to add one dot before /copy1
stamp(“../copy1”,“switch”,0)

Third: I had to add -1 in the last part of expresion.
fit01(rand($PT),0,(opninputs(“../switch1”)-1))

After that everything is working correctly and renders as intended.
This thread should be closed now I think.
User Avatar
Member
460 posts
Joined: Aug. 2014
Offline
Check this example out.

EDIT: Ah, ok. Seems like you already solved it.
Edited by ajz3d - March 12, 2018 12:44:20

Attachments:
ajz3d_randomize_materials.hipnc (338.4 KB)

User Avatar
Member
10 posts
Joined: Feb. 2018
Offline
ajz3d
Check this example out.

EDIT: Ah, ok. Seems like you already solved it.
Thank you for your different approach ! I really appreciate it Have a great day.
User Avatar
Member
10 posts
Joined: Feb. 2018
Offline
ajz3d
Check this example out.

EDIT: Ah, ok. Seems like you already solved it.

Hi again! Have you got any idea why after I click on the geo node you have created and use “RBD Objects” function from Rigid Bodies tab it breaks the colors and adds some new groups ?

I addes description to my problem by the side of particular nodes.

The loss of color happens inside Assemble node at the end in Attribute Wrangle Node called : add_name_attribute.

If you could help with my problem I would be sooo grateful. I can't sleep because of that

Have a great day!
Edited by PatrykC - April 16, 2018 14:39:20

Attachments:
ajz3d_randomize_materials2.hipnc (576.0 KB)

  • Quick Links