GLSL built-in function
uintBitsToFloat()
Reinterprets unsigned integer bits as floating-point.
Syntax
genType uintBitsToFloat(genUType x)genType means float / vec2 / vec3 / vec4; genUType means uint / uvec2 / uvec3 / uvec4; matching placeholders use the same type.
Parameters
- x
- Input value or left-hand vector
Return value
A floating-point value or vector whose bit patterns come from the corresponding unsigned integer components.
Live example
Edit the code and the preview updates as you type.
What uintBitsToFloat does
Reinterprets unsigned integer bits as floating-point.
Read the preview
uintBitsToFloat(1065353216u) decodes to 1.0 rather than a billion-sized float. Use 1056964608u to decode 0.5 and lower the horizontal line.
Core call
uintBitsToFloat(1065353216u);
This preserves the bit pattern rather than numerically converting the large integer.
Experiment
Set the argument to 3212836864u. Its sign bit makes the decoded value -1.0, moving the result to the bottom edge despite the input being unsigned.