glsl-random
pseudo-random 2D noise for glslify
Last updated 6 years ago by mattdesl .
BSD-3-Clause · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install glsl-random 
SYNC missed versions from official npm registry.

glsl-random experimental

The classic 'one-liner' for 2D pseudo-random values in GLSL. This uses a highp version for improved randomness and better stability across GPUs, see here:
http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/

However, the 'classic' lowp version (with no precision specified) is also included here. Some may find it useful for targeted mobile GPUs.

Noise

usage

#pragma glslify: random = require(glsl-random)

...
	float rnd = random(myVec.xy);

Typically you might use it like so:

gl_FragColor = vec4( vec3( random( gl_FragCoord.xy / resolution.xy ) ), 1.0 );

default precision

Requiring the following will give you a function that doesn't specify any precision:

#pragma glslify: random = require(glsl-random/lowp)

license

BSD-3-Clause

Current Tags

  • 0.0.5                                ...           latest (6 years ago)

5 Versions

  • 0.0.5                                ...           6 years ago
  • 0.0.4                                ...           7 years ago
  • 0.0.3                                ...           7 years ago
  • 0.0.1                                ...           7 years ago
  • 0.0.0                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 3
Last Day 1
Last Week 1
Last Month 12
Dependencies (0)
None
Dev Dependencies (4)

Copyright 2014 - 2017 © taobao.org |