Spark2D.Sneak.Peak.mp4
WIP. Under Active development. Follow @Singtaa for updates.
The OneJS bindings are available at https://github.com/Singtaa/onejs-spark2d. Currently, the library contains the following compute shaders:
- fbm: Fractal Brownian Motion for generating noise
- sdfield: Signed Distance Field for generating 2D shapes
- sdgen: Jump Flood based SDF generation
- maop: Math Operations for common math operations
- trans: Transformations for rotating, scaling, and translating textures
- blur: Gaussian Blur for blurring textures
- grad: Gradient for generating multi-color linear gradients
- dye: for applying multi-color gradients to greyscale textures
sdfield
contains almost all the 2D shapes on Inigo Quilez's page.
maop
contains the following ops:
// Basic
#define OP_ADD 0
#define OP_SUBTRACT 1
#define OP_MULTIPLY 2
#define OP_DIVIDE 3
#define OP_POW 4
#define OP_SQRT 5
// Range
#define OP_CLAMP 16
#define OP_FRACTION 17
#define OP_MAXIMUM 18
#define OP_MINIMUM 19
#define OP_ONE_MINUS 20
#define OP_RANDOM_RANGE 21
#define OP_REMAP 22
#define OP_SATURATE 23
// Advanced
#define OP_ABSOLUTE 32
#define OP_EXPONENTIAL 33
#define OP_LENGTH 34
#define OP_LOG 35
#define OP_MODULO 36
#define OP_NEGATE 37
#define OP_NORMALIZE 38
#define OP_POSTERIZE 39
#define OP_RECIPROCAL 40
#define OP_RECIPROCAL_SQRT 41
Besides the compute shaders, the library also contains a Bursted (faster) version of CatlikeCoding's SDF Texture Generator.
The goal is to add many more useful 2D algorithms and compute shaders to this library. A 2D particle system is also in the works.