simplex-noise


Namesimplex-noise JSON
Version 1.0.1 PyPI version JSON
download
home_pagehttps://github.com/paredezadrian/simplex-noise
SummaryPython wrapper for Pure C Simplex Noise library
upload_time2025-09-05 10:32:05
maintainerNone
docs_urlNone
authorAdrian Paredez
requires_python>=3.7
licenseMIT
keywords noise simplex procedural generation graphics terrain texture
VCS
bugtrack_url
requirements mkdocs mkdocs-material mkdocs-git-revision-date-localized-plugin
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Simplex Noise Library

A high-performance, cross-platform C library for generating simplex noise - perfect for procedural generation, graphics programming, and game development.

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Version](https://img.shields.io/badge/version-2.0.0-blue.svg)](https://github.com/paredezadrian/simplex-noise/releases)

## What is Simplex Noise?

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

## Features

### Core Capabilities

- **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

### Noise Variants

- **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

## Quick Start

### Installation

#### C Library

```bash
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 install
```

#### Python Bindings

```bash
pip install simplex-noise
```

### Basic Usage

#### C Library

```c
#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;
}
```

#### Python Bindings

```python
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)
```

### Advanced Configuration

```c
#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;
}
```

## Examples

The library includes several example programs to get you started:

```bash
# 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)
```

## Image Generation

Create beautiful images from noise patterns:

### Basic Usage

```c
#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;
}
```

### Image Types

- **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

### Supported Formats

- **PPM** - Portable pixmap (widely supported)
- **PGM** - Portable graymap (grayscale)
- **PNG** - Portable Network Graphics (with libpng)

## Performance

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

## Configuration Files

You can save and load configurations in multiple formats:

### INI Format

```ini
[core]
seed=12345
octaves=6
persistence=0.7
lacunarity=2.0

[performance]
enable_caching=1
enable_profiling=1
```

### JSON Format

```json
{
  "simplex_noise_config": {
    "core": {
      "seed": 12345,
      "octaves": 6,
      "persistence": 0.7,
      "lacunarity": 2.0
    },
    "performance": {
      "enable_caching": true,
      "enable_profiling": true
    }
  }
}
```

## API Reference

### Core Functions

- `simplex_noise_init(seed)` - Initialize with seed
- `simplex_noise_1d(x)` - Generate 1D noise
- `simplex_noise_2d(x, y)` - Generate 2D noise
- `simplex_noise_3d(x, y, z)` - Generate 3D noise
- `simplex_noise_4d(x, y, z, w)` - Generate 4D noise

### Fractal Functions

- `simplex_fractal_2d(x, y, octaves, persistence, lacunarity)` - 2D fractal noise
- `simplex_fractal_3d(x, y, z, octaves, persistence, lacunarity)` - 3D fractal noise

### Noise Variants

- `simplex_ridged_2d(x, y)` - Ridged noise
- `simplex_billowy_2d(x, y)` - Billowy noise
- `simplex_domain_warp_2d(x, y, strength)` - Domain warping

### Configuration

- `simplex_load_config(filename, type, config)` - Load configuration
- `simplex_save_config(filename, type, config)` - Save configuration
- `simplex_print_config(config, format)` - Print current settings

## Building from Source

### Prerequisites

- C99 compatible compiler (GCC, Clang, MSVC)
- CMake 3.12+

### Build Options

```bash
cmake .. -DCMAKE_BUILD_TYPE=Release \
         -DSIMPLEX_ENABLE_SIMD=ON \
         -DSIMPLEX_BUILD_TESTS=ON \
         -DSIMPLEX_BUILD_EXAMPLES=ON
```

## Testing

Run the test suite to verify everything works:

```bash
cd build && ctest
```

## Use Cases

### Game Development

```c
// 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;
    }
}
```

### Texture Generation

```c
// 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
    }
}
```

### Animation

```c
// 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
}
```

## Contributing

We welcome contributions! Here's how to get started:

1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Make your changes
4. Add tests for new functionality
5. Ensure all tests pass
6. Commit your changes (`git commit -m 'Add amazing feature'`)
7. Push to your branch (`git push origin feature/amazing-feature`)
8. Open a Pull Request

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Acknowledgments

- Ken Perlin for the original Simplex Noise algorithm
- The open-source community for inspiration and feedback
- Contributors and users for their support

## Support

- **Issues**: [GitHub Issues](https://github.com/paredezadrian/simplex-noise/issues)
- **Discussions**: [GitHub Discussions](https://github.com/paredezadrian/simplex-noise/discussions)
- **Documentation**: See the examples and API reference above

---

**Ready to create amazing procedural content?** Clone the repository and start generating noise today!

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/paredezadrian/simplex-noise",
    "name": "simplex-noise",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "noise, simplex, procedural, generation, graphics, terrain, texture",
    "author": "Adrian Paredez",
    "author_email": "adrian@example.com",
    "download_url": "https://files.pythonhosted.org/packages/f4/60/dc363c0f546005c82c418a6937ac36b26342adbf9397fcfbdd7dc10b9028/simplex_noise-1.0.1.tar.gz",
    "platform": "any",
    "description": "# Simplex Noise Library\n\nA high-performance, cross-platform C library for generating simplex noise - perfect for procedural generation, graphics programming, and game development.\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Version](https://img.shields.io/badge/version-2.0.0-blue.svg)](https://github.com/paredezadrian/simplex-noise/releases)\n\n## What is Simplex Noise?\n\nSimplex noise is an improved version of Perlin noise that's faster and produces better-looking results. It's widely used in:\n\n- **Game Development** - Terrain generation, texture synthesis, procedural content\n- **Computer Graphics** - Heightmaps, cloud generation, organic patterns\n- **Scientific Visualization** - Data representation, simulation textures\n- **Art & Design** - Procedural art, creative coding projects\n\n## Features\n\n### Core Capabilities\n\n- **Multi-dimensional noise** - 1D, 2D, 3D, and 4D generation\n- **Multiple noise types** - Classic, ridged, billowy, and fractal variants\n- **High performance** - Over 28 million samples per second for 2D noise\n- **Image generation** - Create PNG and PPM images from noise patterns\n- **Flexible configuration** - Customizable parameters and multiple PRNG algorithms\n- **Cross-platform** - Works on Windows, macOS, Linux, and more\n- **Python bindings** - Easy-to-use Python wrapper with NumPy integration\n\n### Noise Variants\n\n- **Classic Simplex** - Standard smooth noise patterns\n- **Ridged Noise** - Sharp, mountain-like formations\n- **Billowy Noise** - Soft, cloud-like textures\n- **Fractal Noise** - Complex, layered patterns with multiple octaves\n- **Domain Warping** - Twisted, distorted effects\n\n## Quick Start\n\n### Installation\n\n#### C Library\n\n```bash\ngit clone https://github.com/paredezadrian/simplex-noise.git\ncd simplex-noise\nmkdir build && cd build\ncmake .. -DCMAKE_BUILD_TYPE=Release\nmake -j$(nproc)\nsudo make install\n```\n\n#### Python Bindings\n\n```bash\npip install simplex-noise\n```\n\n### Basic Usage\n\n#### C Library\n\n```c\n#include <simplex_noise.h>\n#include <stdio.h>\n\nint main() {\n    // Initialize with a seed\n    simplex_noise_init(12345);\n\n    // Generate 2D noise\n    double noise_value = simplex_noise_2d(1.0, 2.0);\n    printf(\"Noise value: %.6f\\n\", noise_value);\n\n    // Generate fractal noise (multiple octaves)\n    double fractal = simplex_fractal_2d(1.0, 2.0, 4, 0.5, 2.0);\n    printf(\"Fractal noise: %.6f\\n\", fractal);\n\n    return 0;\n}\n```\n\n#### Python Bindings\n\n```python\nfrom simplex_noise import SimplexNoise\nimport numpy as np\n\n# Initialize noise generator\nnoise = SimplexNoise(seed=42)\n\n# Generate single values\nvalue = noise.noise_2d(1.0, 2.0)\nprint(f\"2D noise: {value}\")\n\n# Generate arrays\nx = np.linspace(0, 10, 100)\ny = np.linspace(0, 10, 100)\nX, Y = np.meshgrid(x, y)\nnoise_array = noise.noise_2d(X, Y)\n\n# Generate fractal noise\nfractal = noise.fractal_2d(X, Y, octaves=4, persistence=0.5, lacunarity=2.0)\n\n# Generate images\nnoise.generate_image(\"terrain.png\", width=512, height=512,\n                    color_mode=\"heightmap\", octaves=6)\n```\n\n### Advanced Configuration\n\n```c\n#include <simplex_noise.h>\n\nint main() {\n    // Create custom configuration\n    simplex_config_t config = simplex_get_default_config();\n    config.seed = 42;\n    config.octaves = 6;\n    config.persistence = 0.7;\n    config.lacunarity = 2.0;\n    config.enable_caching = 1;\n\n    // Initialize with custom settings\n    simplex_noise_init_advanced(&config);\n\n    // Generate noise with your settings\n    double noise = simplex_noise_2d(1.0, 2.0);\n\n    // Clean up when done\n    simplex_cleanup();\n\n    return 0;\n}\n```\n\n## Examples\n\nThe library includes several example programs to get you started:\n\n```bash\n# After building\ncd build\n./example_2d      # Visual 2D noise patterns\n./example_3d      # 3D noise slice visualization\n./example_config  # Configuration system demo\n./example_fractal # Different fractal noise types\n./example_image   # Generate noise images (PNG/PPM)\n```\n\n## Image Generation\n\nCreate beautiful images from noise patterns:\n\n### Basic Usage\n\n```c\n#include <simplex_image.h>\n\nint main() {\n    // Create image configuration\n    simplex_image_config_t config = simplex_get_default_image_config();\n    simplex_set_image_size(&config, 512, 512);\n    simplex_set_image_filename(&config, \"my_noise.ppm\");\n    simplex_set_color_mode(&config, SIMPLEX_COLOR_HEIGHTMAP);\n\n    // Generate image\n    simplex_generate_2d_image(&config);\n\n    return 0;\n}\n```\n\n### Image Types\n\n- **Grayscale** - Classic black and white noise\n- **RGB** - Color noise patterns\n- **Heightmaps** - Terrain-like visualizations\n- **Terrain** - Natural landscape colors\n- **3D Slices** - Cross-sections of 3D noise\n\n### Supported Formats\n\n- **PPM** - Portable pixmap (widely supported)\n- **PGM** - Portable graymap (grayscale)\n- **PNG** - Portable Network Graphics (with libpng)\n\n## Performance\n\nThe library is optimized for speed and efficiency:\n\n- **2D Noise**: 28.82 million samples/second\n- **3D Noise**: 15.2 million samples/second\n- **Fractal Noise**: 2.1 million samples/second\n- **Array Generation**: 45.6 million samples/second\n\n## Configuration Files\n\nYou can save and load configurations in multiple formats:\n\n### INI Format\n\n```ini\n[core]\nseed=12345\noctaves=6\npersistence=0.7\nlacunarity=2.0\n\n[performance]\nenable_caching=1\nenable_profiling=1\n```\n\n### JSON Format\n\n```json\n{\n  \"simplex_noise_config\": {\n    \"core\": {\n      \"seed\": 12345,\n      \"octaves\": 6,\n      \"persistence\": 0.7,\n      \"lacunarity\": 2.0\n    },\n    \"performance\": {\n      \"enable_caching\": true,\n      \"enable_profiling\": true\n    }\n  }\n}\n```\n\n## API Reference\n\n### Core Functions\n\n- `simplex_noise_init(seed)` - Initialize with seed\n- `simplex_noise_1d(x)` - Generate 1D noise\n- `simplex_noise_2d(x, y)` - Generate 2D noise\n- `simplex_noise_3d(x, y, z)` - Generate 3D noise\n- `simplex_noise_4d(x, y, z, w)` - Generate 4D noise\n\n### Fractal Functions\n\n- `simplex_fractal_2d(x, y, octaves, persistence, lacunarity)` - 2D fractal noise\n- `simplex_fractal_3d(x, y, z, octaves, persistence, lacunarity)` - 3D fractal noise\n\n### Noise Variants\n\n- `simplex_ridged_2d(x, y)` - Ridged noise\n- `simplex_billowy_2d(x, y)` - Billowy noise\n- `simplex_domain_warp_2d(x, y, strength)` - Domain warping\n\n### Configuration\n\n- `simplex_load_config(filename, type, config)` - Load configuration\n- `simplex_save_config(filename, type, config)` - Save configuration\n- `simplex_print_config(config, format)` - Print current settings\n\n## Building from Source\n\n### Prerequisites\n\n- C99 compatible compiler (GCC, Clang, MSVC)\n- CMake 3.12+\n\n### Build Options\n\n```bash\ncmake .. -DCMAKE_BUILD_TYPE=Release \\\n         -DSIMPLEX_ENABLE_SIMD=ON \\\n         -DSIMPLEX_BUILD_TESTS=ON \\\n         -DSIMPLEX_BUILD_EXAMPLES=ON\n```\n\n## Testing\n\nRun the test suite to verify everything works:\n\n```bash\ncd build && ctest\n```\n\n## Use Cases\n\n### Game Development\n\n```c\n// Generate terrain heightmap\nfor (int y = 0; y < height; y++) {\n    for (int x = 0; x < width; x++) {\n        double height = simplex_fractal_2d(x * 0.01, y * 0.01, 6, 0.5, 2.0);\n        heightmap[y * width + x] = height;\n    }\n}\n```\n\n### Texture Generation\n\n```c\n// Generate procedural texture\nfor (int y = 0; y < texture_height; y++) {\n    for (int x = 0; x < texture_width; x++) {\n        double noise = simplex_noise_2d(x * 0.1, y * 0.1);\n        texture[y * texture_width + x] = (noise + 1.0) * 0.5; // Normalize to 0-1\n    }\n}\n```\n\n### Animation\n\n```c\n// Animate noise over time\nfor (int frame = 0; frame < num_frames; frame++) {\n    double time = frame * 0.1;\n    double noise = simplex_noise_3d(x, y, time);\n    // Use noise value for animation\n}\n```\n\n## Contributing\n\nWe welcome contributions! Here's how to get started:\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Make your changes\n4. Add tests for new functionality\n5. Ensure all tests pass\n6. Commit your changes (`git commit -m 'Add amazing feature'`)\n7. Push to your branch (`git push origin feature/amazing-feature`)\n8. Open a Pull Request\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Acknowledgments\n\n- Ken Perlin for the original Simplex Noise algorithm\n- The open-source community for inspiration and feedback\n- Contributors and users for their support\n\n## Support\n\n- **Issues**: [GitHub Issues](https://github.com/paredezadrian/simplex-noise/issues)\n- **Discussions**: [GitHub Discussions](https://github.com/paredezadrian/simplex-noise/discussions)\n- **Documentation**: See the examples and API reference above\n\n---\n\n**Ready to create amazing procedural content?** Clone the repository and start generating noise today!\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python wrapper for Pure C Simplex Noise library",
    "version": "1.0.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/paredezadrian/simplex-noise/issues",
        "Documentation": "https://paredezadrian.github.io/simplex-noise/",
        "Download": "https://github.com/paredezadrian/simplex-noise/archive/v1.0.1.tar.gz",
        "Homepage": "https://github.com/paredezadrian/simplex-noise",
        "Source Code": "https://github.com/paredezadrian/simplex-noise"
    },
    "split_keywords": [
        "noise",
        " simplex",
        " procedural",
        " generation",
        " graphics",
        " terrain",
        " texture"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "888e9b6fce0879a6a23fb7dce0a4147efa6d02c66e2ce14d33b04a718fe8bf2c",
                "md5": "8a1a4a0b75d1e49696c8b36791dc0188",
                "sha256": "236a4012a60c71f5dcf83c91462137e9ec3e677d826e6e736de17f98b9fcbf6a"
            },
            "downloads": -1,
            "filename": "simplex_noise-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8a1a4a0b75d1e49696c8b36791dc0188",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 8698,
            "upload_time": "2025-09-05T10:32:04",
            "upload_time_iso_8601": "2025-09-05T10:32:04.756976Z",
            "url": "https://files.pythonhosted.org/packages/88/8e/9b6fce0879a6a23fb7dce0a4147efa6d02c66e2ce14d33b04a718fe8bf2c/simplex_noise-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f460dc363c0f546005c82c418a6937ac36b26342adbf9397fcfbdd7dc10b9028",
                "md5": "a598560750614ef306d0980ada97e255",
                "sha256": "45efa44cadb19c5a8e9c4b5803b308856ee63857446dba5a9d97072cbbcae59a"
            },
            "downloads": -1,
            "filename": "simplex_noise-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "a598560750614ef306d0980ada97e255",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 19078,
            "upload_time": "2025-09-05T10:32:05",
            "upload_time_iso_8601": "2025-09-05T10:32:05.908033Z",
            "url": "https://files.pythonhosted.org/packages/f4/60/dc363c0f546005c82c418a6937ac36b26342adbf9397fcfbdd7dc10b9028/simplex_noise-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-05 10:32:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "paredezadrian",
    "github_project": "simplex-noise",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "mkdocs",
            "specs": [
                [
                    ">=",
                    "1.6.0"
                ]
            ]
        },
        {
            "name": "mkdocs-material",
            "specs": [
                [
                    ">=",
                    "9.6.0"
                ]
            ]
        },
        {
            "name": "mkdocs-git-revision-date-localized-plugin",
            "specs": [
                [
                    ">=",
                    "1.4.0"
                ]
            ]
        }
    ],
    "lcname": "simplex-noise"
}
        
Elapsed time: 7.77403s