A simple model for non-uniform diffusion of Houdini properties

Source: Internet
Author: User

A long time ago, when the wrath of the Lich King started animation, he was thinking about how the magic of the sword was done, and recently done a similar experiment to complete a simple property transfer model, which can be applied to heat transfer, corrosion or spread effect.

The principle of the model is to use the Pcfilter () function in the point cloud to make the target attribute a similar fuzzy diffusion, using the Solver in SOP to accumulate the fuzzy value, and to define if the value accumulates beyond a certain threshold and no longer increases, which results in the effect of diffusion. I also mentioned a method of diffusion in the previous gray Scott Reaction-diffusion article, but the method is more suitable for a certain sum of values to spread evenly between points, and now this method is an invasive type of diffusion.

The way to do diffusion is to define non-uniform methods, which can add more interest and make diffusion more natural. The method is to define a different diffusion rate for each point by noise. This diffusion rate is then multiplied by the diffusion value in the accumulation process. Noise patterns can produce a variety of different invasive and diffuse effects.

Before I passed the Solver, I defined the float heat (transfer property) at each point, float factor (transfer rate), int edge (to determine the diffusion edge) three properties, and set the point and factor value of the property diffusion in advance.

Below is the core code used in point wrangle under Solver:

//search The pre frame point cloud,//point number would affect the sensitivity of diffusionintHandle=Pcopen (1,"P",P, About,8);//get the global speedFloat speed=Chf"Speed");//get the Loacl speed of each pointFloat factor=[Email protected];float threshold= 1.0;//excute Diffusion fuction If the attribute is less than the thresholdif([email protected]<Threshold) {float influence=Pcfilter (Handle,"Heat"); [Email protected]+=Influence*Speed*Factor//the attribute value cannot be bigger than threshold        if([email protected]>Threshold) {[email protected]=Threshold }//define the Edge area        if([email protected]<Threshold&&[Email protected]> 0.03) {[Email protected]Edge = 1; }Else{[Email protected]Edge = 0; }}pcclose (handle); @Cd=Set ([email protected],0,0);

The code in fact, except for comments, basically about 10 lines, simple but efficient and effective is very good. Here is the main use of good pcfilter this function.

A simple model for non-uniform diffusion of Houdini properties

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.