auburn / fastnoise2 Goto Github PK
View Code? Open in Web Editor NEWModular node graph based noise generation library using SIMD, C++17 and templates
License: MIT License
Modular node graph based noise generation library using SIMD, C++17 and templates
License: MIT License
Is this still a work in progress?
Thank you for this lovely bit of noise fun. It's a nice system.
I have had success in making a simple UE5 plugin containing the FastNoise.lib (built using cmake without the noisetool) and the folders of includes (FastNoise and FastSIMD). However, there is one issue.
I can use all the noise features apart from 'NewFromEncodedNodeTree' . If I try and implement it I'll get the following error on building:
unresolved external symbol "__declspec(dllimport) private: static void __cdecl FastNoise::SmartNodeManager::DecReference(unsigned __int64,void *,void (__cdecl*)(void *))" (__imp_?DecReference@SmartNodeManager@FastNoise@@CAX_KPEAXP6AX1@Z@Z) referenced in function "public: __cdecl ADrawMarchingCubes::ADrawMarchingCubes(void)" (??0ADrawMarchingCubes@@QEAA@XZ)
unresolved external symbol "__declspec(dllimport) class FastNoise::SmartNode<class FastNoise::Generator> __cdecl FastNoise::NewFromEncodedNodeTree(char const *,enum FastSIMD::eLevel)" (__imp_?NewFromEncodedNodeTree@FastNoise@@YA?AV?$SmartNode@VGenerator@FastNoise@@@1@PEBDW4eLevel@FastSIMD@@@Z) referenced in function "public: __cdecl ADrawMarchingCubes::ADrawMarchingCubes(void)" (??0ADrawMarchingCubes@@QEAA@XZ)
2 unresolved externals
Do the '2 unresolved externals' possibly refer to missing files related to the noisetool? I'm still thinking it's an error that I've created but after staring at the code for a couple of days I'm feeling a bit lost.
I am generating noise for my entire map (of size 16x16) using:
fnGenerator->GenUniformGrid2D(referenceOutput.data(), 0, 0, 16, 16, 0.0003f, 1337);
Where 16x16 is the total noise values I need, which I later split into 4 tiles (each 4x4). This works great.
However, this means that I have to either keep in memory or always generate the entire noise map if I want to revert back to it in the future.
Instead, I wanted to generate the noise map for the specific tile (4x4) I need on the fly.
// For the first tile
fnGenerator->GenUniformGrid2D(referenceOutput.data(), 0, 0, 4, 4, 0.0003f, 1337);
// For the tile at 4,4
fnGenerator->GenUniformGrid2D(referenceOutput.data(), 4, 4, 4, 4, 0.0003f, 1337);
This helps so I don't generate the entire map every time and I don't keep it in memory.
My issue is that the creation of a single tile and the creation of the entire map isn't consistent.
It generates too many values towards the X-axis before wrapping around to the Y-axis. Ignoring the max xSize I gave it.
See this example in action (Note the first tile highlighted):
fnGenerator->GenUniformGrid2D(referenceOutput.data(), 0, 0, 16, 16, 0.0003f, 1337);
Large Noise
----------------------------------------
| **-0.764776 -0.764888 -0.764997 -0.765103** | -0.765205 -0.765304 -0.765399 -0.765491 | -0.76558 -0.765664 -0.765746 -0.765823 | -0.765896 -0.765966 -0.766033 -0.766095
| **-0.764873 -0.764984 -0.765093 -0.765198** | -0.765299 -0.765398 -0.765493 -0.765585 | -0.765672 -0.765757 -0.765838 -0.765915 | -0.765989 -0.766059 -0.766125 -0.766187
| **-0.764971 -0.765082 -0.76519 -0.765295** | -0.765396 -0.765494 -0.765589 -0.76568 | -0.765768 -0.765852 -0.765933 -0.76601 | -0.766083 -0.766153 -0.766219 -0.766282
| **-0.765072 -0.765182 -0.76529 -0.765394** | -0.765495 -0.765592 -0.765687 -0.765777 | -0.765865 -0.765949 -0.76603 -0.766107 | -0.76618 -0.76625 -0.766316 -0.766379
----------------------------------------
| -0.765175 -0.765284 -0.765391 -0.765495 | -0.765595 -0.765693 -0.765787 -0.765877 | -0.765965 -0.766049 -0.766129 -0.766206 | -0.766279 -0.766349 -0.766416 -0.766478
| -0.76528 -0.765389 -0.765495 -0.765598 | -0.765698 -0.765795 -0.765889 -0.765979 | -0.766067 -0.76615 -0.76623 -0.766307 | -0.766381 -0.766451 -0.766517 -0.76658
| -0.765386 -0.765495 -0.765601 -0.765703 | -0.765803 -0.7659 -0.765993 -0.766083 | -0.76617 -0.766254 -0.766334 -0.766411 | -0.766484 -0.766554 -0.766621 -0.766684
| -0.765495 -0.765603 -0.765708 -0.765811 | -0.76591 -0.766006 -0.766099 -0.766189 | -0.766276 -0.76636 -0.76644 -0.766517 | -0.76659 -0.76666 -0.766727 -0.76679
----------------------------------------
| -0.765606 -0.765713 -0.765818 -0.76592 | -0.766019 -0.766115 -0.766208 -0.766298 | -0.766384 -0.766468 -0.766548 -0.766625 | -0.766698 -0.766768 -0.766835 -0.766898
| -0.765718 -0.765825 -0.765929 -0.766031 | -0.76613 -0.766225 -0.766318 -0.766408 | -0.766494 -0.766578 -0.766658 -0.766735 | -0.766808 -0.766878 -0.766945 -0.767009
| -0.765832 -0.765939 -0.766043 -0.766144 | -0.766242 -0.766338 -0.76643 -0.76652 | -0.766606 -0.766689 -0.766769 -0.766846 | -0.76692 -0.76699 -0.767057 -0.767121
| -0.765948 -0.766054 -0.766158 -0.766258 | -0.766357 -0.766452 -0.766544 -0.766634 | -0.76672 -0.766803 -0.766883 -0.76696 | -0.767034 -0.767104 -0.767171 -0.767235
----------------------------------------
| -0.766065 -0.766171 -0.766274 -0.766374 | -0.766472 -0.766567 -0.76666 -0.766749 | -0.766835 -0.766918 -0.766998 -0.767076 | -0.76715 -0.76722 -0.767288 -0.767352
| -0.766184 -0.766289 -0.766392 -0.766492 | -0.76659 -0.766685 -0.766777 -0.766866 | -0.766953 -0.767036 -0.767116 -0.767193 | -0.767267 -0.767338 -0.767406 -0.76747
| -0.766304 -0.766409 -0.766512 -0.766612 | -0.766709 -0.766804 -0.766896 -0.766985 | -0.767071 -0.767155 -0.767235 -0.767313 | -0.767387 -0.767458 -0.767526 -0.767591
| -0.766426 -0.766531 -0.766633 -0.766733 | -0.76683 -0.766925 -0.767017 -0.767106 | -0.767192 -0.767276 -0.767356 -0.767434 | -0.767508 -0.76758 -0.767648 -0.767713
If I generate it alone, I don't get the same tile because it didn't wrap around the X-axis as it should have:
fnGenerator->GenUniformGrid2D(referenceOutput.data(), 0, 0, 4, 4, 0.0003f, 1337);
Top Left Tile Noise
-0.764776 -0.764888 -0.764997 -0.765103
-0.765205 -0.765304 -0.765399 -0.765491
-0.765299 -0.765398 -0.765493 -0.765585
-0.765672 -0.765757 -0.765838 -0.765915
I have been unable to link the lib when compiling from source in VS2019. I get 2 unresolved externals due to the "__declspec(dllimport)" when compiling my own project
Full output :
error LNK2019: unresolved external symbol "__declspec(dllimport) private: static void __cdecl FastNoise::SmartNodeManager::DecReference(unsigned __int64,void ,void (__cdecl)(void *))" (_imp?DecReference@SmartNodeManager@FastNoise@@CAX_KPEAXP6AX1@Z@Z) referenced in function "private: void __cdecl FastNoise::SmartNode::Release(void)" (?Release@?$SmartNode@VGenerator@FastNoise@@@fastnoise@@AEAAXXZ)
error LNK2019: unresolved external symbol "__declspec(dllimport) class FastNoise::SmartNode __cdecl FastNoise::NewFromEncodedNodeTree(char const *,enum FastSIMD::eLevel)" (_imp?NewFromEncodedNodeTree@FastNoise@@ya?AV?$SmartNode@VGenerator@FastNoise@@@1@PEBDW4eLevel@FastSIMD@@@z) referenced in function "private: __cdecl RoP::WorldGen::WorldGen(void)" (??0WorldGen@RoP@@Aeaa@XZ)
I'm probably doing something wrong, but if I'm getting this error, I'm sure someone else also will at some point.
Cheers
FastNoise nodes can not be created/released simultaneously from multiple threads because it's mechanism relies on a global variable access without thread-safe protection. Creation or release of nodes fails with access violation in different code locations inside library.
I would like to add FastNoise to my CMake project. To do so I've added this to my CMakeLists.txt
.
add_subdirectory(libraries/FastNoise2)
target_link_libraries(nibbles_01 PRIVATE <other libs> FastNoise)
I then copied the FastNoise2
directory into a libraries
directory at the top level of my project.
I can run the project successfully and include FastNoise/FastNoise.h
however if I add auto fnSimplex = FastNoise::New<FastNoise::Simplex>();
it instantly exits. If I run the generated .exe
I get this error:
Here is my full CMakeLists
for if there is anything obvious.
cmake_minimum_required(VERSION 3.17)
project(powder_game)
set(CMAKE_CXX_STANDARD 20)
set(FASTNOISE2_NOISETOOL OFF CACHE BOOL "Build Noise Tool" FORCE)
add_executable(nibbles_01 src/main.cpp src/game/simulation/chunks/Chunk.cpp src/game/simulation/chunks/Chunk.h src/game/simulation/chunks/elements/Element.cpp src/game/simulation/chunks/elements/Element.h src/game/simulation/chunks/elements/liquid/Liquid.cpp src/game/simulation/chunks/elements/liquid/Liquid.h src/game/simulation/math/Vector2.cpp src/game/simulation/math/Vector2.h src/game/simulation/math/RandomUtils.cpp src/game/simulation/chunks/elements/liquid/Water.cpp src/game/simulation/chunks/elements/liquid/Water.h src/game/simulation/chunks/elements/solid/immovable/ImmovableSolid.cpp src/game/simulation/chunks/elements/solid/immovable/ImmovableSolid.h src/game/simulation/chunks/elements/solid/Solid.cpp src/game/simulation/chunks/elements/solid/Solid.h src/game/simulation/chunks/elements/gas/Gas.cpp src/game/simulation/chunks/elements/gas/Gas.h src/game/simulation/chunks/elements/solid/movable/MovableSolid.cpp src/game/simulation/chunks/elements/solid/movable/MovableSolid.h src/game/simulation/chunks/elements/solid/immovable/walls/Wall.cpp src/game/simulation/chunks/elements/solid/immovable/walls/Wall.h src/game/simulation/chunks/elements/solid/movable/Sand.cpp src/game/simulation/chunks/elements/solid/movable/Sand.h src/game/simulation/chunks/elements/gas/Fire.cpp src/game/simulation/chunks/elements/gas/Fire.h src/game/simulation/chunks/elements/gas/Smoke.cpp src/game/simulation/chunks/elements/gas/Smoke.h src/game/simulation/chunks/elements/gas/Steam.cpp src/game/simulation/chunks/elements/gas/Steam.h src/game/simulation/chunks/elements/liquid/Lava.cpp src/game/simulation/chunks/elements/liquid/Lava.h src/game/simulation/chunks/elements/liquid/Oil.cpp src/game/simulation/chunks/elements/liquid/Oil.h src/game/simulation/math/concavehull/concavehull.h src/game/simulation/math/simplexnoise/SimplexNoise.cpp src/game/simulation/math/simplexnoise/SimplexNoise.h src/game/simulation/math/perlinnoise/Perlin.cpp src/game/simulation/math/perlinnoise/Perlin.h src/game/simulation/math/fractalnoise/FractalNoise.cpp src/game/simulation/math/fractalnoise/FractalNoise.h src/game/Game.cpp src/game/Game.h src/game/ElementType.h src/game/StatsTracker.cpp src/game/StatsTracker.h src/game/simulation/Simulation.cpp src/game/simulation/Simulation.h src/game/Globals.h src/game/Box2DDebugDraw.cpp src/game/Box2DDebugDraw.h src/game/gameobjects/player/Player.cpp src/game/gameobjects/player/Player.h src/game/gameobjects/Entity.cpp src/game/gameobjects/Entity.h src/game/simulation/math/triangulation/earcut.hpp src/game/simulation/math/concavehull/delaunater.cpp src/game/simulation/math/concavehull/delaunater.h src/game/simulation/chunks/elements/solid/immovable/walls/ores/Ore.cpp src/game/simulation/chunks/elements/solid/immovable/walls/ores/Ore.h src/game/simulation/chunks/elements/solid/immovable/walls/ores/Gold.cpp src/game/simulation/chunks/elements/solid/immovable/walls/ores/Gold.h)
# OpenGL
find_package(OpenGL REQUIRED)
add_subdirectory(3rd_party/Box2D-cmake)
add_subdirectory(CDT-master/CDT)
add_subdirectory(libraries/FastNoise2)
set(GLEW_INCLUDE_DIRS, "C:/Program Files/glew-2.1.0/include/")
set(GLEW_LIBRARIES, "C:/Program Files/glew-2.1.0/lib")
include_directories(headers /usr/include "libraries/SFML/include")
set(SFML_ROOT "libraries/SFML")
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake_modules")
find_package(SFML COMPONENTS system window graphics network audio CONFIG REQUIRED)
include_directories(${SFML_INCLUDE_DIR})
# glut32.dll must be present in "project-directory/OpenGL/dll/"
add_custom_target(glutdlllib
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/libfreeglut.dll ${CMAKE_BINARY_DIR}
)
add_custom_target(box2dlib
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/box2d.lib ${CMAKE_BINARY_DIR}
)
add_dependencies(nibbles_01 glutdlllib)
add_dependencies(nibbles_01 box2dlib)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake_modules")
target_link_libraries(nibbles_01 PRIVATE ${OPENGL_LIBRARY} ${SFML_LIBRARIES} ${SFML_DEPENDENCIES} sfml-system sfml-network sfml-graphics sfml-window tobanteGaming::Box2D FastNoise)
file(COPY assets DESTINATION ${CMAKE_BINARY_DIR})
# Copy dlls to build
if (WIN32)
file(GLOB BINARY_DEP_DLLS "${SFML_INCLUDE_DIR}/../bin/*.dll")
file(COPY ${BINARY_DEP_DLLS} DESTINATION ${CMAKE_BINARY_DIR})
file(GLOB MINGW_DEP_DLLS "C:/mingw64/bin/*.dll")
file(COPY ${MINGW_DEP_DLLS} DESTINATION ${CMAKE_BINARY_DIR})
endif ()
How to I add this correctly to my CMake project?
This had 24 million elements per second (or ~3 millisecond per 256x256 map):
FastNoise::SmartNode<> fnGenerator = FastNoise::NewFromEncodedNodeTree( "DQAFAAAAAAAAQAgAAAAAAD8AAAAAAA==" );
fnGenerator->GenUniformGrid2D((float *)heightmap, 0, 0, mapSize, mapSize, 0.2f, 1337);
This had 30 million elements per second:
noise.SetNoiseType(FastNoiseLite::NoiseType_OpenSimplex2);
heightmap[i][j]=noise.GetNoise((float)(j+animx+1000), (float)(i+animy+1000));
despite having extra index calculations. How can I make sure it uses AVX well? I used -march=native
for g++ 7.5 and optimizations were enabled.
Maybe I chose the wrong function to compare each other?
Compiling for a 32-bit platform with a custom clang toolchain; I get this:
FastNoise2/include/FastNoise/SmartNode.h:240:28: warning: implicit conversion from 'const uint64_t' (aka 'const unsigned long long') to 'size_t' (aka 'unsigned int') changes value from 18446744073709551615 to 4294967295 [-Wconstant-conversion]
mReferenceId = SmartNodeManager::kInvalidReferenceId;
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Problem originates here:
FastNoise2/include/FastNoise/SmartNode.h
Line 16 in 1f7dc6a
However, most of the code assumes uint64_t
, so I assume the fix will be to change the following to uint64_t mReferenceId;
:
FastNoise2/include/FastNoise/SmartNode.h
Line 264 in 1f7dc6a
Looks like this was forgotten here: be585cd - another instance probably exists here (which should also be using uint64_t
now):
FastNoise2/include/FastNoise/SmartNode.h
Line 255 in 1f7dc6a
Dependabot couldn't find a .gitmodules for this project.
Dependabot requires a .gitmodules to evaluate your project's current Git dependencies. It had expected to find one at the path: /.gitmodules
.
If this isn't a Git project, or if it is a library, you may wish to disable updates for it from within Dependabot.
As the title says, C# bindings!
I would love to use this library in C#, and I'm sure it would attract attention from Unity devs as well. I have no experience with C++, and honestly didn't make much progress in attempting this myself. Somewhat compounded by some of the methods being a bit obtuse without describing comments (For me anyways).
Hopefully this isn't too large of an ask.
I tried copying the include folder to my project but then when I do #include "FastNoise/FastNoise.h"
I get the error:
fatal error: 'FastSIMD/FastSIMD.h' file not found
It's something about directories, it's trying to find the FastSIMD
folder inside the FastNoise
folder instead of where I include the file. How do I make it work without adding ../
everywhere in the header files? If I move the FastSIMD
folder inside the FastNoise
folder I get more errors about files not being found, and manually editing your files looks more like a workaround instead of a solution
BTW I see you use CMake, do I need to use it to be able to use your library? I literally never used CMake and I don't know how it works
Hi! I'm trying to create a ruby binding for this library but got hung up on something.
I'm unsure why this is the case, but in this loop at line 245
of Generator.inl
will loop indefinitely and index into out of bounds memory, at least with how I'm calling it. This inevitably causes a segmentation fault.
// xPosVal & yPosVal are Ruby arrays with the values of [0.0, 1.0]
// They are converted to std::vectors which definitely contain the values of 0.0 and 1.0
Array GenPositionArray2D(Object xPosVal, Object yPosVal, float xOffset, float yOffset)
{
std::vector<float> xPos = detail::From_Ruby<std::vector<float>>().convert(xPosVal);
std::vector<float> yPos = detail::From_Ruby<std::vector<float>>().convert(yPosVal);
float minmax[2];
std::vector<float> noiseOut(xPos.size());
fnGenPositionArray2D(nodeHandle, noiseOut.data(), xPos.size(), xPos.data(), yPos.data(), xOffset, yOffset, seed, minmax); // Segfault here
OutputMinMax outputminmax(minmax[0], minmax[1]);
return gen_result(outputminmax, noiseOut);
}
After some debugging, I noticed that in the following code, this loop just would not exit, period.
size_t index = 0;
while( index < count - FS_Size_32() )
{
float32v xPos = float32v( xOffset ) + FS_Load_f32( &xPosArray[index] );
float32v yPos = float32v( yOffset ) + FS_Load_f32( &yPosArray[index] );
float32v gen = Gen( int32v( seed ), xPos, yPos );
FS_Store_f32( &noiseOut[index], gen );
My best guess is that count
should be multiplied by FS_Size_32()
instead? I'm not super sure though.
>>> info args
this = 0x1ed32db0fd8
noiseOut = 0x1ed3282c420
count = 1
xPosArray = 0x1ed327f4e10
yPosArray = 0x1ed328206d0
xOffset = 0
yOffset = 0
>>> info locals
xPos = {
vector = {[0] = -nan(0x7fffff), [1] = -nan(0x7fffff), [2] = -nan(0x7fffff), [3] = -nan(0x7fffff), [4] = -nan(0x7fffff), [5] = -nan(0x7fffff), [6] = 0.84829092, [7] = 0.848087311}
}
yPos = {
vector = {[0] = -nan(0x7fffff), [1] = -nan(0x7fffff), [2] = -nan(0x7fffff), [3] = -nan(0x7fffff), [4] = -nan(0x7fffff), [5] = -nan(0x7fffff), [6] = 0.623758435, [7] = 0.625489891}
}
gen = {
vector = {[0] = -nan(0x7fffff), [1] = -nan(0x7fffff), [2] = -nan(0x7fffff), [3] = -nan(0x7fffff), [4] = -nan(0x7fffff), [5] = -nan(0x7fffff), [6] = -0.509935439, [7] = -0.509879351}
}
min = {
vector = {[0] = -nan(0x7fffff), [1] = -nan(0x7fffff), [2] = -nan(0x7fffff), [3] = -nan(0x7fffff), [4] = -nan(0x7fffff), [5] = -nan(0x7fffff), [6] = -nan(0x7fffff), [7] = -nan(0x7fffff)}
}
max = {
vector = {[0] = -nan(0x7fffff), [1] = -nan(0x7fffff), [2] = -nan(0x7fffff), [3] = -nan(0x7fffff), [4] = -nan(0x7fffff), [5] = -nan(0x7fffff), [6] = -nan(0x7fffff), [7] = -nan(0x7fffff)}
}
index = 559864
xPos = {
vector = {[0] = -nan(0x7fffff), [1] = -nan(0x7fffff), [2] = -nan(0x7fffff), [3] = -nan(0x7fffff), [4] = -nan(0x7fffff), [5] = -nan(0x7fffff), [6] = 0.84829092, [7] = 0.848087311}
}
yPos = {
vector = {[0] = -nan(0x7fffff), [1] = -nan(0x7fffff), [2] = -nan(0x7fffff), [3] = -nan(0x7fffff), [4] = -nan(0x7fffff), [5] = -nan(0x7fffff), [6] = 0.623758435, [7] = 0.625489891}
}
gen = {
vector = {[0] = -nan(0x7fffff), [1] = -nan(0x7fffff), [2] = -nan(0x7fffff), [3] = -nan(0x7fffff), [4] = -nan(0x7fffff), [5] = -nan(0x7fffff), [6] = -0.509935439, [7] = -0.509879351}
}
As you'll notice, index
is 559864
, which is definitely into out of bounds memory territory. If I had to guess why it takes such a long time to error out, it's probably because I'm running this in Ruby and Ruby is filling up all that memory.
I'm no expert at C++ though, I am a rubyist at heart, so I apologize if I got any of this wrong.
I also checked what the value of count - FS_Size_32()
is, and it's 18446744073709551611
. Yeah...
Especially on the cellular side of things, is there a way to generate tiled/toroidal 3D volumes of noise?
Hi Jordan Peck, I want to use it in unreal, I tried but I had a lot of problems, Are there any plans to release ue4 version?
Dependabot couldn't find a .gitmodules for this project.
Dependabot requires a .gitmodules to evaluate your project's current Git dependencies. It had expected to find one at the path: /.gitmodules
.
If this isn't a Git project, or if it is a library, you may wish to disable updates for it from within Dependabot.
Hi! I'm encountering a strange issue with FastNoise2 on windows. When trying to call GenSingle3D on a FractalFBm module, a segfault occurs. This behaviour is present in the latest commit as well as the last release, and we managed to replicate it with just the following code, which should segfault at the GenSingle3D call:
int main(int argc, char* argv[]) {
auto biomePerlin = FastNoise::New<FastNoise::Simplex>();
auto biomeScale = FastNoise::New<FastNoise::DomainScale>();
biomeScale->SetSource(biomePerlin);
biomeScale->SetScale(1/1000.f);
auto biomeFractal = FastNoise::New<FastNoise::FractalFBm>();
biomeFractal->SetSource(biomePerlin);
float val = biomeFractal->GenSingle3D(0, 0,0, 1337);
std::cout << val << std::endl;
}
Compiled with C++17, MinGW on Windows.
It would be useful if the readme would also include FastNoiseSIMD in the performance comparison table, currently it only has "FastNoise Lite", "FastNoise (Legacy)" and "FastNoise2 (AVX2)", but no "FastNoiseSIMD (AVX2)".
I'm interested in knowing if there have been any significant performance improvements between FastNoiseSIMD and FastNoise2 that would make updating an existing codebase from FastNoiseSIMD to FastNoise2 worth it.
When creating a node network in FastNoise2, it would be extremely useful to see the performance cost of the whole node network, and how which nodes are contributing to the total performance cost of the noise.
As an example, take the "Simple Terrain" template. If I look at the node network, then the most obvious cost that I can indentify is obviously the 4 octaves of OpenSimplex2 noise. The "Domain Scale" I assume is pretty much free, the "Position Output" is probably also pretty much free, the "Add" node probably too. But after that, it becomes way more difficult to judge. I don't know how much the "Domain Warp Gradient" affects the performance cost. The work it's doing is more complex than a simple add, but probably also way less than 4 octaves of simplex noise, so I would assume, it's also relatively cheap, but I can't know. It would be great to know exaxt values for that. And the last node, "Domain Warp Fractal" is most difficult to judge. It itself adds 2 octaves, so it's probably quite expensive, but how expensive exactly?
I would like to be able to immedietaly see what the performance difference is between using 4 Octaves in the "Fractal FBm" node and 2 Octaves in the "Domain Warp Fractal" node, vs using 3 Octaves in the "Fractal FBm" node and 2 Octaves in the "Domain Warp Fractal" node. Currently, I have no idea if that makes any difference at all, if it's same expensive, if one is way more expensive than the other, how I should tweak the values to end up with something that both looks good and is as efficient as possible.
Even just seeing a "total cost" for the whole node network would help a lot, as then it could easily be figured out with A/B testing how much which node affects the performance. It should probably be very easy for the mesh preview to calculate the "nanoseconds per voxel" or something similar? Or just the total generation time for the "Texture Preview".
I want to know if this supports python, because I need to use Voronoi noise in the python environment
See title. Thanks.
The examples output to a vector<float>, and I find no mention of Doubles.
Having used the older FastNoise, I remember I could just add #define FN_USE_DOUBLES
. Is there similar support here?
Need to add generic ARM NEON detection that will work on android and linux desktops running ARM CPUs
This looks like a good implementation: Auburn/FastNoiseSIMD#32
Would like to avoid having to include the cpufeatures.h android NDK header
v0.8.2-alpha work fine
Dependabot couldn't find a .gitmodules for this project.
Dependabot requires a .gitmodules to evaluate your project's current Git dependencies. It had expected to find one at the path: /.gitmodules
.
If this isn't a Git project, or if it is a library, you may wish to disable updates for it from within Dependabot.
Apparently just using set(CMAKE_CXX_STANDARD 17) in cmake is not enough and i just installed gcc 8 to get it to build. The problem is that the path to the filesystem header and it's namespace need prefixed with "experimental" for 7. Leaving these resources here for reference.
https://stackoverflow.com/questions/64945946
https://stackoverflow.com/questions/54290254
hi,
I'm trying to replicate in C++ what I do in the GUI:
In the GUI, the domain scale is applied from the center, it zooms on the image like a homothety, which is exactly what i want. But I cannot replicate this behavior in C++, the SetScale function has no other parameter than the scale.
Here is basically what I do:
for (auto sd = seed_range.begin(); sd < seed_range.end(); sd++) {
// FastNoise::New inside because I was doing generation in parallel
auto fnFractal_ = FastNoise::New<FastNoise::FractalFBm>();
fnNoise = FastNoise::New<FastNoise::Simplex>();
fnFractal_->SetSource(fnNoise);
auto fnFractal = FastNoise::New<FastNoise::DomainScale>();
fnFractal->SetSource(fnFractal_);
for (auto const &o: octave_range) {
for (auto const &g: gain_range) {
for (auto const &l: lacunarity_range) {
std::fill(data.begin(), data.end(), 0);
fnFractal_->SetOctaveCount(o);
fnFractal_->SetGain(g);
fnFractal_->SetLacunarity(l);
fnFractal->SetScale(1);
fnFractal->GenUniformGrid2D(data.data(), 0, 0, img_size, img_size, 0.02, *sd);
//fnFractal->GenTileable2D(data.data(), img_size, img_size, 0.02, *sd);
for (auto const &k : k_range) {
std::fill(data.begin(), data.end(), 0);
fnFractal->SetScale(k);
fnFractal->GenUniformGrid2D(data.data(), 0, 0, img_size, img_size, 0.02, *sd);
//fnFractal->GenTileable2D(data.data(), img_size, img_size, 0.02, *sd);
}
}
}
}
}
With GenUniformGrid2D, it seems to scales ok, but from the top left corner of the image, not from the center.
Now I could do it in opencv, but I'd have to pad and fill, etc, and it seems silly since it should be easy in FastNoise from what i see.
(Also and more importantly, I'm hoping the scale is computed early in the process, hopefully analytically, and is not an image transformation.)
Please, am I missing something ?
Thank you
On my Github Actions CI I get warnings while compiling FastNoise2 on the ubuntu-20.04
image:
modules/voxel/thirdparty/fast_noise_2/include/FastNoise/Metadata.h:10: error: ignoring #pragma warning [-Werror=unknown-pragmas]
10 | #pragma warning( push )
|
modules/voxel/thirdparty/fast_noise_2/include/FastNoise/Metadata.h:11: error: ignoring #pragma warning [-Werror=unknown-pragmas]
11 | #pragma warning( disable : 4251 )
|
In file included from modules/voxel/thirdparty/fast_noise_2/src/FastNoise/FastNoise_C.cpp:3:
modules/voxel/thirdparty/fast_noise_2/include/FastNoise/Metadata.h:229: error: ignoring #pragma warning [-Werror=unknown-pragmas]
229 | #pragma warning( pop )
|
It should be noted I compile the library as part of Godot, it is neither a dynamic lib nor a static lib. I translated the CMake files to Godot's build system and it works fine, however I haven't seen anything related to silencing such warnings.
Either way, this is in a header file.
Could it be due to a version of GCC not supported by the library? A Microsoft-specific feature? Could this be wrapped into conditionals?
Quick search found this microsoft/DirectXMath#133 (comment)
FastNoise library build fails on MacOS, see MethaneKit build log with FastNoise2 integrated and screenshot of Xcode with FastNoise2 build errors:
Been using this in a framework for some experimental stuff, love the ease of use!
Was wondering if it's possible to have a xStart and yStart for tileable 2D noise or is it impossible?
Can we get an emscripten build as well? Which leverages webassembly simd in chrome?
Hi I went to the releases section looking for a version of NoiseTool I could run on my mac. I downloaded a file called FastNoise2-v0.9.4-alpha-MacOS64-Clang.zip and tried to work out how I could launch it but there was no file in there that seemed to be executable or that would start the application, I tried downloading the windows version and that contained an exe but when I tried to run that on my work computer it said that it was missing a dll file, am I being dumb and not launching the program correctly
Testing Noise tool release v0.9.4, and seems like the Seed and the Size input in the Texture Preview got switched around.
I tried to compile NoiseTool using VS2022 but I got some compilation errors in ImageProperties.h in the Magnum library.
I simply changed the GIT_TAG
of corrade
and magnum
and it compiles and runs apparently fine (just for the records I used d44ca683c12ed28fce1d27662f24edee2d7e2c6a
for corrade
and a218ddfa9434201aaca207ea9c8e87fea91a0757
for magnum
).
I don't know if those revisions are OK for you, I simply took the last commit on master
. Shall I make a PR?
Thanks
Would it be possible to add histogram preview that would show content corresponding to the texture preview?
As an example, I want to match terrain levels with this:
https://commons.wikimedia.org/wiki/File:Earth_elevation_histogram.svg
(the histogram should have swapped axes)
Clang version works.
It would be very useful to be able to have the node editor and 2d texture preview on a 2nd/3rd screen, and have the whole main screen dedicated to the 3d noise preview.
Dependabot couldn't find a .gitmodules for this project.
Dependabot requires a .gitmodules to evaluate your project's current Git dependencies. It had expected to find one at the path: /.gitmodules
.
If this isn't a Git project, or if it is a library, you may wish to disable updates for it from within Dependabot.
As far as I can tell it is not possible to scale noise when using GenUniformGrid
When generating terrain it is very useful to "stretch/scale" noise by multiplying sample point input.
It would look something like this when using GenSingle:
`
//inside of a loop
GenSingle(x * scale, y * scale)
`
Would it be possible to extend GenUniformGrid to support scale parameter?
Hello,
I discovered your program this week, and it's working really nice, thank you.
I'm using it directly in a C++ code, so I have to link the libraries.
The only probem is, the install target seems broken.
My cmake command is cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON ..
When I run "make install", with a custom install prefix or not, nothing happens, just:
[ 9%] Built target FastNoise
[ 9%] Built target MagnumShaders_RCS-dependencies
[ 16%] Built target CorradeUtilityObjects
[ 22%] Built target CorradeUtility
[ 25%] Built target corrade-rc
[ 28%] Built target MagnumShadersObjects
[ 32%] Built target MagnumMathObjects
[ 36%] Built target MagnumObjects
[ 42%] Built target Magnum
[ 69%] Built target MagnumGLObjects
[ 70%] Built target MagnumFlextGLObjects
[ 78%] Built target MagnumGL
[ 84%] Built target MagnumShaders
[ 89%] Built target MagnumImGuiIntegration
[ 90%] Built target MagnumGlxContextObjects
[ 92%] Built target MagnumPlatformObjects
[ 93%] Built target MagnumSdl2Application
[ 93%] Built target MagnumSceneGraphObjects
[ 96%] Built target MagnumSceneGraph
[100%] Built target NoiseTool
Install the project...
-- Install configuration: "Release"
So right now I just copy manually the include folder, and the build/Release/lib
,build/Release/bin
folders, but it's not very efficient.
Am I doing something wrong ? I didn't see any install target in the CMakeLists.txt, but didn't fiddle too much...
Thank you
Fade node ignores checkerboard connected to the fade factor.
Tested with commit 772a912
Using visual studio 2019. detected avx2
I hope it's just the fact that I'm running version 0.7 on Linux/X11, but I found no way to copy or save the encoded node tree.
So far I attempted:
With following method call,
fnGenerator->GenUniformGrid2D((float *)heightmap, 0, 0, mapSize, mapSize, 0.2f, 1337);
it generates a static map but what if I need to move the noise pattern itself 1 cell left or 1 cell up without changing heightmap size? Is there some offset option like using scalar FastNoiseLite method calls? With FastNoiseLite, this was working:
heightmap[i][j]=noise.GetNoise((float)(j+translationx), (float)(i+translationy));
with bumping each noise point by translationx and translationy.
I'm honestly not sure if this is a stupid question or not, I've spent way too long trying to figure it out.
If we call:
Generator.Noise.GenUniformGrid3D(
noise,
ChunkCoord.x, ChunkCoord.y, ChunkCoord.z,
chunkSize, chunkSize, chunkSize,
0.02f,
Generator.Seed
);
How do I go about translating my Chunk's global x,y,z position into the noise key index?
Everything I try seems to end up with some wonky map output
Dependabot couldn't find a .gitmodules for this project.
Dependabot requires a .gitmodules to evaluate your project's current Git dependencies. It had expected to find one at the path: /.gitmodules
.
If this isn't a Git project, or if it is a library, you may wish to disable updates for it from within Dependabot.
When using FastNoise2 for generating terrain, it would be very useful to see values for the "height" of the generated terrain.
Example: Say you import the "Simple Terrain" template in the editor. You see a terrain. The terrain has a pretty consistent "height" (distance between lowest point and highest point) everywhere, and the overall height can most easily be adjusted by changing the "Y multiplier" in the "Position Output" node. But the absolute value of the height is not really possible to see. Let's say you want to use this output as an actual landscape in your software, and you know that your software has a landscape height limit of 1000 "voxels". Either for technical reasons, or maybe in the case of a game also for gameplay reasons. It would be extremely useful then if you could already see in the FastNoise2 editor what the actual "height" of that output is so that you can tweak the output to be most useful for your usecase in your software.
In the case of the mesh preview in the FastNoise2 editor, that "height" would be the distance in blocks between the lowest Y coordinate of a block, and the highest Y coordinate of a block (Y is up/down in the editor, right?). Of course, some people might not generate such "horizontal" terrain as in the "Simple Terrain" case, so seeing values for all axis would be very useful, not just "height". In the case of the "Simple Terrain" template, the height axis would give you a value of around 30 voxels or so, and "infinite" in the other 2 axis.
The bounds could either be based on the min/max of the generated mesh preview, or it could instead display the "theoretical" min/max based on the nodes, in most cases, it should be roughly same, so doesn't really matter which way it's calculated.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.