glsl-noise-template-string
TypeScript icon, indicating that this package has built-in type declarations

0.3.2 • Public • Published

🎛 glsl-noise-template-string

Use popular noise functions withing glsl written in JS Template-Strings. You do not need to add extra dependencies as this works with built-in JavaScript functionality. The package also has TypeScript Support.

This package is still experimental, so I am very happy if you report bugs or suggestions in the issue section.

Usage

Import the functions you need, add them to the Template String and you can use them in your code.

import { simplex3D, simplex4D } from 'glsl-noise-template-string'

const vertexShader = `
    ${simplex4D} 
	${simplex3D}
   
    varying vec2 vUv;
    uniform float time;
    
    void main() {
      vUv = uv;
      
      vec3 pos = position;
      pos += simplex4D(vec4(position, time));
           
      gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);
    }
`

Available Functions

  • perlin2D
  • perlin3D
  • simplex2D
  • simplex3D
  • simplex4D
  • ... more to come (add suggestion)

Upcoming Features

  • [ ] Deterministic Randomness

Package Sidebar

Install

npm i glsl-noise-template-string

Weekly Downloads

2

Version

0.3.2

License

SEE LICENSE IN LICENSE

Unpacked Size

65.9 kB

Total Files

17

Last publish

Collaborators

  • s1gr1d