Put down a sphere and append a 'for each number'. This page is a quick overview for folk who haven't used the different for loop types much, and don't have time to sit through the full video. :) It's worth making time though, its very good, and covers lots of interesting edge cases: Run a process multiple times Note that this is all covered in way more depth and in much higher quality in Jeff Lait's masterclass. In H16 for each loops were a little obtuse, in H16.5 some presets have been added to make it easier, we'll go through each. looping over every uniquely named thing in your geometry.įor-each loops can handle all these cases.looping over every prim/point in your geometry,.12 De-intersect a scatter with heavy geometry.Int near_pts = pcfind_radius(0, "group_name","P", "pscale", 1. Int near_pts = pcfind_radius(0, "P", "pscale", 1.0, max_dist, max_pts) The cool thing about this is that we can easily use the pscale as radius for the search and search just in a specific group of //points The cool thing is that it returns directly an array and not a //point cloud. Int neighbour_points = you are a fan of point clouds there is also a function called pcfind_radius. Int nearpoint = (0, There is also the neighbours function which gives us a list of points connected to the point through some sort of primitives. But as before if we run it in the same //geometry, we are not going to get the real closest point There is also the nearpoint function which returns just an integer with the closest point. Int closest_point = near_pts //take the second element of the list, so index number 1 Int near_pts = max_dist, max_points) // create a list of all points in the radius until reaches max_points the first, but the second element in the list (which has index number 1). If we need the real closest point, we have to take not For Houdini the closest point in the same geometry is going to be itself. If we look at the closest point in the same geometry coming from the first input ( so input number 0) there is another thing to keep in // mind. Pay attention that this function returns a list of all the points, so returns an array (that's why I added to the attribute name). We can specify how far we search and the maximum amount of points Nearpoints function returns the closest points to the current. Int inst = uniqueval(0,"point","sourcept", i) //the unique value at index inst) //put all the unique values in an array called There are several ways to find the closest points and there are a couple of things to keep in mind Int n = numiqueval(0, "point", "sourcept") //the amount of unique values in the attribute "sourcept" For some reasons we don't know the number of source //particles, but we need to know their values and put all of them in an array. Each //sourced particle is storing the point number of the particle it's sourced from. Let's say in this case let's say we have a certain number of particles sourcing 100+ particles each. For example if the unique values are 9 and in the function you put 9 as index, is // going to return the 9th and last unique value uniqueval returns the unique value at a certain index. numiqueval is going to return the integer number of unique values stored in an attribute I haven't used this a lot but I've found "numiqueval" and "uniqueval" useful a couple of times, especially for loops.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |