Jump to content

stamping problem on switch


Recommended Posts

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

Link to comment
Share on other sites

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 by Macha
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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. ;)

Link to comment
Share on other sites

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

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...