Page 48 - 3D World - October 2017
P. 48

TuTorials
          Grow procedural plants in Houdini

                                                                                                          use wrangle
                                                                                                          nodes
                                                                                                          Wrangle nodes are
                                                                                                          the Swiss Army Knife
                                                                                                          of Houdini. Adding
                                                                                                          attributes, sampling
                                                                                                          values, setting colours,
                                                                                                          removing points, can
                                                                                                          all be done in a single
                                                                                                          line of VEX.


              finAl foRce                                      soften the chAnge
          11Add the last force to the VEX loop by sampling   12 The vines still don’t look natural. This is because
          the value and gradient VDB of the ruin. This gives you   they can change direction rapidly on each step. Soft
          the distance between point and wall as well as the wall’s   blend between the directions of the previous and the
          normal direction. Calculate a force that points towards   current step to smooth that out. You also want to stop
          the wall and add it to the grow direction. Sample the VDB   growing if the position moves too far off the walls. See if
          a second time in the new position to check if the point is   the wall distance you get from the VDB sample exceeds a
          inside the wall. If so, just push it out along the normal.  certain threshold. Just break out of the for loop if it does.



                                                                                                bRAnching
                                                                                           13 behAviouR
                                                                                           Another aspect of climbing
                                                                                           plants we still have to add
                                                                                           – branching. But this is very
                                                                                           straightforward to achieve. Tag
                                                                                           each growth step with a certain
                                                                                           probability to be a branch
                                                                                           point. Then run the growth
                                                                                           algorithm again on each of
                                                                                           those marked points, using the
                                                                                           point itself as the root.
                                                                                              It’s a good idea to tweak
                                                                                           the growth parameters on
                                                                                           the second pass in order to
                                                                                           be more wandering and less
                                                                                           upwards, to fill up the areas
                                                                                           along the walls.




















               finish the bRAnches                                             instAnce the leAves
          14 We now have created sequences of points resembling branch growth.   15 Instancing leaves works a bit like the grass strands
          Make use of the id attribute on the point and create an Add node to turn them   earlier. We define a distribution attribute along the curves
          into individual curves.                                         coming out of the growth algorithm. This is zero at the
            A UV Texture set to Rows&Columns will provide uvs along the curve length,   start of each branch and then 1 at the tip. Use a scatter
          which you then ramp along their individual length to an attribute called pscale.   to place points along the curve based on that attribute.
          A Polywire node turns curves into tubes where you use $PSCALE for thickness.   It looks better to vary the pscale. Use a copy stamp to
          Add a Mountain and a Facet after, to finalise the branches.     instance the prepared leaves onto those points.

                                        3D WorlD  October 2017  48   www.youtube.com/3dworld
   43   44   45   46   47   48   49   50   51   52   53