Legacy/Visual Effects: Lesson 08: Using Depth Buffer Collisions with GPU Particles

From UE4: Community Wiki
Jump to: navigation, search

Depth Buffer Module Setup and controls

GPU Particles support Depth Buffer Collision, using the Collision (Scene Depth) Module in Cascade.

LetÔÇÖs add a Depth Buffer module to any translucent particle system you may have available from the previous lessons. I am using a spark emitter I have around from another project.

Depth buffer collision is only supported for translucent materials, masked and opaque materials contribute to the buffer and cannot collide with it.

8 1.png

8 2.png

The module is fairly straight forward, and each option has well written descriptions of what the feature does.

Resillience ÔÇô controls how bouncy the particle is. This can be mapped to a uniform distribution for variation.

You can see the difference in response between these two images. Note the difference in the Max field changes from 1, which is very bouncy, to .1 which nearly sticks to the surface.

8 3.png

8 4.png

Friction ÔÇô Controls how much particles will grip or slide when colliding with a surface.

In the first image you can see the particles have a tendency to clump up near the point of contact with the surface which is tilted at ~30 degree angle. In the second image the lower friction allows the particles to maintain more of their original velocity and slide more easily.

8 5.png

8 6.png

Radius Scale - offsets your particles from the surface with which they are colliding. This is a good way to offset larger sprites if, for example, you are unhappy with surface interpenetration.

It is important to keep in mind that the collision of a particle is based on its radius, or rather its size, so changes to Size and Radius Scale can both affect the offset between a particle and surface. In the following examples, you can see how increasing size also increases the offset, making the particles further from the surface despite having the same Radius Scale.

Size 2.0 Radius Scale 10

8 7.png

ÔÇâ Size 30 Radius Scale 10

8 8.png

All Translucent GPU particles with the Depth Buffer Module applied will show this type of behavior when colliding with Opaque or Masked materials.

If you want to see the surfaces Particles will collide against, and how the surface normal impacts evaluation use the Buffer Visualization tool

8 9.png