copy material to each primitive

   3763   4   0
User Avatar
Member
143 posts
Joined: March 2014
Offline
Hi all,

What is the best way to assign a different material to each primitive on a mesh and then randomize a few different parameters? Basically I want to “copy stamp” a material and have a few different parameters be randomized for each primitive - like change the color for each primitive, or change the specularity for each primitive. Is possible without doing some arcane vex or python programming?

~Caesar
User Avatar
Member
918 posts
Joined: March 2014
Offline
Hi Caesar,

this isn't copying materials to different primitives, but you could add various attributes to your mesh to drive the shader. For instance, add a random color to your mesh using the color SOP set to primitives and random. Then in the shader use the bind VOP to access the attribute (enter the attribute name) and plug that into the color slot of the shader.

edit: There's of course the material style sheets and some CVEX, which is shown in one of the latest master classes, if I'm not mistaken.

I hope this helps.

Andy
Edited by - March 4, 2016 16:51:42

Attachments:
random_color_in_a_shader.hip (319.5 KB)

User Avatar
Member
143 posts
Joined: March 2014
Offline
Andy this is great - thank you for the generous reply.

~Caesar
User Avatar
Member
143 posts
Joined: March 2014
Offline
Style sheets - very cool. Here's an elementary test randomly overriding the diffuse, opacity, emission and metallic-osity.

Attachments:
glass_sphere_test.png (808.2 KB)
princi.png (627.6 KB)
002glass_styles.020_.hiplc (558.1 KB)

User Avatar
Member
86 posts
Joined: Oct. 2013
Offline
Thanks for sharing
restposition.co.uk
  • Quick Links