# What are Signed Distance Field (SDF) and IsoOffset

## Recommended Posts

Hello all,

can you guide me in simple terms:

1. what is a Signed Distance Field (SDF)? & why we create it ?

2. And what is IsoOffset? & why we create it ?

Edited by sultan

##### Share on other sites

SDF can be used to get the distance and direction towards the surface. isoOffset can create the SDF.

##### Share on other sites

SDF can be used to get the distance and direction towards the surface. isoOffset can create the SDF.

But from which point towards the 3d surface ?

i mean what is the source from where the distance is calculated ?

Also in what direction ?

##### Share on other sites

I'm pretty interested in this as well, can anybody explain it in non simple terms?

What exactly is an isoOffset?  Is an SDF expensive to calculate and store, memory or general performance wise?

I use this things a lot but I still have trouble trying to visualize the numbers.

##### Share on other sites

A couple of pointers

In mathematics and applications, the signed distance function of a set Ω in a metric space, also called the oriented distance function, determines the distance of a given point x from the boundary of Ω, with the sign determined by whether x is in Ω. The function has positive values at points x inside Ω, it decreases in value as xapproaches the boundary of Ω where the signed distance function is zero, and it takes negative values outside of Ω.

And of course, Side Effects own docs

https://www.sidefx.com/docs/houdini14.0/nodes/dop/volume

##### Share on other sites

basically the sign distance field of an object is exactly what it's name mean.

Field       = a 3D grid where you store data

Distance = in this grid you store a scalar (float) value that contain the distance beetween the point P you evaluate in the grid and the closest point located on the surface of the object Cp

Sign       = because this value can be either positive if the point is outside the object or negative if the point is inside the object

so if at

- P1 the SDF value is -5 you know that the point P1 is inside the object at a distance of 5 unit to the object surface

- P2 the SDF value is 0 you know that the point  P2 is on the object surface

- P3 the SDF value is 3 you know that the point  P3 is outside the object at a distance of 3 unit to the object surface

IsoOffset like VDB or FluidSource can be use to create a SDF . isoOffset tend to be legacy imo

- FluidSource and VDB are more popular and faster to create SDF

EDIT : Jordi was faster than me ...

Edited by sebkaine

##### Share on other sites

A couple of pointers

In mathematics and applications, the signed distance function of a set Ω in a metric space, also called the oriented distance function, determines the distance of a given point x from the boundary of Ω, with the sign determined by whether x is in Ω. The function has positive values at points x inside Ω, it decreases in value as xapproaches the boundary of Ω where the signed distance function is zero, and it takes negative values outside of Ω.

And of course, Side Effects own docs

https://www.sidefx.com/docs/houdini14.0/nodes/dop/volume

Yes, this definition is in  https://en.wikipedia.org/wiki/Signed_distance_function

But its very mathematical

Also, the Sidefx doc is not in simple terms.

Here...

example_sdf.hip

• 1

##### Share on other sites

Yes, this definition is in  https://en.wikipedia.org/wiki/Signed_distance_function

But its very mathematical

Also, the Sidefx doc is not in simple terms.

If you don't look at the formulas for a second you will see it is actually a simple concept and explanation.

Translation

determines the distance of a given point x from the boundary of Ω

determines the distance of a given point x from the surface

where outside is positive, inside negative and in the surface is zero.

that is all.

• 1

##### Share on other sites

basically the sign distance field of an object is exactly what it's name mean.

Field       = a 3D grid where you store data

Distance = in this grid you store a scalar (float) value that contain the distance beetween the point P you evaluate in the grid and the closest point located on the surface of the object Cp

Sign       = because this value can be either positive if the point is outside the object or negative if the point is inside the object

so if at

- P1 the SDF value is -5 you know that the point P1 is inside the object at a distance of 5 unit to the object surface

- P2 the SDF value is 0 you know that the point  P2 is on the object surface

- P3 the SDF value is 3 you know that the point  P3 is outside the object at a distance of 3 unit to the object surface

IsoOffset like VDB or FluidSource can be use to create a SDF . isoOffset tend to be legacy imo

- FluidSource and VDB are more popular and faster to create SDF

EDIT : Jordi was faster than me ...

Nice explanation sebkaine Thanks

But what is the "use" of creating such a surface ?

##### Share on other sites

Here...

Thanks ChristianW

1)

So in order to place the particles on the geometry (with multiplier exposed to animate the effect), you created SDF of the object right ?

Basically getting the SDF of the geometry gives us what kind of freedom to perform what kinds of effects ?

i mean in which cases one has to think of creating SDFs of the geometry ?

2)

And sebkaine  mentioned that IsoOffset (like VDB and FluidSurface ) are used to create SDFs, then what is the use of creating FogVolume in IsoOffset ?

##### Share on other sites

Fog volume is just density, so fog... or whatever volumous kinds of things you want to create. Of can use it to just scatter inside of an object rather than surface etc..

SDF is invaluable! So you could create your own collisions using them, have blood drip over an object, use it to calculate a follow path, I recently used it to calculate denting between vehicles, endless...

You just need to start using them, then you'll work it out. Just think of it as supplying a vector with magnitude to the surface of an object. Then next time you want to do something that requires that re-visit this thread.

Ohh you could use it for booleans as well. Once you understand what they are you'll figure out loads of stuff.

##### Share on other sites

Fog volume is just density, so fog... or whatever volumous kinds of things you want to create. Of can use it to just scatter inside of an object rather than surface etc..

SDF is invaluable! So you could create your own collisions using them, have blood drip over an object, use it to calculate a follow path, I recently used it to calculate denting between vehicles, endless...

You just need to start using them, then you'll work it out. Just think of it as supplying a vector with magnitude to the surface of an object. Then next time you want to do something that requires that re-visit this thread.

Ohh you could use it for booleans as well. Once you understand what they are you'll figure out loads of stuff.

Thanks ChristianW

SDFs provides a vector with magnitude of what ?

Hmm.. m jus curious to know the cases where one has to create SDFs.

coz m still figuring out ways to use them and still the concept of utilizing them is still unclear.

##### Share on other sites

SDF is great for anytime you need to know if a point is within a volume.  You basically look up a point in the SDF and it will return a value based of the Signed Distance from the surface of the volume nearest the point you provided, i.e. a point on the surface would be 0 where a point in the middle of the volume could be -1 and a point not in the volume could be 3.

Edited by captain
• 1

##### Share on other sites

An SDF is basically an acceleration structure in the form of a lookup table - though, in this case the SDF is a 3D lookup table. The SDF covers the bounding box of the geometry.

If you have 2 geometries, and you want to determine if they've collided, you first check if their bounding boxes intersect. If they do, a more complex calculation is needed. Without an SDF, you'd have to compare each point in the geometry to the surfaces in the other geometry - a very, very expensive operation involving a lot of projections onto each polygon plane. With an SDF, you just transform the point into the SDF's local space and look up the distance.

Isooffset does the initial calcuations for the SDF, incurring a one time cost which can be reused in collision detection.

• 1

##### Share on other sites

Okay that makes a ton of sense, I wasn't sure if it was some sort of math you can do on a volume I couldn't figure out, or a data structure.  Data structure it is.

Thanks for the explanation.

##### Share on other sites

Fog volume is just density, so fog... or whatever volumous kinds of things you want to create. Of can use it to just scatter inside of an object rather than surface etc..

SDF is invaluable! So you could create your own collisions using them, have blood drip over an object, use it to calculate a follow path, I recently used it to calculate denting between vehicles, endless...

You just need to start using them, then you'll work it out. Just think of it as supplying a vector with magnitude to the surface of an object. Then next time you want to do something that requires that re-visit this thread.

Ohh you could use it for booleans as well. Once you understand what they are you'll figure out loads of stuff.

Yes Fog is a volumous thing, but is it used to create objects made of fog(ie smoke) and then further apply forces on them ?

can u give an example for basic use of FogVolume in IsoOffset. i.e. an application of IsoOffset with FogVolume.

i've heard SDF is used for FLIP Collisions as it is faster, i've even tried it. But besides that, they must be useful in RBD collisions as well, right ?

And applications like:

1). creating SDF for our own collisions,

2). blood drip on object & use it to calculate follow path,

3). Booleans

is still m trying understand how. Will work on it

Thanks ChristianW

Edited by sultan

##### Share on other sites

SDF is great for anytime you need to know if a point is within a volume.  You basically look up a point in the SDF and it will return a value based of the Signed Distance from the surface of the volume nearest the point you provided, i.e. a point on the surface would be 0 where a point in the middle of the volume could be -2 and a point not in the volume could be 3.

Got it captain !!

m using SDF to know more about it and the various applications in which it will be useful.

Thanks captain

##### Share on other sites

An SDF is basically an acceleration structure in the form of a lookup table - though, in this case the SDF is a 3D lookup table. The SDF covers the bounding box of the geometry.

If you have 2 geometries, and you want to determine if they've collided, you first check if their bounding boxes intersect. If they do, a more complex calculation is needed. Without an SDF, you'd have to compare each point in the geometry to the surfaces in the other geometry - a very, very expensive operation involving a lot of projections onto each polygon plane. With an SDF, you just transform the point into the SDF's local space and look up the distance.

Isooffset does the initial calcuations for the SDF, incurring a one time cost which can be reused in collision detection.

IsoOffset does the work of creating the SDF. Got it

Hmm... m still figuring how to do collision detection between 2 objects using SDF.

have used it for collision with FLIP, as have heard that its faster.

Thanks malexander

## Create an account

Register a new account