...

/

Signed Distance Functions (SDF)

Signed Distance Functions (SDF)

Learn what a signed distance function is and how to make your own in PyTorch.

The signed distance function

The signed distance function (SDF) is a lesser-known but elegant 3D data representation. While PyTorch3D doesn’t directly implement signed distance functions, they’re becoming more popular due to a few interesting properties.

What is a signed distance function?

A signed distance function (SDF), is a mathematical expression of a 3D scene that computes the distance dd between a given point pp and a surface in a given space. The SDF is a function that takes a position pp as an input and returns a scalar value dd, with positive values representing distances outside the surface and negative values representing distances inside the function. This is where it gets the name signed distance function.

Where:

  • d<0d < 0 for points inside of the surface.

  • d=0d = 0 for points along the surface.

  • d>0d > 0 for points outside of the surface.

Many primitive shapes can be defined with closed-form mathematical expressions as an SDF. For example, the SDF of a sphere of radius RR centered at point (0,0,0)(0, 0, 0) can be expressed as:

where ...