14.04.2016, 18:04
(
Последний раз редактировалось Crayder; 15.04.2016 в 12:51.
)
Simplex Noise Generator!
__________________________________________________ __________________________________________________
Description:
This library basically adds a bunch of noise functions that you can use for various things.
So far I've converted the following functions from C++ to PAWN:
I used parts of this for my forest generator, which some of you may have heard of. For those who haven't heard of it, it's a random forest generator. I generated multiple forests over a 3000 unit radius, so it covers all of SA. It has random clearings, camp areas, and rubbish areas. It also has various trees in their own areas (kind of like biomes), bushes, and rocks.
__________________________________________________ __________________________________________________
Examples:
Output:
__________________________________________________ __________________________________________________
Credits:
simongeilfus for the original library in C++ : https://github.com/simongeilfus/SimplexNoise
__________________________________________________ __________________________________________________
Download!
__________________________________________________ __________________________________________________
Description:
This library basically adds a bunch of noise functions that you can use for various things.
So far I've converted the following functions from C++ to PAWN:
pawn Код:
// Returns a 1D simplex noise
Float:noise1D(Float:x);
// Returns a 2D simplex noise
Float:noise2D(Float:x, Float:y);
// Returns a 3D simplex noise
Float:noise3D(Float:x, Float:y, Float:z);
// Returns a 4D simplex noise
Float:noise4D(Float:x, Float:y, Float:z, Float:w);
// Returns a 1D simplex ridged noise
Float:ridgedNoise1D(Float:x);
// Returns a 2D simplex ridged noise
Float:ridgedNoise2D(Float:x, Float:y);
// Returns a 3D simplex ridged noise
Float:ridgedNoise3D(Float:x, Float:y, Float:z);
// Returns a 4D simplex ridged noise
Float:ridgedNoise4D(Float:x, Float:y, Float:z, Float:w);
// Returns a 1D simplex noise with analytical derivative.
dnoise1D(Float:x, &Float:rx, &Float:ry)
// Returns a 2D simplex noise with analytical derivatives.
dnoise2D(Float:x, Float:y, &Float:rx, &Float:ry, &Float:rz)
// Returns a 3D simplex noise with analytical derivatives.
dnoise3D(Float:x, Float:y, Float:z, &Float:rx, &Float:ry, &Float:rz, &Float:rw)
// Returns a 2D simplex cellular/worley noise
Float:worleyNoise2D(Float:x, Float:y)
// Returns a 3D simplex cellular/worley noise
Float:worleyNoise3D(Float:x, Float:y, Float:z)
// Returns a 2D simplex smooth cellular/worley noise
Float:worleyNoise2D_F(Float:x, Float:y, Float:falloff)
// Returns a 3D simplex smooth cellular/worley noise
Float:worleyNoise3D_F(Float:x, Float:y, Float:z, Float:falloff)
I used parts of this for my forest generator, which some of you may have heard of. For those who haven't heard of it, it's a random forest generator. I generated multiple forests over a 3000 unit radius, so it covers all of SA. It has random clearings, camp areas, and rubbish areas. It also has various trees in their own areas (kind of like biomes), bushes, and rocks.
__________________________________________________ __________________________________________________
Examples:
pawn Код:
main() {
printf("noise1D: %f", noise1D(-45.1231));
printf("noise2D: %f", noise2D(-45.1231, 10.9453));
printf("noise3D: %f", noise3D(-45.1231, 10.9453, 32.3621));
printf("noise4D: %f", noise4D(-45.1231, 10.9453, 32.3621, 100.6343));
printf("ridgedNoise1D: %f", ridgedNoise1D(-45.1231));
printf("ridgedNoise2D: %f", ridgedNoise2D(-45.1231, 10.9453));
printf("ridgedNoise3D: %f", ridgedNoise3D(-45.1231, 10.9453, 32.3621));
printf("ridgedNoise4D: %f", ridgedNoise4D(-45.1231, 10.9453, 32.3621, 100.6343));
new Float:rx, Float:ry, Float:rz, Float:rw;
dnoise1D(100.5, rx, ry);
printf("dnoise1D: %f, %f", rx, ry);
dnoise2D(110.53, -20.5, rx, ry, rz);
printf("dnoise2D: %f, %f, %f", rx, ry, rz);
dnoise3D(110.53, -20.85, 9.12, rx, ry, rz, rw);
printf("dnoise3D: %f, %f, %f, %f", rx, ry, rz, rw);
printf("worleyNoise2D: %f", worleyNoise2D(13.0, -34.1));
printf("worleyNoise3D: %f", worleyNoise3D(13.52321, -34.1, -34.4));
printf("worleyNoise2D_F: %f", worleyNoise2D_F(13.0, -34.1, 10.0));
printf("worleyNoise3D_F: %f", worleyNoise3D_F(13.52321, -34.1, -34.4, 10.0));
}
Quote:
noise1D: 0.117055 noise2D: -0.613689 noise3D: 0.060025 noise4D: -0.237536 ridgedNoise1D: 0.882944 ridgedNoise2D: 0.386310 ridgedNoise3D: 0.939974 ridgedNoise4D: 0.762463 dnoise1D: -0.875976, 9.531250 dnoise2D: 0.325981, -2.015559, -1.042779 dnoise3D: -0.662052, 1.085515, 0.660695, 1.227718 worleyNoise2D: 0.640313 worleyNoise3D: 0.412964 worleyNoise2D_F: 0.238459 worleyNoise3D_F: 0.173266 |
Credits:
simongeilfus for the original library in C++ : https://github.com/simongeilfus/SimplexNoise
__________________________________________________ __________________________________________________
Download!