Closed chris-pikul closed 7 years ago
Just pass in the vector (x, y, z) that you want perturbed, since they are passed by reference it directly perturbs the vector you used. You can then you the vector after perturbing with other noise functions.
On 20 September 2017 at 17:12, ChrisPikul510 notifications@github.com wrote:
So, I'm not sure how the GradientPerturb and GradientPerturbFractal functions work. I do want to run perturbation on my noise maps, but how do I use these for that? I'm using this in a C++ project, so code would be helpful. Just as the screenshots on the main page show is perfect (minus the colors, just using this for grayscale)
Thanks ahead of time! Awesome library
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Auburns/FastNoise/issues/14, or mute the thread https://github.com/notifications/unsubscribe-auth/ABSXrKRZEBQDhc7GmU7S-QzMCmNfIWOKks5skTlZgaJpZM4PeHnK .
Thanks for replying so fast! I just can't wrap my head around it, I see that it takes by reference, so what I'm thinking is I have this:
float* heightData; //256 * 256 array of grayscale 0-1 values for "height"
for(int y=0; y < 256; y++) {
for(int x=0; x < 256; x++) {
float newX = (float)x;
float newY = (float)y;
noise.GetGradientPerturbFractal(newX, newY);
heightData[x * 256 + y] = heightData[newX * 256 + newY]; //Override old with new co-ordinates?
}
}
Is that how this works?
Not sure what you are doing there, you can't use a float as a array lookup. Try this:
float heightData; //256 256 array of grayscale 0-1 values for"height" for(int y=0; y < 256; y++) { for(int x=0; x < 256; x++) { float newX = (float)x; float newY = (float)y; noise.GetGradientPerturbFractal(newX, newY); heightData[x * 256 + y] = noise.GetSimplex(newX, newY); //Override old with new co-ordinates? } }
@Auburns ohhh, I think I'm getting it. And that was just a scratch pad type code, I would actually in reality cast to the proper wrapping index. So is there no way to perturb an existing array of gradient data then? Or it's essentially the same thing? I ask because that heightData array is actually filled with a normalized mix between simplex and cellular with some modification. So I'm trying to perturb that to get more natural looking edges out of the blended data.
You have to perturb the input coordinates you use for the simplex and cellular noise, you can't do it after.
On 20 September 2017 at 17:50, ChrisPikul510 notifications@github.com wrote:
@Auburns https://github.com/auburns ohhh, I think I'm getting it. And that was just a scratch pad type code, I would actually in reality cast to the proper wrapping index. So is there no way to perturb an existing array of gradient data then? Or it's essentially the same thing? I ask because that heightData array is actually filled with a normalized mix between simplex and cellular with some modification. So I'm trying to perturb that to get more natural looking edges out of the blended data.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Auburns/FastNoise/issues/14#issuecomment-330913054, or mute the thread https://github.com/notifications/unsubscribe-auth/ABSXrAA4lfcgOp6popCuVY0GsUw40P-gks5skUJNgaJpZM4PeHnK .
So, I'm not sure how the
GradientPerturb
andGradientPerturbFractal
functions work. I do want to run perturbation on my noise maps, but how do I use these for that? I'm using this in a C++ project, so code would be helpful. Just as the screenshots on the main page show is perfect (minus the colors, just using this for grayscale)Thanks ahead of time! Awesome library