opensimplexnoise

A pure nim port of the open simplex noise algorithm from Kurt Spencer

Pure Nim score 15/100 · tests present · no docs generated

Summary

Latest Version Unknown
License MIT
CI Status Failing
Downloads 0
Last Indexed 2026-07-21 05:25

Installation

nimble install opensimplexnoise
choosenim install opensimplexnoise
git clone https://github.com/betofloresbaca/nim-opensimplexnoise

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
opensimplexnoise - - - - - - -

README

Open Simplex Noise

This is a port of the open simplex noise algorithm based on KdotJPG C# Open Simplex Noise.

This implementation ports the C# implementation by KdotJPG without changing the sintax to be more nim-like, this can change in future releases to improve usage experience.

Instalation

nimble install opensimplexnoise

Usage

import opensimplexnoise

#[
    You can also provide a (seed : int64) parameter. Example:
    var noise = newOpenSimplex(141228)
]#
var noise: OpenSimplex = newOpenSimplex()

echo noise.evaluate(0.01, 0.02) # 2D noise
echo noise.evaluate(0.01, 0.02, 0.03) # 3D noise
echo noise.evaluate3XYBeforeZ(0.01, 0.02, 0.03) # 3D noise
echo noise.evaluate3XZBeforeY(0.01, 0.02, 0.03) # 3D noise
echo noise.evaluate(0.01, 0.02, 0.03, 0.04) # 4D noise

Known Issues

This is a very early version of the implementation that could have bugs, however, this was tested using a large dataset generated using the KdotJPG C# implementation (see tests/suite folder) and it passed all the tests, that means that it produces the same output as the original version.

The only possible bug that needs to be solved is that for the newOpenSimplex function there are some integer overflows needed. This is a bad practice for most programs so nim adds some checks to the generated program that avoids them throwing exceptions at running time. I tryed to disable that checks enclosing the unsecure code between {.push overflowChecks: off.} and {.pop.} but for some reason I need to also provide the -d:danger parameter in the CLI i.e. to test I run:

nimble -d:danger test

More Information

For more information about the way all the OpenSimplexNoise methods work visit the KdotJPG resources:

Thanks Kurt Spencer for developing this awesome algorithm.