starion83 Posted February 9, 2021 Share Posted February 9, 2021 (edited) 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 February 9, 2021 by starion83 solved problem Quote Link to comment Share on other sites More sharing options...
starion83 Posted February 9, 2021 Author Share Posted February 9, 2021 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"; Quote Link to comment Share on other sites More sharing options...
anim Posted February 10, 2021 Share Posted February 10, 2021 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 Quote Link to comment Share on other sites More sharing options...
starion83 Posted February 11, 2021 Author Share Posted February 11, 2021 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.