glsl-math

Installation
SKILL.md

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);
}
Related skills
Installs
1
GitHub Stars
2
First Seen
Apr 14, 2026