What is wrong with my C# Perlin noise generator?
I've been trying to code my own implementation of the Perlin noise algorithm based on this paper: https://www.cs.umd.edu/class/spring2018/cmsc425/Lects/lect13-2d-perlin.pdf
However, it ends up producing a weird pattern which is pretty far off the result I was looking for. The image it creates is below.
I tried messing around with the noise function and dot product function, but I'm unsure of what is actually going wrong. I suspect that I've made a silly error with the logic behind it, so if one of you could point that out for me then that would be greatly appreciated.
11 Replies
$paste
If your code is too long, you can post to https://paste.mod.gg/, save, and copy the link into chat for others to see your shared code!
(text files are pretty rubbish to try and view code on mobile)
Same on PC tbh
I found it very peculiar, that you are initialising a new
Random
everytime you are calling Perlin
, moving it to class level yields something that looks like noiseGood spot!
Not 100% sure, why that black spot in the top corner is there now, but I'd guess it's because of the calculation of target cells
It still looks suspiciously grid-like, so yeah, I suspect there's something else as well
Noted, I'll use this from now on. Sorry about that 😅
very good point. Thinking back i dont really know why i made a new one each time, so thank you for pointing that out
managed to fix it in the end. Here's the code for anyone who could possibly want to do the same.
results look good ibr