I tackle an interesting problem - how to stay procedural in Houdini. As an example I used a suggestion from the Houdini Facebook Group - how to create a procedural "Make Circle" function.
By selecting parts of the Geometry by hand I have a problem in my prcedural chain. I tried to find a possible solution by using the VEX logic.
What are your thoughts about the presented solution? Do you have more ideas where a procedural approach is needed? It could be an interesting new series - Make it Procedural - where I take your ideas and find the VEX coding to implement it.


CREATED BY

DAVID KAHL

David is a Software Developer and VFX Artist based in Germany. Houdini has allowed him to combine his experience in 3D and scripting, taking both to new heights. He has a passion for sharing his knowledge and tries to do his very best to make a difference in the community.

More from David Kahl

COMMENTS

  • ThomasSpaceflower 7 years ago  | 

    Very helpful! Would love to see more!
    Thank you.

    • David_Kahl 7 years ago  | 

      Thanks for watching! :)

  • Radivarig 6 years, 9 months ago  | 

    Thanks for the video! This is how I solved it:
    1. First attribute wrangle (run over primitives), this returns points at center of each primitive
    ```
    addpoint(0, @P);
    removeprim(0, @primnum, 1);
    ```
    2. Second attribute wrangle (run over detail), 1th input is the subdivided polygon, 2nd is the center points wrangle from step 1.
    ```
    for (int i = 0; i < npoints (1); ++i) { // for center points
    int p = nearpoint (0, point (1, "P", i)); // get the same point from subdivided polygon
    foreach (int pr; pointprims (0, p))
    setprimgroup (0, "prims", pr, 1); //add prims surrounding point to a group
    }
    ```
    3. Lastly I used the free make circle asset from https://www.orbolt.com/asset/mifth::mifth_make_circle to convert these prims to circles.

    To get unique points for a circle without the make circle asset, step 2 would be:
    ```
    for (int i = 0; i < npoints (1); ++i) { // for center points
    int p = nearpoint (0, point (1, "P", i)); // get the same point from subdivided polygon

    int allPts[];
    foreach (int pr; pointprims (0, p))
    push (allPts, primpoints (0, pr)); // get all points from surrounding prims
    allPts = sort (allPts); // sort for comparing with last

    int pts[]; // unique points for circle
    foreach (int pt; allPts)
    if (pt != p) // if not center
    if (pt != pts[len (pts) - 1]) // ignore duplicates by comparing with last
    push (pts, pt);

    printf ("center %s, points %s\n", p, pts);
    // * last two for-loops from video to set pts on a circle
    }
    ```
    Cheers

    • OlafHaag 5 years, 11 months ago  | 

      I know I'm more than a year late to the party, but I just stumbled upon this, being new to Houdini and all. If all you wanted is a primgroup for the polygons around the center points for being used with the mifth_make_circle node, you can just exploit a unique property of the center points in this case: they're the only points with 5 neighbours.

      1. Attribute Wrangle:
      int nbs[] = neighbours(0, @ptnum);
      if(len(nbs)==5)
      {
      @group_centers = 1;
      }
      2. Group Promote node to promote the centers pointgroup to a primgroup.

Please log in to leave a comment.