Well, I continue this unanswered question (Smoothing random noises of different amplitudes) and I have another question.
I've chosen to use the outline / the shadow of a form (https://stackoverflow.com/questions/53400394/translating-transforming-list-of-points-from- its-center-with-an-offset distance).
This outline / shadow is larger than the current path. I've used this repository (https://github.com/n-yoda/unity-vertex-effects) to recreate the shadow. And it works pretty well except one fact.
To know the height of all points (obtained by this shadow algorithm (line 13 of ModifiedShadow.cs and line 69 of CircleOutline.cs)), I get the distance from the current point to the center and I divide the maximum distance from the center. :
float dist = orig.Max (v => (v - Center) .magnitude); foreach Poly point -> float d = 1f - (center - p) .magnitude / dist;
Where orig is the complete list of points obtained by the shadow algorithm.
D is the height of the shadow.
But the problem is obvious, I form a perfect circle:
In red and black to see the contrast:
And that's not what I want:
As you can see, this is not a perfect gradient. Let's explain what's going on.
I use this library to generate noises: https://github.com/Auburns/FastNoise_CSharp
Note: If you want to know what I'm using to get noises of different amplitude: https://stackoverflow.com/questions/53356072/smoothing-random-noises-with-different-amplitudes (see the first block of code), see this in action, see this repo
- The green background color represents noises with an average height of -0.25 and an amplitude of 0.3.
- The white background color represents noises with an average height of 0 and an amplitude of 0.1.
- Red means 1 (total interpolation for noises corresponding to white pixels)
- Black means 0 (total interpolation for noise corresponding to green pixels)
That's why we have this release:
In fact, I tried to compare the distances from each point to the center, but this gave a strange and unexpected result.
In fact, I do not know what to try …