This shader returns the distance to a polygon mesh.
It can get very slow the more polygons you have.
You can use it in two different ways:
- A) With the mesh of the object itself:
If you apply the volume shader to an object, then you can clearly see
the rim of the volume. Usally a hard line, angled due to straight
If you use the mesh distance, you get a nice falloff.
- B) With the mesh of a different object.
You can mix textures based on the distance to a different object. e.g. an object passing an energy shield.
Or for the volume density: Add density around an object, remove density if an object passes the volume...
You can also create booleans with this shader.