Particle System: Draw a tree from scratch, and the particle starts from scratch.
IDE: Visual Studio 2017
Language: VB. NET/C #
Graphics API: Win2D
Game Engine: ExperDot. EDGameEngine
This article will introduce you to a simple method for simulating plants with a particle System (Partical System.
Section 1 move
Particles move according to certain rules and keep moving tracks.
Targeted Movement
The particle has an initial speed
Particle gradient
The rendering radius of the particle gradually decreases, and the rendering color gradually decreases.
Direction offset
The particle is always shifted to a certain direction.
Random disturbance
Random force of particles on any side
Figure 1-1 targeted Movement
Figure 1-2 gradient
Figure 1-3 redirection
Figure 1-4 disturbance
Section 2 split
Existing particles are randomly split into several new particles.
Direction offset
When split, the new particle's velocity direction is deflected, and the moving track will generate forks.
Particle deceleration
When split, the moving speed of new particles decreases, and the moving track becomes shorter and shorter.
Figure 2-1 forks
Figure 2-2 deceleration
Section 3 freedom
Now, you can adjust the parameters at will!
Figure 3-1 straight line
Figure 3-2 line chart
Figure 3-3 Curve
Appendix
Open source code. The following blog is another implementation method of the natural tree.
Open source link: EDGameEngine. Vitamins ALS. participant. Tree
Related blog: programming simulation (I): how to draw a static tree
Related blog: programming simulation nature (3): better static Tree Algorithm
Related blog: programming simulation nature (6): how to draw a dynamic tree