Version: 4.26, 中文
Created: 2021-02-25, Updated: 2021-03-25
Author: Cyanhall
👉  Cyanhall@GitHub Star me if it’s helpful.
1. Preparation This is the effect we are going to make in this tutorial.

Note: The main content of this tutorial comes from the Content Examples that come with Unreal Engine

Tip: Use ⬆️ ⬇️ to turn the page up and down. We recommend browsing with a large screen for a better reading experience.
Preparation
3. Introduction Expressions are small snippets of HLSL that can be used to create micro behaviors inline in the stack without needing to create new modules.

In this example, no modules are used to influence the simulation, only direct setting of variables in conjunction with expressions and dynamic inputs.
Introduction
4. Sim Target Select Emitter Properties, set Sim Target to GPUCompute Sim, and check Fixed Bounds.
Sim Target
5. Spawn Rate Click on the + sign to the right of the Emitter Update to add the Spawn Rate module.

Spawn Rate: Number of particles per second to spawn.
Spawn Rate
6. Spawn Rate Set the Spawn Rate value to 1000.0.

Spawn 1000.0 particle per second.
Spawn Rate
7. Emitter Update Parameter Add Set new or existing parameter directly module to the Emitter Update section.
Emitter Update Parameter
8. Emitter Update Parameter Add a Vector parameter.
Emitter Update Parameter
9. Emitter Update Parameter Rename this parameter to InitialPosition and set its value to Simulation Position.
Emitter Update Parameter
10. Emitter Update Parameter Add a Float parameter.
Emitter Update Parameter
11. Emitter Update Parameter Rename this parameter to ZOffset and set its value type to New Expression.
Emitter Update Parameter
12. Emitter Update Parameter Set ZOffset to sin(Emitter.Age)*56.
Emitter Update Parameter
13. Remove Initialize Particles Delete Initialize Particles module.
Remove Initialize Particles
14. Set Parameter Add Set new or existing parameter directly module to the Particle Spawn section.
Set Parameter
15. Particle Spawn Parameter Add a Vector parameter.
Particle Spawn Parameter
16. Particle Spawn Parameter Rename this parameter to RandomVector and set its value type to New Expression, then set its value to normalize(((( rand(float3(1.0,1.0,1.0) ))) * 2 ) -1 )
Particle Spawn Parameter
17. Particle Spawn Parameter With the same operation, adds a number of parameters to Particle Spawn:

Name: Lifetime
Type:float
expression: rand(1.5f) + 2.2f

Name:Position
Type: vector
Expression: Emitter.InitialPosition + Particles.RandomVector *rand(145.0f)
Particle Spawn Parameter
18. Particle Spawn Parameter Name: SpriteRotation
Type: float - NormalizedAngle
Expression: rand(1.0f)

Name: SpriteSize
Type: Vector 2d - float
Expression: rand(2.5f) + 0.5f
Particle Spawn Parameter
19. Particle Spawn Parameter Name: Velocity
Type: Vector
Expression: cross(Particles.RandomVector, float3(0,8,0)) * (float3(0.0f, 0.0f, Emitter.ZOffset) *0.2f) + (-1.0f * normalize(Emitter.InitialPosition - Particles.Position)*20)
Particle Spawn Parameter
20. Set Parameter Add Set new or existing parameter directly module to the Particle Update section.
Set Parameter
21. Particle Update Parameter Name: Color
Type: Linear Color
Expression: Particles.NormalizedAge < 0.333 ? float4(1,0.1,0.1,1) : Particles.NormalizedAge < 0.575 ? float4(0.1,1,0.1,1) : float4(0.1,0.1,1,1)

Name: Position
Type: Vector
Expression: Particles.Position + float3(0, 0, ( sin(Engine.Time) * 0.3f ))
Particle Update Parameter
22. Particle Update Parameter Name: SpriteSize
Type:Vector 2D
Expression: (1.0f - abs(Particles.NormalizedAge * 2.0f - 1.0f)) * 2.0f

Name: PhysicsForce
Type: Vector
Expression: 1-Particles.RandomVector * (length(Particles.Position - Emitter.InitialPosition)*0.25)
Particle Update Parameter
23. Particle Update Parameter Note that the namespace for PhysicsForce needs to be located in Transient
Particle Update Parameter
24. Particle Update Parameter With the same operation, adds a parameter to Particle Update:
Name: Position
Type: Vector
Expression: Particles.Position.z > Emitter.InitialPosition.z - Emitter.ZOffset ? Particles.Position : float3(Particles.Position.x, Particles.Position.y, Emitter.InitialPosition.z - Emitter.ZOffset)
Particle Update Parameter
25. Solve Forces and Velocity Add Solve Forces and Velocity module to the Particle Update section.
Solve Forces and Velocity
26. 🎉 Finish! 🎉 👉  Cyanhall@GitHub  Star me if it’s helpful.

Support Me: Patreon
Follow Me: Twitter, Reddit, Zhihu, Bilibili
🎉 Finish! 🎉
Comments
Preparation