Finding the derivative of two blended noise values

54 Views Asked by At

In an effort to improve my procedural map generation I've been learning more about how generating noise actually works.

With that in mind I've been doing a Python adaptation of this tutorial series about noise and noise derivatives. So I thought I'd build a node/module system based on ANL and libnoise that might at least be useful to someone else when I'm done.

I've been translating this Javascript version of libnoise, as I've used it previously and was familiar with it, into Python and adapting it for 1D and 4D noise (in addition to the 2D and 3D it already did) and derivatives.

The derivative adding, subtracting and multiplying used in the original tutorial cover a lot of the module functions, but I've come to the more complicated ones and I'm struggling to figure out how I should be treating the derivatives.

I'm at the Blend module, which takes three different noise inputs and interpolates two of them with the third as the alpha / time value in the lerp function, as follows;

def get1D(self, x):
        a = self.sourceModules[0].get1D(x)
        b = self.sourceModules[1].get1D(x)
        alpha = self.sourceModules[2].get1D(x)

        return lerp(a, b, alpha)

And I'm a bit lost as to what to do with that. Should I just discard the derivatives for the noise and calculate a new one based on the interpolation? How would this work for higher dimensions where I have multiple derivatives for each axis?

Or do I interpolate the old noise derivatives into a new one?

The original also performs some kind of easing on the alpha noise variable, my understanding from working out the noise derivatives is that this would definitely need to have a derivative version, but should the derivative from that noise play any role in the final mix?

0

There are 0 best solutions below