Leaf pattern and vine growth algorithm in Houdini venation

Source: Internet
Author: User

Continue to follow the cgworkshops inside of the Shawn Lipowski study in Houdini wrote Vex, yesterday simply looked at him to do the plant growth of that lesson, understand a bit of thought began to write himself, I am not too accustomed to follow a step-by-step learning, On the one hand is not high efficiency and their own ideas are easy to be interrupted by video, it is difficult to make the effect of the same time also grasp its core, at best, is a tiger process, draw a shape but do not know its meaning. The idea of writing a program is most important, isn't it?

Implementation results:

To write their own algorithm, of course, some relevant academic articles for reference is absolutely indispensable, this algorithm I directly take the Shawn with the article, but the process because I and he on the effect of nutrition on the seeds of different effects produced some differences, of course, I still feel that my own understanding a little bit more, Let's talk about this later. This is the reference Paper link:

Http://algorithmicbotany.org/papers/venation.sig2005.pdf


Overall, the core of the algorithm is to divide the object into seeds seed and nutrient food/auxin, the seed in the growth process to find a certain radius of the nutrition of R, according to the location of the nutrition to determine the next growth position of the seed, while in the radius of R nutrients will consume clean, is all deleted, Of course, this r is less than R, otherwise the plant will not grow up.


Here are some notes based on the paper above, which basically covers the steps implemented in Houdini.

One thing to add here is the two different algorithms for determining the next growth position based on the nutrient location, the first of which is the Shawn Lipowski used to determine the growth direction vectors directly based on the average position of all nutrients found p_goal minus the current seed position. But this method is too ideal, I think in the actual process of nutrients in the location of the poor and fertile points, and the plant instinct is a bad behavior instinct. So I added a fertile degree of weight to the nutrient when I was determining the direction of growth. The differences between the two methods are briefly described.


Applications within the Houdini:



This is written in SOP Sovler, it wrote two point wrangle and a attrib wrangle.


Closest_seed is to determine the nearest seed point for each food. This seed point list can also directly determine which stores are the point at which the tops of the treetops can continue to grow.

int handle;int Seed_ptnum;Handle = Pcopen (1, "P", @P, 99999, 1); while(Pciterate (handle)) {Pcimport (Handle, "Point.number", seed_ptnum);I@seed = Seed_ptnum;}

Treetop_difine is primarily used to determine which of the seed points are the top of the branches, and the other points are not considered during the growth process, so that the criteria required to query the seed point cloud can make the query much smaller.

int handle;int Seed_ptnum;Handle = Pcopen (1, "P", @P, 9999, 1); while(Pciterate (handle)) {        Pcimport (Handle, "Seed", seed_ptnum);        if(@Ptnum == seed_ptnum) {                I@treetop = 1;        }Else{        I@treetop = 0;        }}

The above two are point wrangle nodes, but also for the growth of the preparation of a step, the next next_step_position is the growth of an important link to determine the next growing point location.

In determining the good growing point at the same time, increase the original growth points to the new line of the connection, so that the branches grow out.

float Food_radius = CHF ("radius");int Max_food = Chi ("Neighbours");float Step_length= CHF ("Step");int Prim;if(@treetop == 1){        int handle;        int Count_ptnum = 0;                Handle = Pcopen (1, "P", @P, Food_radius, Max_food);        if(Pciterate (handle) != 0){                Vector Target_goal = Set (0,0,0);                 while(Pciterate (handle)) {                        Vector food_position;                        float Fertility;                        Pcimport (Handle, "P", food_position);                        Pcimport (Handle, "Fertility", fertility);                        Target_goal += Normalize (food_position - @P) * Fertility;                }                if(Length (target_goal) >0.01){                Vector next_position = Normalize (target_goal) * Step_length + @P;                int Next_ptnum;                Next_ptnum = Addpoint (Geoself (), next_position);                Prim = Addprim (Geoself (), "Polyline");                Addvertex (Geoself (), Prim, @ptnum);                Addvertex (Geoself (), Prim, next_ptnum);                }        }}

The last step before the cycle is to remove the "depleted" nutrients, kill_exhausted_food, if there is no such a step, the branch will always be in situ spinning just fine, only eat their own home will think of others nest, this driving force is real. This Part I directly use nodes to achieve, flexible use of pop.


Finally, we attach the growth effect of the relationship between rich and poor, and feel that this algorithm is closest to the real world.

Leaf pattern and vine growth algorithm in Houdini venation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.