kdotjpg / opensimplex2 Goto Github PK
View Code? Open in Web Editor NEWSuccessors to OpenSimplex Noise, plus updated OpenSimplex.
License: Creative Commons Zero v1.0 Universal
Successors to OpenSimplex Noise, plus updated OpenSimplex.
License: Creative Commons Zero v1.0 Universal
I'm trying to understand the difference between the GLSL* and C# versions of the algorithm. I created textures from both of them and although they actual values are not identical, the quality of the noise looks identical. Is the GLSL version of the noise supposed to be somehow inferior because it cannot store the perm
and permGrad
states?
If I wanted identical versions on the CPU and GPU, would I be good to just translate the GLSL version directly to C#?
Also want to say, thanks so much for creating OpenSimplex! It's really awesome stuff. :)
*by the GLSL version I mean bccNoise8Point.glsl
specifically.
Hello, and thank you for all your work. I am in the process of porting these various algorithms to Common Lisp. So far I ported 2F 2D, and I'm currently wondering if my 2F 3D implementation is correct. It seems to look too regular compared to your examples, though they do share some similarities. This is difficult to debug, as I'm not seeing any graphical artifacts or anything. I am not sure if what I have looks correct or not after staring at it for so long. Below is a 2D slice of 2F 3D XY/Z, though results look pretty similar to Classic. For completion, I also provided an animated gif, moving through the third axis. My goal is to finish a correct implementation in Common Lisp, so that I can submit a PR to your repository. Thank you for your help.
Edit: My version seems to be very sparse compared to yours, with features packed much more closer together in yours.
As mentioned here my understanding is that using code under a CC0 license in a project opens one up to legal risk, as no patents are waived.
This is contrary to a license like GPLv3, which contains this:
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
Hi @KdotJPG, I'm using the _old
version of the C# one (but I haven't seen it in any others as well) and was looking for 1D generators.
Can it be made from using the 2D generator along one axis, or is there a proper way to do it?
Also, the reason I'm using the _old
one is because it seems more optimised by caching more, is this accurate?
Thanks!
Hi @KdotJPG ๐ First of, I want to say I really appreciate your efforts, great work on OpenSimplex ๐
As I am currently in the process of porting OpenSimplex2 to Dart, I am trying to understand how it works exactly.
I am basing my efforts off of the Java implementation and I am confused by the areagen
directory.
So my struggle is that I want to understand what I can recommend to use.
If I copy your implementation and basically have two different libraries (the regular one and the areagen
one) that kind of do the same, it will be very confusing as to which one you should use.
This makes me wonder about two things:
The README mentions:
The classes in java/areagen offer speed-optimized whole-area generators, which operate by flood-fill queue on the noise lattice. (i.e. they don't use a "range")
I do not understand the second part of that statement (what are "whole-area generators" and the "flood-fill queue"?)
Flood fill says something to me, but then what does this mean for the end user?
The only differences between the two versions' area generators are: radius parameter and normalization constant.
The radius can be straightforwardly reduced for faster noise, or increased for smoother noise. There are no geometric traversal steps to cause discontinuities, and no hardcoded point computations to limit performance increases, as would be the case with varying the radius in the evaluators.
The normalization constant is baked into the same gradient set as the evaluator. It can be recomputed using Noise Normalizer. If left as is, the noise will still function correctly, it will just have a different output range.
This whole section I am really not sure about. I checked the classes and usage looked the same to me, so I am very confused about what this is trying to say.
I will go with the non-areagen library for now (which might be slower?) as I do not have answers to these questions. It would be super awesome if you could shed some light on these questions ๐
Say, porting OpenSimplex to Scala:
def eval[N <: Nat](coords: Sized[N, Double])(implicit ev: OpenSimplex[N]): Double
What constants can't be calculated (i.e. they would have to be included in OpenSimplex
)? Is it possible to generalize the algorithm over N
?
Grad3 is there but grad2 array is missing.
Looking at the rust code, it seems that the interface can be trivially used from C if exported correctly. I have previously ported the C# version to a language I use, but it was the old version and it would probably be a lot of work to update it after a couple years. Enabling C FFI from the rust version seems like the easiest way to impact the maximum of languages possible.
Could you enlighten us on the method you use to calculate the scaling factors of your noise algorithms? Some example code would be much appreciated. Thank you.
Why does double noise = OpenSimplex2.noise2(seed, 0d , 0d);
always return zero no matter what the seed is?
I'm seeing an error in the matrix derivative line here:
128: vec3 derivative = -8.0 * mat4x3(d1, d2, d3, d4) * (aa * a * extrapolations)
^^^ ERROR: '=' : cannot convert from 'highp 4-component vector of float' to 'highp 3-component vector of float'
129: + mat4x3(g1, g2, g3, g4) * aaaa;
^^^ ERROR: 'mat4x3' : no matching overloaded function found
I know WebGL is an older version of GLSL, maybe too old for this specific implementation?
Maybe a fix is out of scope for your library, or maybe the error I'm seeing has to do with my specific webGL wrapper - possible I'm missing something.
I am porting this file to Swift to use in an art project and was wondering why the use of floats in this version? A lot of functions take double parameters but return a float. Is this just because the the output of the noise is generally mapped to something like an RGB value or angle or height map etc and accuracy there tends not to be that important ?
It seems performance suffers greatly due to the exponentiation of seed
by SEED_FLIP_3D
in the one loop iteration. How is this constant calculated, and is its value significant, over just xor
ing the seed or something? Without this exponentiation, OpenSImplex2 3D is twice as fast in implementations I wrote in a couple languages (I have not measured your C# and Java versions).
When I try to get noise using the 2D function, I get an out of range exception.
Here's my usage:
float max = 0.0f;
float min = 0.0f;
float sum = 0.0f;
float frequency = scale;
float amplitude = 1.0f;
float x = xin;
float y = yin;
for (int i = 0; i < octaves; i++)
{
x = x * frequency;
y = y * frequency;
float v = (float)noiseGenerator.Noise2(x, y);
sum += v * amplitude;
max += amplitude;
min -= amplitude;
frequency *= lacunarity;
amplitude *= persistance;
}
return (sum - min) / (max - min);
In particular when "scale" is at sizes at around 20 or so or higher.
e: The issue also occurs if I attempt to use Classic Simplex Noise.
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.