gany_1985 Posted February 4, 2011 Share Posted February 4, 2011 hi there, i m a bit new to houdini.. i m trying to copy a box with 3 colors on to a grid with variation in the three colors.. so i connected them to switch ..and stamped a variable..( color - rand($PT*3)) on to the switch.. i get only the first two r only two colors.. the third color is not appearing.... i had attached the file also.. kindly help me with this problem cheers, Ganesh l copy.hipnc Quote Link to comment Share on other sites More sharing options...
Macha Posted February 4, 2011 Share Posted February 4, 2011 (edited) Try this: rand($PT)*3, or this: fit01(rand($PT),0,2), or trunc(rand($PT)*3) The reason is that you supplied a random number between 0-1 and the switch automatically rounds it to either 0 or 1. rand($PT*3) will give you the same range as rand($PT) but with a different initial condition. Edited February 4, 2011 by Macha Quote Link to comment Share on other sites More sharing options...
gany_1985 Posted February 4, 2011 Author Share Posted February 4, 2011 Try this: rand($PT)*3, or this: fit01(rand($PT),0,2), or trunc(rand($PT)*3) The reason is that you supplied a random number between 0-1 and the switch automatically rounds it to either 0 or 1. rand($PT*3) will give you the same range as rand($PT) but with a different initial condition. thank u Macha... it worked. Quote Link to comment Share on other sites More sharing options...
Darric Posted February 4, 2011 Share Posted February 4, 2011 Be sure to go with the "trunc" example Macha provided - always be careful with rounding if you want even distributions, because unless you're using floor or trunc you're probably going to end up with uneven amounts on your first/last inputs: Remember, if you're generating random values between 0 and 3, then twice as many of those values round to 1 and 2 as do to 0 and 3. Quote Link to comment Share on other sites More sharing options...
gany_1985 Posted February 4, 2011 Author Share Posted February 4, 2011 thank u Macha... it worked. i have another problem.. In my asset i have grid where the user should be able to paint boxes on the grid as per his wish........... i used group paint option and i m able to paint the boxes but how do i expose the painting option in asset so that user can paint the boxes 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.