cspears2002 Posted April 12, 2007 Share Posted April 12, 2007 point_instances.hipncI'm working on a tutorial out of the "The Magic of Houdini". At the object level, I have the following nodes: geo1, geo2, geo3, geo4, geo5. I'm going to assign the geometry in these nodes to points on a grid. In order to do this I created a node called cloud at the object level. I jumped inside the node and layed down a Grid SOP and attached a Point SOP to the grid. In the Point SOP, I clicked on the Particle tab and added an instance. The script used to select the geometry for the instance is /obj/geo`int(rand($PT)*5)+1` I can see how the script can select geo1. This would would happen if rand($PT) generated 0. However, isn't there a danger that the script would generate a geo6 if rand($PT) generated 1? This hasn't happened to any points on the grid. Is 0 <= results of rand < 1 ? I'm going to try to attach the file in question to this post. Quote Link to comment Share on other sites More sharing options...
old school Posted April 12, 2007 Share Posted April 12, 2007 There is virtually no chance that rand() will generate a zero or a one. If you are still concerned, you can always wrap the rand around a fit01() expression to tailor the results of rand(). Also look at the floor(), round(), int() expressions and other variants to cut down the upper range. 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.