• Stars
    star
    127
  • Rank 282,790 (Top 6 %)
  • Language
    C++
  • Created over 8 years ago
  • Updated about 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Collection of Simplex Noise functions

Simplex Noise

Alternative to ci::Perlin class.

This code is originally intended for use with the Cinder C++ library but only depends on GLM.

Simplex noise is better looking, faster and has proper derivatives without the grid artifacts of Perlin noise derivatives. This code is mostly ported from Stefan Gustavson public domain implementation for the simplex noise, simplex flow noise and their analytical derivatives. The curl noise functions are adapted from Robert Bridson papers to use derivatives instead of finite differences. There's also a series of noise sums and other multi-fractals noises...

//! Returns a 1D simplex noise
float noise( float x );
//! Returns a 2D simplex noise
float noise( const glm::vec2 &v );
//! Returns a 3D simplex noise
float noise( const glm::vec3 &v );
//! Returns a 4D simplex noise
float noise( const glm::vec4 &v );

//! Returns a 1D simplex ridged noise
float ridgedNoise( float x );
//! Returns a 2D simplex ridged noise
float ridgedNoise( const glm::vec2 &v );
//! Returns a 3D simplex ridged noise
float ridgedNoise( const glm::vec3 &v );
//! Returns a 4D simplex ridged noise
float ridgedNoise( const glm::vec4 &v );

//! Returns a 1D simplex noise with analytical derivative.
glm::vec2 dnoise( float x );
//! Returns a 2D simplex noise with analytical derivatives.
glm::vec3 dnoise( const glm::vec2 &v );
//! Returns a 3D simplex noise with analytical derivatives.
glm::vec4 dnoise( const glm::vec3 &v );
// not optimal but easiest way to return 5 floats
typedef std::array<float,5> vec5;
//! Returns a 4D simplex noise with analytical derivatives
vec5	dnoise( const glm::vec4 &v );
	
//! Returns a 2D simplex cellular/worley noise
float worleyNoise( const glm::vec2 &v );
//! Returns a 3D simplex cellular/worley noise
float worleyNoise( const glm::vec3 &v );
//! Returns a 2D simplex smooth cellular/worley noise
float worleyNoise( const glm::vec2 &v, float falloff );
//! Returns a 3D simplex smooth cellular/worley noise
float worleyNoise( const glm::vec3 &v, float falloff );

//! Returns a 2D simplex noise with rotating gradients
float flowNoise( const glm::vec2 &v, float angle );
//! Returns a 3D simplex noise with rotating gradients
float flowNoise( const glm::vec3 &v, float angle );

//! Returns a 2D simplex noise with rotating gradients and analytical derivatives
glm::vec3 dFlowNoise( const glm::vec2 &v, float angle );
//! Returns a 3D simplex noise with rotating gradients and analytical derivatives
glm::vec4 dFlowNoise( const glm::vec3 &v, float angle );

//! Returns the curl of a 2D simplex noise
glm::vec2 curlNoise( const glm::vec2 &v );
//! Returns the curl of a 2D simplex flow noise
glm::vec2 curlNoise( const glm::vec2 &v, float t );
//! Returns the curl of a 2D simplex noise fractal brownian motion sum
glm::vec2 curlNoise( const glm::vec2 &v, uint8_t octaves, float lacunarity, float gain );
//! Returns the curl of a 3D simplex noise
glm::vec3 curlNoise( const glm::vec3 &v );
//! Returns the curl of a 3D simplex flow noise
glm::vec3 curlNoise( const glm::vec3 &v, float t );
//! Returns the curl approximation of a 3D simplex noise fractal brownian motion sum
glm::vec3 curlNoise( const glm::vec3 &v, uint8_t octaves, float lacunarity, float gain );

//! Returns the curl of a custom 2D potential using finite difference approximation
glm::vec2 curl( const glm::vec2 &v, const std::function<float(const glm::vec2&)> &potential, float delta = 1e-4f );
//! Returns the curl of a custom 3D potential using finite difference approximation
glm::vec3 curl( const glm::vec3 &v, const std::function<glm::vec3(const glm::vec3&)> &potential, float delta = 1e-4f );

//! Returns a 1D simplex noise fractal brownian motion sum
float fBm( float x, uint8_t octaves = 4, float lacunarity = 2.0f, float gain = 0.5f );
//! Returns a 2D simplex noise fractal brownian motion sum
float fBm( const glm::vec2 &v, uint8_t octaves = 4, float lacunarity = 2.0f, float gain = 0.5f );
//! Returns a 3D simplex noise fractal brownian motion sum
float fBm( const glm::vec3 &v, uint8_t octaves = 4, float lacunarity = 2.0f, float gain = 0.5f );
//! Returns a 4D simplex noise fractal brownian motion sum
float fBm( const glm::vec4 &v, uint8_t octaves = 4, float lacunarity = 2.0f, float gain = 0.5f );

//! Returns a 1D simplex noise fractal brownian motion sum with analytical derivatives
glm::vec2 dfBm( float x, uint8_t octaves = 4, float lacunarity = 2.0f, float gain = 0.5f );
//! Returns a 2D simplex noise fractal brownian motion sum with analytical derivatives
glm::vec3 dfBm( const glm::vec2 &v, uint8_t octaves = 4, float lacunarity = 2.0f, float gain = 0.5f );
//! Returns a 3D simplex noise fractal brownian motion sum with analytical derivatives
glm::vec4 dfBm( const glm::vec3 &v, uint8_t octaves = 4, float lacunarity = 2.0f, float gain = 0.5f );
//! Returns a 4D simplex noise fractal brownian motion sum with analytical derivatives
vec5	dfBm( const glm::vec4 &v, uint8_t octaves = 4, float lacunarity = 2.0f, float gain = 0.5f );

//! Returns a 1D simplex ridged multi-fractal noise sum
float ridgedMF( float x, float ridgeOffset = 1.0f, uint8_t octaves = 4, float lacunarity = 2.0f, float gain = 0.5f );
//! Returns a 2D simplex ridged multi-fractal noise sum
float ridgedMF( const glm::vec2 &v, float ridgeOffset = 1.0f, uint8_t octaves = 4, float lacunarity = 2.0f, float gain = 0.5f );
//! Returns a 3D simplex ridged multi-fractal noise sum
float ridgedMF( const glm::vec3 &v, float ridgeOffset = 1.0f, uint8_t octaves = 4, float lacunarity = 2.0f, float gain = 0.5f );
//! Returns a 4D simplex ridged multi-fractal noise sum
float ridgedMF( const glm::vec4 &v, float ridgeOffset = 1.0f, uint8_t octaves = 4, float lacunarity = 2.0f, float gain = 0.5f );

//! Returns the 2D simplex noise fractal brownian motion sum variation by Iñigo Quilez
float iqfBm( const glm::vec2 &v, uint8_t octaves = 4, float lacunarity = 2.0f, float gain = 0.5f );
//! Returns the 2D simplex noise fractal brownian motion sum variation by Iñigo Quilez
float iqfBm( const glm::vec3 &v, uint8_t octaves = 4, float lacunarity = 2.0f, float gain = 0.5f );

//! Returns the 2D simplex noise fractal brownian motion sum variation by Iñigo Quilez that use a mat2 to transform each octave
float iqMatfBm( const glm::vec2 &v, uint8_t octaves = 4, const glm::mat2 &mat = glm::mat2( 1.6, -1.2, 1.2, 1.6 ), float gain = 0.5f );

//! Seeds the permutation table with new random values
void seed( uint32_t s );

More Repositories

1

Cinder-Experiments

A collection of experiments, samples and other bits of code.
C++
231
star
2

Cinder-ImGui

Dear ImGui Renderer/Wrapper for Cinder
C++
156
star
3

Watchdog

File / directory watcher for c++11 and boost
C++
123
star
4

GroveApp

C++
101
star
5

Cinder-Runtime

Runtime-Compiled C++ for Cinder
C++
57
star
6

FlyingTokyo19

Cinder C++ Workshop at Rhizomatiks - FlyingTokyo19 - May 2016
C++
57
star
7

SpacePartitioning

A collection of Space Partitioning Algorithms for Cinder
C++
45
star
8

Cinder-CodeEditor

In-App full-featured Code Editor
JavaScript
25
star
9

Cinder-OculusRift

HMD Camera setup and lense distortion for the Oculus Rift.
C++
24
star
10

Cinder-AssetManager

Supports hot reloading and asynchronous loading of assets (Replaced by https://github.com/simongeilfus/Watchdog)
C++
19
star
11

Cinder-Cereal

Add serialization support for Cinder's classes.
C++
17
star
12

HalfEdge

Work in progress Half-Edge mesh library
C++
16
star
13

Cinder-Cmft

Thin wrapper around Cmft for use with Cinder
C++
12
star
14

SharedMemoryUtils

C++
11
star
15

Cinder-Angelscript

Thin cinder wrapper around Angelscript
C++
10
star
16

PoissonDiskDistribution

C++
9
star
17

Cinder-SLB

Lua Scripting for Cinder ( Wrap SLB and luaGL )
C
8
star
18

CinderAndScriptsClass

C++
8
star
19

Triangulation

C++
7
star
20

Cinder-LiveAssetManager

New block here : https://github.com/simongeilfus/Cinder-AssetManager
C++
7
star
21

FontAwesomeCpp

Helper and generator classes to ease the use of FontAwesome in c++.
C++
7
star
22

Paleodictyon-Gwen-Wrapper

C++
6
star
23

Cinder-Chipmunk

Basic OO Chipmunk wrapper for Cinder.
Objective-C
5
star
24

Cinder-Gx

C++
5
star
25

Cinder-Qhull

Qhull block for Cinder
C
4
star
26

Cinder-GlslProgHelper

Adds preprocessor features to Cinder::GlslProg ( #include, #define, etc... )
C++
3
star
27

Cinder-Gizmo

Basic 3D manipulation library for Cinder.
C++
2
star
28

Cinder-OpenMesh

OpenMesh library
C++
2
star
29

Cinder-Shader

Small addition to Cinder's Glsl Shaders. Allow attrib location binding, transform feedback and auto reloading while you edit the code.
C++
2
star
30

project_starter_kit

c++ project starter kit
C++
1
star
31

Cinder-Gwen-1

Gwen (GUI Without Extravagant Nonsense) for Cinder
C++
1
star
32

Clang-Parser

C++
1
star
33

CinderCMakeBoilerplate

Basic project structure and tools for working with Cinder and CMake
CMake
1
star
34

LuaBindings

Sources for Cinder-LuaBind / libLuaBindings.a
C++
1
star
35

NvidiaEnablement

One-liner block for Cinder to force enable Nvidia Optimus on windows laptops
C
1
star