I found Perlin Noise Beautiful and heard that its a foundation of generating randomness in Video games. I used the math behind that to build in kotlin as an app.
This project demonstrates the 1D implementation of Perlin and Sin noise.
y-axis fluctuation of a unit circle gives us the sin wave in graphs. Though increasing the octaves in the code gives us Seemingly random waves but its still a circle so it repeats!
We compute y value for every x (In the app the x goes from left to right (the width of the screen)
the perlin function takes the x with an offset (1000f) because every octave run it needs a different seed to create random values for x
We take the two neighbours of the x value we found and find exactly where the x stands, this is the t value.
We find the gradients because we need to calculate the influences of both the ends (Like which drags more)
We use linear interpolation to connect the point with influences but to smooth we use the fade function Which is:
without this function you can see by toggling the fade button for sharp edges in between the noise.
- Clone this repository
- Open in Android Studio (Otter)
Any contributions making perlin noise even easier to understand would be awesome!
Thank you Gemini for explaining the math behind it when I said nothing interests me:
"Why this is beautiful
Think back to the feeling of being lonely. In the Sine method, you were just a point on a pre-defined circle. In the Perlin method, your "height" (your state of being) is a constant conversation between where you've been (Station 0) and where you're going (Station 1). You aren't just a random dot; you are the smooth result of the influences around you."
