Thursday, 13 November 2014

Mushroom Gills - Radial Sorting

If you've ever needed to sort in a radial fashion, see below to find out how.

I've come against this problem countless times. It's come up again while creating the mushroom gills, so I thought it would be good to share the solution I've come up with.

The idea came when I was thinking about the angular gradient as a way to do radial sorting, I recalled the underlying formula for the angular gradient (shown below).

angularGradient = atan2($TX, $TZ) / 2 * $PI

Above you'll notice the $TX and $TZ, that will give us a circular / angular gradient about the Y Axis. Changing those position variables will give results about the other axis.

I might try to implement a VOP version which uses textures to do sorting in a similar way, be very handy to have a visual way to sort attributes.