I want to generate a heightmap for a 2D world (top-down, not a side-scroller), I've followed a guide that worked fine in Unity but in my current project which is a C# console application it doesn't work cause there the method Mathf.PerlinNoise doesn't exist. Is there a way I can translate this method into something that works using normal math or is there another relatively simple solution to generating a noise map that doesn't take advantage of that method?

  • \$\begingroup\$ Presumably you've searched out tutorials and guides on the net, or past Q&A about how to implement Perlin noise? As a common graphics primitive, you should find lots of resources at your fingertips explaining how to write a Perlin noise function from first principles. How have you tried applying this research so far, and where did you get stuck? \$\endgroup\$
    – DMGregory
    Mar 9 '20 at 16:55
  • \$\begingroup\$ In general... use whatever already exists AKA add this library to the project, set parameters and get noise values. Name of the functions in the file are self-explanatory. Otherwise you could implement your own noise function based on some great materials in the web(although I do not recommend, you will surely make mistakes): The Book of Shaders: Noise and Understanding Perlin Noise \$\endgroup\$
    – Tooster
    Mar 9 '20 at 17:09
  • \$\begingroup\$ @DMGregory I've looked through a lot of source code and guides but have yet to find one that works in my situation and makes sense to me, some of the libraries I've tried I don't know how to implement. \$\endgroup\$
    – Taceo
    Mar 9 '20 at 20:18
  • 2
    \$\begingroup\$ Then you should detail to us what specific aspects don't work for your situation, or what bits don't make sense to you, or what parts you don't know how to implement. If you don't give us this detail, we might offer solutions that you've already tried and rejected, or that fall into the same problems you've had in the past. The more precisely you can explain where you're stuck, the better we can help you overcome that specific barrier. \$\endgroup\$
    – DMGregory
    Mar 9 '20 at 20:25
  • \$\begingroup\$ @DMGregory I managed to get FastNoise to work! It had a little wiki that I missed the first time around. \$\endgroup\$
    – Taceo
    Mar 10 '20 at 16:29

FastNoise had a simple implementation that seems to do the trick!

  • 1
    \$\begingroup\$ This answer would be even better if it walked through how you applied this library to solve your problem in your project. The more information you can share here, the more you help future users in a similar situation as you. \$\endgroup\$
    – DMGregory
    Mar 13 '20 at 17:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .