Jump to content
starion83

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

Share this post


Link to post
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";

 

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×