Distance T3D¶
Summary¶
The Distance T3D computes, for every voxel, the distance to the nearest seed: every voxel whose red channel is above Threshold. It uses jump flooding: each voxel keeps the nearest seed it has seen and compares it with its neighbours at halving distances, so the cost grows with log2 of the largest dimension (the pass count is set automatically, and Passes has no role). The result is close to, but not exactly, the Euclidean distance.
The distance is unsigned and measured in normalised coordinates: each axis as a fraction of its own extent, so in a
non-cubic volume it is not isotropic. Use a float Pixel Format. For a signed distance to geometry, geo_to with
Output Signed Distance computes an exact one.
Parameters - Distance Page¶
Threshold Threshold - Voxels whose red value is above this are seeds (distance 0).
Parameters - Common Page¶
Output Resolution Outputresolution ⊞ - Where the output's width, height and depth come from. With nothing connected to the first input the operator always uses Resolution, whichever option is set.
- Use Input
useinput- The first input's width, height and depth. - Custom
custom- The Resolution parameter.
Resolution Resolution1 Resolution2 Resolution3 ⊞ - Width, height and depth of the output in voxels. Used when Output Resolution is Custom, or when the first input is not connected. Memory is width × height × depth × bytes per voxel of the Pixel Format: 256³ at 16-bit float RGBA is 128 MiB.
Input Smoothness Inputfiltertype ⊞ - Filtering of the internal GLSL TOPs' input samplers, as TouchDesigner's Input Smoothness. Inputs are read at normalised coordinates, so this matters whenever the input and output resolutions differ or an input is transformed. Nearest Pixel returns voxels unblended; Interpolate Pixels is trilinear.
- Nearest Pixel
nearest - Interpolate Pixels
linear - Mipmap Pixels
mipmap
Passes Npasses - Has no effect on this operator: its shaders are compute shaders, which read the connected input on every pass, so extra passes repeat identical work. Leave it at 1.
Pixel Format Format ⊞ - Pixel format of the output. Use Input takes the first input's format. With nothing connected, Use Input resolves to 8-bit fixed (RGBA), which clamps values to 0–1 and quantises them to 1/255: set a float format for signed distances, densities above 1, velocities or anything else outside 0–1.
Bypass Bypass - Passes the first input through unchanged and skips the operator's work. With nothing connected the output is a single black voxel.
Version Version - T3D version of this operator. Read-only information; include it when reporting a problem.
Copyright Copyright - Author and licence information. Read-only.
Operator Inputs¶
- Input 0: Input
T3D_in1- The seeds. Every voxel whose red channel is above Threshold is a seed.
Operator Outputs¶
- Output 0: Output
T3D_output- In every channel, the distance from each voxel to the nearest seed, with each axis measured as a fraction of its own extent (0 on the seeds, 1 across the width); −1 everywhere when there are no seeds.
Performance¶
GPU time when the operator recooks: 0.502 ms at 64³, 2.313 ms at 128³, all of its passes summed (GeForce RTX 4090, TouchDesigner 2025.33230). An operator whose inputs and parameters are unchanged does not recook and costs nothing.