Demo Scene - Physics

 

Point Physics

 

The location data of every Point (stored in a RenderTarget) will be cached for the next update and passed into the Material set on the PCA Data Asset to provide it as a LastLocations TextureParameter. Using the difference to the current location and the DeltaTimeAnimation parameter a velocity can be calculated. To have the velocity of a Point opens up a physical based position update that uses forces. All the physics calculations done in the Material, which means it runs completely on the GPU!

This scene is an example of a physical based Point Cloud. In Play mode you can shoot (LM) a ray on the Point Cloud or throw a ball (RM). The Points will be pushed away by forces and even so there is no Point to Point collision, it is not difficult to test against simple geometry like a plain (which is also done in the Material). Even for high Point counts the impact on the frame rate, on a modern Graphics Cards, is minimal.

The Gravity, Force, Mass, Friction and Scatter can be changed at runtime. With higher friction the Points will lose their momentum faster without a force applied. With a higher scatter value, Points will deviate by random from their direction, this can be used to look more like leaves in the wind falling slowly down. For physical based Point Clouds it is important to always use a RGBA32 Render Target format otherwise the precision is not high enough.

 

If you take a look at the PCA_SphereTwoRayScatterGravity_Physics Data Asset, there are a lot of parameters that can be set (typical for physics simulations). To keep the Material organized, Material Functions were used (see MAT_SphereRayScatterGravity_Physics). A lot of examples can be found in “Examples / PointCloudAnimations / Physics” for PCAs and “Examples / Materials / AnimatePointCloud / Physics” for Materials.

Take a look at the scripting in the Level Blueprint,  see how easy it is to apply the data and forces to the a Point Cloud (look into the UpdateRayData function for example).