Distance Tools

Distance functions drive the iso-surface boundary finding. A simple node showing the sphere primitive shape in an empty volume.

SDF Sphere.7z


A rounded box derived from http://iquilezles.org/www/articles/distfunctions/distfunctions.htm 

SDF Rounded Box.7z

Distance Tools

Distance Tools menu heading contains nodes to create or modify distance functions.

Capsule

SDF Capsule Compound.7z

The capsule node relies on positional information based on the End A and End B inputs, or two items (nulls were made for the preset) to form each end of the capsule.

The capsule inputs determine:

  • Position - the location of the capsule shape. Usually the object itself, however, this can be driven by nodes
  • End A - One end of the capsule shape
  • End B - Opposite end of the capsule shape
  • Radius - the radius of the capsule shape

Setting both the end values to 0 will produce a spherical shape.

The attached surface preset available here relies on positional information for two items (nulls were made for this) to form each end of the capsule. The first input is taken from the Input node's World Position, and the Radius is based on a Scalar constant. The attached surface preset merely renames the inputs to make them easier to understand.

Mobius

A twisted set of a single ring. The inputs determine:

  • Radius - The overall size of the ring set
  • Cylinder Radius - The radius of the cylinder that is being twisted
  • Group Radius - How tightly packed the ring is
  • Order - How many apparent rings are being twisted together
  • Twist - The spiraling of each apparent ring
  • Coil - The spiraling of the total rings

Shape CSG

Takes the Result from two SDF shapes and combines them in the fashion that should be familiar by now -

  • Union - Combines the two shapes
  • Intersection - Only leaves the parts of the two shapes that overlap
  • Subtraction - Removes Shape A from Shape B

The two shapes must be built in the same Empty Volume for Shape CSG to work. At this time, the Capsule and Mobius preset nodes are the only two currently available to work with, but shapes created - such as the spheres above - can also use the Shape CSG node


Using the Shape CSG node can create interesting effects. Here, a Scalar attached to a procedural texture controls the CSG effect

SmoothMin

Will blend between the Results from two SDF shapes with a user-definable radius.

Smooth Min adds three shapes using a blend

Additional Nodes

You can use a Vector Mod(ulo) for repetition. The initial Empty Volume radius determines how many shapes will fill it. The Vector Mod can be left at 1.0, 1.0, 1.0 and the Scalar will determine the size of the individual shapes

A grid of SDF spheres

A texture distortion of the above distance field.

Use a Vector Max when constructing unsigned shapes, with a per axis maximum.