Assign different shaders todifferent primitives procedurally

   1792   2   1
User Avatar
Member
14 posts
Joined: Oct. 2008
Offline
Hi,

i created 20 shaders called :
Cam_v1_Test_Comp_00,
Cam_v1_Test_Comp_01,
Cam_v1_Test_Comp_02, ecc…


and i'm tring in SOP to assign a different shader to each of my 20 primitives based on the $PR primitive number…

For this i'm using a Material Sop with this expression int the Material:

/shop/Cam_v1_Test_Comp_0`$PR`

The problem is that all the primitive get /shop/Cam_v1_Test_Comp_00 assigned to them and i don't understand why.

if i use the copy sop to create the primitives and i stamp a variable based on $PR before the copy it works…but it's not what i need in this specific case.


Any idea?

Thanks
Sergio
User Avatar
Member
45 posts
Joined: June 2009
Offline
Hi,

not sure, but I think that the material Sop doesn't support local variables.

The material sop help says:

Under the hood, the node creates an attribute named shop_material and sets it to the pathname of the material. The scene viewer and mantra use the attribute

You can create the string-type primitive attribute called shop_material and give a value based on groups. Should work.
User Avatar
Member
14 posts
Joined: Oct. 2008
Offline
Thanks…

it works perfectly….

i just created a string primitive attribute called shop_materialpath with an attribute create sop , and wrote my expression there…

Cheers
Sergio
  • Quick Links