Search⌘ K

Signed Distance Functions (SDF)

Explore the concept of signed distance functions (SDF) as a 3D data representation. Understand how SDF encodes surface geometry and normals, and learn the sphere tracing algorithm for rendering. Discover the benefits and challenges of using SDFs in 3D machine learning, and implement basic SDFs using PyTorch concepts.

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 ...