1. Use the Niagara particle system to achieve the rain effect
1. First create a rainwater material
New - Material
2. Create Niagara system
- new build
New - FX - Niagara System - New System from Selected Emitter - Next - Select Fountain - Click the + sign, click Finish
- Delete "Add Velocity in Cone" below
- Add "Add Velocity"
click the plus sign and add
so that the particle effect becomes downward emission
- configuration
- Added "box location"
setting to the rain scene range - range adjustment
- Make the particle effect more like rain
- Let the direction of the raindrops be downward, change the material of the raindrops
- Setting the number of particles affects the size of the effect. To change the effect of rainfall later, this parameter is dynamically modified.
- In addition, it can be set to use the GPU to calculate the simulation, which also needs to set a fixed boundary
. Here, the effect of rain has been realized.
2. Expose particle parameters to realize dynamic modification of particle effects
-
- First, add a parameter to the particle and select the floating point type. You can set the default value on the right side, because if you want it to be 0 initially, you don’t need to set it.
Then drag and drop this parameter to the line below
so that the parameter is set successfully and can be called and modified outside.
- First, add a parameter to the particle and select the floating point type. You can set the default value on the right side, because if you want it to be 0 initially, you don’t need to set it.
-
- Create a new blueprint, store the Niggara particle system, and add a click event
Among them, the slider_rain behind is the ui window used to control the change of rainfall over time
- Create a new blueprint, store the Niggara particle system, and add a click event
-
- Create the slider_rain
interface:
Method:
Here, the rainfall changes as the slider drags the time node.
Renderings:
- Create the slider_rain
3. When the rain becomes heavier, other effects will be triggered accordingly
To achieve this effect, you need to call the parameters of the rain. The problem encountered is that the parameter after this value change does not know how to call it elsewhere. The solution is: use the event dispatcher.
Create an event dispatcher in slider_rain to receive the changed rain parameter, and then call it where needed.
Call parameters, judge by the if condition to make the stone break when the rainfall is greater than 3000 (called in the level blueprint):
ps: The effect of stone breaking can be used by searching for the ue4 broken plug-in.