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