Skip to content

Instantly share code, notes, and snippets.

@supertask
Created December 8, 2022 05:14
Show Gist options
  • Save supertask/702439b84a341e5f45c79358135c9df6 to your computer and use it in GitHub Desktop.
Save supertask/702439b84a341e5f45c79358135c9df6 to your computer and use it in GitHub Desktop.
remap on C# / HLSL
float remap(float v, float minOld, float maxOld, float minNew, float maxNew) {
return minNew + (v-minOld) * (maxNew - minNew) / (maxOld-minOld);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment