cuda-noise
cuda-noise copied to clipboard
Library of common noise functions for CUDA kernels
cudaNoise
Library of common noise functions for CUDA kernels
Device functions for use in CUDA kernels which provide tools for generating procedural 3D noise. Basis noise functions can be combined for fractional Brownian motion, as well as used to perturb the input vector for other noise functions for turbulence effects.
Basis functions
Basis functions include: discrete noise, tricubic value noise, perlin gradient noise, simplex noise, spots and worley noise.
Derived functions
Repeater turbulence of perlin noise functions.
Usage
cudaNoise comes as a single-header include library. Simply include cuda_noise.cuh in your CUDA source file, then call the cudaNoise functions from kernel or device functions.
NOTE: cudaNoise is designed to be used from inside CUDA kernels and cannot directly be called from host code
There is a simple texture viewer included in the /examples directory.
Reference
Basis functions
3D Checker pattern
float checker(float3 pos, float scale, int seed)
3D Discrete noise
float discreteNoise(float3 pos, float scale, int seed)
3D Linear value noise
float linearValue(float3 pos, float scale, int seed)
3D Cubic value noise
float cubicValue(float3 pos, float scale, int seed)
3D Perlin gradient noise
float perlinNoise(float3 pos, float scale, int seed)
3D Simplex noise
float simplexNoise(float3 pos, float scale, int seed)
3D Worley cellular noise
float worleyNoise(float3 pos, float scale, int seed, float size, int minNum, int maxNum, float jitter)
3D Spots
float spots(float3 pos, float scale, int seed, float size, int minNum, int maxNum, float jitter, profileShape shape)
TODO
- Implement 4D noise functions.
- Optimization work.
- Add more types of cellular functions.
- Cleaning up the interface.
Contributions are more than welcome!