Unity distance fields to UV

2 weeks ago 29
ARTICLE AD BOX

In Unity, C#, I have a set of splines where I generate distance fields out from the spline segments. I've set a certain maximum distance that I prefer on it, and I also add smoothmin to the fields, so that they look a bit more organic. My fields are now anywhere in between the origin point, maximum distance, or wherever it collides before that.

Simply adding some colored lines on a material that expand outwards along the distance fields is simple. However, I'm trying to turn the distance field into fake UV coordinates. UV coordinates that would follow the distance field naturally as it twists and turns. Similar to a mesh, but more organic.

Basically. From origin to X width. And from spline start to end, broken up into sections of X length that represent the right-left area.

I've tried some arclength tests and such, but they always end up looking fragmented because how it treats multiple segments or because of angles, etc. And because it borders on the "I have no idea what I'm doing" area.

I tried making the distance field into a flow map, but at that point, I had the same problem with having no clue how to represent the right-left directions.

I've also tried to make it into an actual mesh, but since I'm working on a voxel grid, it is a bit difficult to move the vertices to the distance field border and not create overlapping segments and such.

Are there solutions that can create a decent-looking uv out of a distance field coming off of splines? Alternatively, by using other methods, but achieving the same?

Read Entire Article