Private GLSL utility functions
Go to file
2018-01-11 17:17:30 +09:00
convertHsvToRgb.glsl [add] glsl files. 2016-10-04 00:31:23 +09:00
convertRgbToHsv.glsl [add] glsl files. 2016-10-04 00:31:23 +09:00
gaussianBlur.glsl [add] gaussianBlur function. 2017-01-30 15:48:18 +09:00
lookAt.glsl added a new function lookAt. 2018-01-11 17:17:30 +09:00
package.json Update package.json 2016-12-27 15:16:40 +09:00
polar.glsl renamed polar function to spherical. 2018-01-11 17:16:47 +09:00
random.glsl tweak. 2017-01-30 15:48:34 +09:00
README.md [add] gaussianBlur function. 2017-01-30 15:48:18 +09:00
rotateAxisAngle.glsl added a new function rotateAxisAngle, 2018-01-11 17:17:12 +09:00

glsl-util

utility functions for glsl.

install

npm i git://github.com/ykob/glsl-util.git

convertHsvToRgb and convertRgbToHsv

this function converts RGB to HSV. or is its opposite.

http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl

#pragma glslify: convertHsvToRgb = require(glsl-util/convertHsvToRgb);
#pragma glslify: convertRgbToHsv = require(glsl-util/convertRgbToHsv);
vec3 rgb = convertHsvToRgb(vec3 hsv);
vec3 hsv = convertRgbToHsv(vec3 rgb);

random

#pragma glslify: random = require(glsl-util/random);
float p = random(vec2 c);

polar

this function calculates polar coordinates.

#pragma glslify: polar = require(glsl-util/polar);
vec3 p = polar(float radian1, float radian2, float radius);

gaussianBlur

#pragma glslify: gaussianBlur = require(glsl-util/gaussianBlur);
vec4 color = gaussianBlur(sampler2D texture, vec2 uv, float radius, vec2 resolution, vec2 direction);