This property is key to features like Distance Field Ambient Occlusion as a small number of cones can compute a soft visibility for the entire hemisphere of a receiver point.įor thin surfaces, they can only be represented with a negative texel inside the mesh, which is necessary for finding its root. This approximation makes it possible to do very soft area shadows and sky occlusion using distance fields. The second property that makes SDF useful is that when you trace a ray, by tracking the closest distance a ray passed by an occluding object, an approximate cone intersection can be computed with no extra cost. By ray tracing a distance field, a visibility result is produced, meaning that if the ray intersects the mesh, the light will then be shadowed. This allows the intersections to be determined with a small number steps. The first property of SDF that make them useful is that when tracing a ray, you can safely skip through empty space as the distance to the nearest surface is already known (this is sometimes called Sphere Tracing). In the example below, the positive distances are being traced and stored to represent the tree later on.
For every point on the exterior of the mesh is considered positive distance and any point inside the mesh stores a negative distance. It works by storing the distance to the nearest surface in a volume texture. To represent a Static Mesh's surfaces, a Signed Distance Field (SDF) is used. In addition to that, the Mesh Distance Field representation of an Actor can be used for other features like GPU particle collision or even with the Material Editor to create dynamic flow maps and much more.Ĭontinue reading below to learn how Mesh Distance Fields work in UE4 and some of the ways you can use it in your games. Unreal Engine 4 (UE4) leverages the power of Distance Fields to have dynamic ambient occlusion and shadowing for Static Mesh Actors in your games.