Auburn / FastNoiseLite

Fast Portable Noise Library - C# C++ C Java HLSL GLSL JavaScript Rust Go
http://auburn.github.io/FastNoiseLite/
MIT License
2.79k stars 327 forks source link

Tileable / Seamless Noise, Evolution Looping Noise & Position Offset Features #86

Closed LiamC12345 closed 2 years ago

LiamC12345 commented 2 years ago

Hi Auburn Fantastic work on FastNoiseLite - thanks for the upload!

I've been trying to add a couple of extra features to the program on my end in order to toggle Noise Tileablity as well as toggle Noise Loopability, which would also likely imply a looping/evolution slider for smooth animated evolving sequences

The UI controls would look something like this:

https://user-images.githubusercontent.com/96278032/150348210-98fd2ef7-ec54-4a06-9a3b-71cdaf7369fc.mp4

I've tried to make sense of and navigate through the fastnoiselite.h file, well as the other FastNoisePreviewAppQt files provided by Chudonghau here: ( https://github.com/chudonghao/FastNoisePreviewAppQt ) in an attempt to add the features myself but I just can't seem to wrap my head around both how Noise is coded, as well as the impressive way you've implemented it here.

I have some decent experience with C++, Qt and a well researched knowledge of how noise works but no matter how much I research, I still can't seem to fully understand how your code works in order to produce noise the way it does in your code

I was curious to know, if it doesn't take much time to do. Would you be able to quickly add in these features? By my research it looks like it doesn't require that much work, only a few extra lines of code added in the right places (Which you would know how to do this, not me - although I wish I did)

Here are some helpful links which simply explain what's required, as well as make this far easier to implement:

See First Answer on this Forum: https://gamedev.stackexchange.com/questions/162223/how-can-i-tile-perlin-noise-to-more-accurately-represent-a-world-map (This also includes a hint for being able to offset the tiled noise x and y positioning in the frame. If that is possible to include that would be an awesome bonus!)

See pages 5 & 6 of this Article: https://www.hyena.net.ee/rwg/Perlin%20Noise%20Generator.pdf

If this doesn't take too long, is there a chance you could add this?

Kind Regards, Liam

Auburn commented 2 years ago

Hi, as previously mentioned in #33 it is out of the scope of the library. Adding tileable output for all noise types correctly would require 4D noise. The methods you linked only work for perlin/cellular noise and not at all with fractals or domain warp. Please look at using FastNoise2 is you want proper tileable noise. Thanks.

LiamC12345 commented 2 years ago

Thankyou for getting back to me,

I did have a look at FastNoise 2 yesterday and got it working in Visual Studio. If I’m correct it looks like it uses OpenGL and IMGui

Well done on that too it looks and works great

I know this is probably a long shot and a big ask, but is there a chance you’d be able to translate Fast Noise 2 for use in Qt?

If that is too much to ask, instead would you be able to tell me how and where you learned how to write the code for all these noise types? I’m definitely interested in learning, that way Id be able to create a tileable 4D noise library for Qt.

Are you self taught? Also is advanced mathematics a requirement?

Whatever learning resources you could recommend for me I would be forever grateful

Kind Regards, Liam

Auburn commented 2 years ago

FastNoise2 doesn't have a dependency on any graphics/UI library, you can easily load it up in a Qt project and use it for generating textures for that.

The NoiseTool is a standalone application that loads FastNoise2 and uses OpenGL and ImGui for rendering, but FastNoise2 itself does not depend on them.

Join the FastNoise discord if you want to discuss this further: https://discord.gg/SHVaVfV

LiamC12345 commented 2 years ago

Thankyou so much man This certainly helps to point me in the right direction Cheers 🙂

LiamC12345 commented 2 years ago

Hey man, I checked out the FastNoise Discord, thanks for adding me there

I just have a question or two that might be better suited for directly asking you, although any general questions I might have in the future I'll definitely use discord

I believe I'm close to getting Fastnoise2 to be recognized and integrated into QT, there's just a small final hurdle that you might be able to assist me with

I'm getting a couple Compiling Errors after transferring all the .h .cpp and .inl files over to a new project in Qt. I'm 80% or so sure that the CMakeLists.txt files have been correctly integrated/adapted over into the Qt Project CMakeLists.txt (Which Qt initially auto-generates it's CMakeLists.txt upon creating a new project).

Note: I've only utilized the files depicted by the blue arrows below:

FN2CM Qt Project Folder

FN2 Folder

After adapting CMakeLists.txt to the best of my ability for use in Qt, and thoroughly going through all the Fast Noise .h/.cpp/.inl Files in Qt Creator for the purpose of re-establishing the #include directory locations for all Files in the Qt Project Folder - I still appear to be getting two consistent compile errors:


[0/1 ?/sec] Re-running CMake... -- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR) -- Configuring done CMake Error: INSTALL(EXPORT) given unknown export "FN2CMTargets" -- Generating done CMake Generate step failed. Build files cannot be regenerated correctly. FAILED: build.ninja C:\Qt\Tools\CMake_64\bin\cmake.exe --regenerate-during-build -S"C:\Users\Liam\Desktop\FN2CM Test\FN2CM" -B"C:\Users\Liam\Desktop\FN2CM Test\build-FN2CM-Desktop_Qt_6_2_2_MinGW_64_bit-Debug" ninja: error: rebuilding 'build.ninja': subcommand failed


Note: FN2CM is simply the project name in Qt (Stands for Fast Noise 2 CMake as you might have guessed)

Vulkan is an API like OpenGL, is there something I need to install for it to work? I'm no expert in these kinds of things so you'd probably know more about why it's not working than I currently do

I noticed ninja is something mentioned in the .json file, and I did transfer that to the FN2CM project folder (the Qt project folder), not sure what I need to do to get that recognized

Let me know if you happen to know what the solution to this might be, or any insights that may help to successfully integrate Fast Noise 2 into Qt. Also let me know if you need me to send through a photo of the 'adapted' CMakeLists.txt in my Qt Project Folder

Kind Regards, Liam

LiamC12345 commented 2 years ago

Here's the adapted FN2 CMakeLists.txt in Qt if it helps:

FN2 Qt CMakeListstxt