2

I'm creating a 2D mesh based off of an fbm function in unity. I know a good thing to implement is using the derivative of the function to smooth the side of steeper mountains and hills accordingly for more realistic effects.

My question is given my current FBM function

  1. How would I get the derivate of the function?
  2. How would I apply this derivative to my noise (eg. addition, multiplication, etc.)
float Customfbm(Vector2 x, Vector2 location, int octs = 5, float lacunarity = 1, float gain = 1)
    {
        float freq = 1, amp = 1;
        float sum = 0;
        for(int Octave = 0; Octave < octs; Octave++)
        {
            float value = Mathf.PerlinNoise(freq * (x.x + (location.x * 240)) / 240, freq * (x.y + (location.y * 240)) / 240) * 10;
            sum += value * amp;
            freq *= lacunarity;
            amp *= gain;
        }
        return sum;
    }

I have tried looking up the answer and it's not very clear due to most of the sources I could find are using Shaders. I'm really new to shaders and I haven't really learned the language. A lot of the examples out there are coded in open GL or open CV, Meaning while I can almost make out what they are doing it can still lead to being very vague on actual implementation details.

A lot of times where I have my "PerlinNoise" function, people replace that with a "PerlinDeriv" function. What does this function do and how? my guess is that it finds the derivative of the Perlin value to the layered noise, but if that were true wouldn't we only be using derivative to calculate the final height of the point? Also don't we want to calculate to the derivative of the point's height to the derivative of the finalized height which is a combination of the octaves?

Two sites that I found helpful are: https://www.iquilezles.org/www/articles/morenoise/morenoise.htm https://youtu.be/C9RyEiEzMiU?t=1958

0 Answers0