PDA

View Full Version : ranges



giuseppe500
12-06-2012, 07:43 AM
hello.
How i can adapt a range from x to y to a range from 0 to 1 in glsl?
for example : if i have a x = -20 and a y = 200 how to fit in a 0 to 1 range?
there is an already done function?
thanks.

thokra
12-07-2012, 02:20 AM
Nope there isn't. The example isn't very helpful. Normalizing values is only helpful if you have a minimum and maximum you want to push the values into so the min value maps to 0 and the max value maps to 1.