Jump to content

Assign materials w probability [SOLVED]


Recommended Posts

Hi everyone,

I'm trying to assign materials to a set of objects (each with a unique name attrib). But instead of randomly applying materials, I'd like to weight the application of materials, so that for example 10% have mat1, 40% have mat2 and 40% have mat3.

My first thought is using for each piece + vex with if else for weightings? Or is there an easier way I'm not aware of?

Thanks in advance!

 

Edited by starion83
solved problem
Link to comment
Share on other sites

Looks like what I was missing is the assignment of material path. with s@shop_materialpath = "....";

A weighting of 10% / 90% can be achieved by looping over objects with vex:

if(rand(@class) < 0.1)
    s@shop_materialpath = "/mat/Test1";
else
    s@shop_materialpath = "/mat/Test2";

 

 

Link to comment
Share on other sites

22 hours ago, anim said:

you can also use Attribute Randomize in Custom Discrete mode of String type to create shop_materialpath attribute, it will allow you to specify weight for each string value

and put class in Options/Seed Attribute parameter

Thank you Tomas! I'll give this a try

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...