-1
\$\begingroup\$

Lately i'm doing lot of research regarding procedural terrain generation. I do a lot of learning from www.iquilezles.org. I'm now familiar with such things as perlin/simplex noise, fbm, domain warping, etc. But right now I'm looking into this > https://www.iquilezles.org/www/articles/morenoise/morenoise.htm and am very clueless what are those derivatives, what do they represent and how to use them. Maybe someone can put this knowledge in more simple words or/and illustration? Thank you in advance.

\$\endgroup\$
1
\$\begingroup\$

The derivative of a function gives you the slope at each point of said function (it actually gives you the rate of change, but the two are identical for the first derivative)

For instance if you have the function \$f(x)=x\$, the derivative would be \$f'(x)=1\$, since the slope of the function is 1 at every point. Similarly for \$g(x)=x^2\$ it would be \$g'(x)=2x\$.

Knowing the slope of a function at any specific point is great, because it can be used to calculate the normals of the function, which can then be used to do lighting and other stuff, the article gives you a couple of ideas.

The second derivative is a bit harder to use in this context. It generally allows us to get the local minimums and maximums of any function by looking for coordinates where the second derivative is 0 and the signs of the values on the sides are different.

\$\endgroup\$
  • \$\begingroup\$ But the function returns 3 derivatives. \$\endgroup\$ – Janis Taranda Oct 22 at 6:16
  • \$\begingroup\$ Another q. You wrote g′(x)=2x. So if x increases, increases the slope value. So how, provided with the slope value, can I distinguish if it is more 'slope' or it just further on x axis. \$\endgroup\$ – Janis Taranda Oct 22 at 7:24
  • 1
    \$\begingroup\$ @JanisTaranda there's one derivative for each axis. I don't really understand your second question, could you elaborate a bit? \$\endgroup\$ – Bálint Oct 22 at 9:39
  • \$\begingroup\$ With equation g′(x)=2x, if increase x, the slope value (result) increases. Like if x = 1, g′(x) = 2; x = 5, g′(x) = 10; etc. So it grows nerveless slope is the same. It also grows when then slope is more tilted up. So how can I distinguish when getting from the function a single float for the axis? I hope I made the question clear. \$\endgroup\$ – Janis Taranda Oct 22 at 10:42
  • 1
    \$\begingroup\$ @JanisTaranda think about it, if you move 1 unit in the positive direction, a slope of 8 would mean going up 8 units. \$\endgroup\$ – Bálint Oct 22 at 19:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.