A high-performance, cross-platform C library for generating simplex noise - perfect for procedural generation, graphics programming, and game development.
Simplex noise is an improved version of Perlin noise that's faster and produces better-looking results. It's widely used in:
- Game Development - Terrain generation, texture synthesis, procedural content
- Computer Graphics - Heightmaps, cloud generation, organic patterns
- Scientific Visualization - Data representation, simulation textures
- Art & Design - Procedural art, creative coding projects
- Multi-dimensional noise - 1D, 2D, 3D, and 4D generation
- Multiple noise types - Classic, ridged, billowy, and fractal variants
- High performance - Over 28 million samples per second for 2D noise
- Image generation - Create PNG and PPM images from noise patterns
- Flexible configuration - Customizable parameters and multiple PRNG algorithms
- Cross-platform - Works on Windows, macOS, Linux, and more
- Python bindings - Easy-to-use Python wrapper with NumPy integration
- Classic Simplex - Standard smooth noise patterns
- Ridged Noise - Sharp, mountain-like formations
- Billowy Noise - Soft, cloud-like textures
- Fractal Noise - Complex, layered patterns with multiple octaves
- Domain Warping - Twisted, distorted effects
git clone https://github.com/paredezadrian/simplex-noise.git
cd simplex-noise
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)
sudo make installpip install simplex-noise#include <simplex_noise.h>
#include <stdio.h>
int main() {
// Initialize with a seed
simplex_noise_init(12345);
// Generate 2D noise
double noise_value = simplex_noise_2d(1.0, 2.0);
printf("Noise value: %.6f\n", noise_value);
// Generate fractal noise (multiple octaves)
double fractal = simplex_fractal_2d(1.0, 2.0, 4, 0.5, 2.0);
printf("Fractal noise: %.6f\n", fractal);
return 0;
}from simplex_noise import SimplexNoise
import numpy as np
# Initialize noise generator
noise = SimplexNoise(seed=42)
# Generate single values
value = noise.noise_2d(1.0, 2.0)
print(f"2D noise: {value}")
# Generate arrays
x = np.linspace(0, 10, 100)
y = np.linspace(0, 10, 100)
X, Y = np.meshgrid(x, y)
noise_array = noise.noise_2d(X, Y)
# Generate fractal noise
fractal = noise.fractal_2d(X, Y, octaves=4, persistence=0.5, lacunarity=2.0)
# Generate images
noise.generate_image("terrain.png", width=512, height=512,
color_mode="heightmap", octaves=6)#include <simplex_noise.h>
int main() {
// Create custom configuration
simplex_config_t config = simplex_get_default_config();
config.seed = 42;
config.octaves = 6;
config.persistence = 0.7;
config.lacunarity = 2.0;
config.enable_caching = 1;
// Initialize with custom settings
simplex_noise_init_advanced(&config);
// Generate noise with your settings
double noise = simplex_noise_2d(1.0, 2.0);
// Clean up when done
simplex_cleanup();
return 0;
}The library includes several example programs to get you started:
# After building
cd build
./example_2d # Visual 2D noise patterns
./example_3d # 3D noise slice visualization
./example_config # Configuration system demo
./example_fractal # Different fractal noise types
./example_image # Generate noise images (PNG/PPM)Create beautiful images from noise patterns:
#include <simplex_image.h>
int main() {
// Create image configuration
simplex_image_config_t config = simplex_get_default_image_config();
simplex_set_image_size(&config, 512, 512);
simplex_set_image_filename(&config, "my_noise.ppm");
simplex_set_color_mode(&config, SIMPLEX_COLOR_HEIGHTMAP);
// Generate image
simplex_generate_2d_image(&config);
return 0;
}- Grayscale - Classic black and white noise
- RGB - Color noise patterns
- Heightmaps - Terrain-like visualizations
- Terrain - Natural landscape colors
- 3D Slices - Cross-sections of 3D noise
- PPM - Portable pixmap (widely supported)
- PGM - Portable graymap (grayscale)
- PNG - Portable Network Graphics (with libpng)
The library is optimized for speed and efficiency:
- 2D Noise: 28.82 million samples/second
- 3D Noise: 15.2 million samples/second
- Fractal Noise: 2.1 million samples/second
- Array Generation: 45.6 million samples/second
You can save and load configurations in multiple formats:
[core]
seed=12345
octaves=6
persistence=0.7
lacunarity=2.0
[performance]
enable_caching=1
enable_profiling=1{
"simplex_noise_config": {
"core": {
"seed": 12345,
"octaves": 6,
"persistence": 0.7,
"lacunarity": 2.0
},
"performance": {
"enable_caching": true,
"enable_profiling": true
}
}
}simplex_noise_init(seed)- Initialize with seedsimplex_noise_1d(x)- Generate 1D noisesimplex_noise_2d(x, y)- Generate 2D noisesimplex_noise_3d(x, y, z)- Generate 3D noisesimplex_noise_4d(x, y, z, w)- Generate 4D noise
simplex_fractal_2d(x, y, octaves, persistence, lacunarity)- 2D fractal noisesimplex_fractal_3d(x, y, z, octaves, persistence, lacunarity)- 3D fractal noise
simplex_ridged_2d(x, y)- Ridged noisesimplex_billowy_2d(x, y)- Billowy noisesimplex_domain_warp_2d(x, y, strength)- Domain warping
simplex_load_config(filename, type, config)- Load configurationsimplex_save_config(filename, type, config)- Save configurationsimplex_print_config(config, format)- Print current settings
- C99 compatible compiler (GCC, Clang, MSVC)
- CMake 3.12+
cmake .. -DCMAKE_BUILD_TYPE=Release \
-DSIMPLEX_ENABLE_SIMD=ON \
-DSIMPLEX_BUILD_TESTS=ON \
-DSIMPLEX_BUILD_EXAMPLES=ONRun the test suite to verify everything works:
cd build && ctest// Generate terrain heightmap
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
double height = simplex_fractal_2d(x * 0.01, y * 0.01, 6, 0.5, 2.0);
heightmap[y * width + x] = height;
}
}// Generate procedural texture
for (int y = 0; y < texture_height; y++) {
for (int x = 0; x < texture_width; x++) {
double noise = simplex_noise_2d(x * 0.1, y * 0.1);
texture[y * texture_width + x] = (noise + 1.0) * 0.5; // Normalize to 0-1
}
}// Animate noise over time
for (int frame = 0; frame < num_frames; frame++) {
double time = frame * 0.1;
double noise = simplex_noise_3d(x, y, time);
// Use noise value for animation
}We welcome contributions! Here's how to get started:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Commit your changes (
git commit -m 'Add amazing feature') - Push to your branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Ken Perlin for the original Simplex Noise algorithm
- The open-source community for inspiration and feedback
- Contributors and users for their support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: See the examples and API reference above
Ready to create amazing procedural content? Clone the repository and start generating noise today!