Rasagar/Library/PackageCache/com.unity.visualeffectgraph/Documentation~/sdf-in-vfx-graph.md
2024-08-26 23:07:20 +03:00

1.9 KiB

Signed Distance Fields in the Visual Effect Graph

Signed Distance Fields (SDF) are 3D textures where each texel stores the distance from the surface of an object. By convention, this distance is negative inside the object and positive outside. SDFs are useful for creating particle effects that interact with complex geometry.

Using SDFs

In the Visual Effect Graph, there are several nodes that use SDFs to create effects:

Generating SDFs

There are multiple ways to generate an SDF for use in a visual effect:

  • You can generate SDFs in the Unity Editor using a window, and generate SDFs at runtime using an API, with the built-in SDF Bake Tool tool. For more information, see SDF Bake Tool
  • You can bake SDFs with the Houdini Volume Exporter bundled with VFXToolbox (located in the /DCC~ folder).

Limitations and Caveats

The SDF Bake Tool, both the window and the API, generates normalized SDFs. This means the underlying surface scales such that the largest side of the Texture is of length 1. Remember this if you use Operators such as Sample Signed Distance Field.