ue4 uses Niagara particles to achieve rain effects, and uses blueprints to adjust rainfall

1. Use the Niagara particle system to achieve the rain effect

1. First create a rainwater material

New - Material
insert image description here
insert image description here

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
    insert image description here
  • Add "Add Velocity"
    click the plus sign and add
    insert image description here
    so that the particle effect becomes downward emission
    insert image description here
  • configuration
    insert image description here
  • Added "box location"
    insert image description here
    insert image description here
    setting to the rain scene range
  • range adjustment
    insert image description here
  • Make the particle effect more like raininsert image description here
  • Let the direction of the raindrops be downward, change the material of the raindrops
    insert image description here
  • Setting the number of particles affects the size of the effect. To change the effect of rainfall later, this parameter is dynamically modified.
    insert image description here
  • In addition, it can be set to use the GPU to calculate the simulation, which also needs to set a fixed boundary
    insert image description here
    . Here, the effect of rain has been realized.

2. Expose particle parameters to realize dynamic modification of particle effects

    1. 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.
      insert image description here
      Then drag and drop this parameter to the line below
      insert image description here
      so that the parameter is set successfully and can be called and modified outside.
    1. Create a new blueprint, store the Niggara particle system, and add a click event
      insert image description here
      Among them, the slider_rain behind is the ui window used to control the change of rainfall over time
    1. Create the slider_rain
      interface:
      insert image description here
      Method:
      insert image description here
      Here, the rainfall changes as the slider drags the time node.
      Renderings:
      insert image description here
      insert image description here

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.
insert image description here
Call parameters, judge by the if condition to make the stone break when the rainfall is greater than 3000 (called in the level blueprint):
insert image description here
ps: The effect of stone breaking can be used by searching for the ue4 broken plug-in.

Guess you like

Origin blog.csdn.net/m0_46538057/article/details/127887851