Unity VFX -- (3) Create an environmental particle system

        One of the most common and important usage scenarios of particle systems is to implement weather effects. With only a few modifications, the scene can quickly change from blue sky and white clouds to snowflakes.

         Unlike previously seen particle systems that emit particles from a single source, the weather effect completely surrounds the scene.

Add and place a new particle system

        To create a rainy or snowy weather effect, first we create a new particle system object and place it in the sky so that its particles emit from the sky towards the ground.

        1. In the project window, go to Assets > CreativeCore_VFX > Scenes and open the TutorialScene_VFX_Outdoor scene.

        2. In the Hierarchy window, right-click and select Effects -> Particls System

        By default, this creates a particle system that emits particles into the sky. 

        3. In the Hierarchy, right-click the newly created particle system, select Rename, and rename it to FX_Snow or FX_Rain.

        FX is the abbreviation of Effects. We may also see SFX, which stands for Special Effects.

        4. We want the example system to look from the sky towards the ground. In the Transform component of the particle system game object, set its Position to X=0, Y=10, Z=0, and set its Rotation to X=90, Y=0, Z=0.

         5. Click the Run button to preview the effect. Currently the effect looks a little bit like a weather effect, but it still needs some fine-tuning.

Configure main module properties

        A particle system is controlled by a series of different modules, each of which controls different aspects of the particle system. In the Inspector, the first module is the main module. This is the first module we will edit and it contains the most important particle properties such as size, velocity and lifetime.

        1. The main module is the first module of the Particle System component. Its name is the same as the name of the game object (FX_Snow in this example). Click it to expand it.

        2. In order to modify the size of the particles, adjust the Start Size property in the main module. In this case, set it to 0.1 for small snowflakes.

             There is Start in the name here, indicating that we also have the ability to adjust the size of the particles over time. The picture below is a comparison of the effect when the Start Size is 1.0 and 0.1

        3. We can use Start Speed ​​to modify the speed of the particles. In the example, we lowered it from 5 to 1 to make it look like it is falling slowly. For raindrops, you can increase this speed appropriately.

         But now we will see a problem, the falling speed of "snowflakes" has slowed down, but it seems that they can't fall to the ground.

        If we increase the Start Speed, such as modifying it to 10, the snowflakes will also pass through the ground at a faster speed

        4. To solve this problem, we need to adjust the particle's lifetime (lifetime) property. Let's keep the particle speed down again, and adjust the Start Lifetime from 5 seconds to a higher value, so that the "snowflakes" appear to be falling just right to the ground (maybe passing through the ground a little bit).

 

        Click the run button to see the effect, at this point we will find a serious problem. After the scene runs, we have to wait a long time to see the snowflake effect. This is because the particles are generated from a height and slowly fall down.

        5. In the main module, we enable the Prewarm property. This property indicates that when the scene starts, the particle system will go through a complete cycle in advance. Check it again to see the effect.

        Next, we're going to configure the other modules so that the particles move down in the same direction.

Configure the Shape and Emiision modules

        First, let's look at the Shape and Emission modules that are enabled by default when creating a new particle system.

        These two modules work together to control how many particles are emitted (Emission), and the shape of the container from which the particles are generated (Shape).

        First, we modify the shape of the particle to be flat, rectangular, and resemble a cloud.

        1. Expand the Shape module, pay attention to observe the scene view at this time, we will see a cone-shaped thing. We change the Shape property from Cone to Box.

wAAACH5BAEKAAAAAAAAAABAAEAAAICRAEAOw== edit

        Now the cone-shaped thing has become a box. Note that the size and direction of the snowflakes falling have also changed. But now the box is still too small, we need to resize it.

        Note: If we can't see the appearance of this cone or box, we need to enable the Gizmos in the upper right corner of the scene view.

        2. Increase the size of the box by changing the Scale property of the Shape, setting it to X=10, Y=10, Z=1

         At this time, the "snowflakes" falling were more scattered, but they also looked sparser. We want to increase the emission rate of the particle system.

        3. Expand the Emission module, increase the Rate Over Time attribute, increase from 10 examples per second to about 150-1000 examples, and adjust this value according to the effect we want to express.

        At this point we can see that the "snowflakes" have become denser, but a new problem has emerged. The appearance of "snowflakes" turned into segments, which looked very strange.

         This is because the number of particles on the screen has exceeded the maximum number of particles limited by the particle system.

        4. In the main module, change the Max Particle property from 1000 to 10000, so that the above problem can be solved.

        Now it seems to solve the problem, but the values ​​of Emission Rate and Max Particles are huge. In actual projects, the performance consumption of doing so will make the running machine enough to drink a pot. In actual projects, a very big job of VFX artists is to ensure that the performance is optimal when the visual effects are good enough. The solution we are currently using will obviously reduce the performance of the application (something about VFX performance optimization is out of the scope of this note).

        At present, the "snowflake" looks better, but the shape of a single snowflake is a circle, not like the shape of a snowflake.

        Below we use the Renderer module to solve this problem.

Configure the Renderer module

        The last module to modify (and the one enabled by default) is Renderer. This module controls how the particle is drawn, including its texture.

        Currently our "snowflake" is using the default ParticlsUnit material.

        1. Expand the Renderer module, and at the Material property, click the circular selection button and select SnowMaterial (if it is a raindrop effect, select RaindropMaterial).

        After modification, see the effect.

Guess you like

Origin blog.csdn.net/vivo01/article/details/130178912