glsl-math
GLSL Math Utilities
Remap / Map Range
// Map value from [inMin, inMax] to [outMin, outMax]
float remap(float value, float inMin, float inMax, float outMin, float outMax) {
return outMin + (outMax - outMin) * (value - inMin) / (inMax - inMin);
}
// Map value from [inMin, inMax] to [0, 1]
float toUnit(float value, float inMin, float inMax) {
return (value - inMin) / (inMax - inMin);
}
// Map value from [0, 1] to [outMin, outMax]
float fromUnit(float t, float outMin, float outMax) {
return mix(outMin, outMax, t);
}
More from devallibus/shaderbase-skills
glsl-sdf
GLSL signed distance fields — 2D/3D primitives, boolean operations, ray marching. Use when creating geometric shapes, text effects, procedural geometry, or ray-marched scenes.
1glsl-color
GLSL color space operations — HSV, cosine palettes, tonemapping, OKLab, sRGB. Use when working with color manipulation, gradients, palettes, or HDR rendering.
1glsl-noise
GLSL noise functions — hash, value, simplex, FBM, Voronoi, Worley. Use when generating procedural textures, terrain, organic patterns, or animated effects.
1glsl-coordinates
GLSL space transformations — rotation, polar/spherical, tiling, domain repetition. Use when manipulating coordinate spaces, creating patterns, or transforming geometry.
1shaderbase-manifest
Writing shader.json manifests for the ShaderBase registry — schema reference, capability profiles, uniforms, provenance tracking. Use when creating or editing ShaderBase shader packages.
1shaderbase-recipes
Writing Three.js and React Three Fiber integration recipes for ShaderBase shaders — factory functions, component patterns, placeholders, requirements. Use when creating shader integration code for the ShaderBase registry.
1