uintBitsToFloat
uintBitsToFloat
Bitcast: reinterpret the bit pattern of a `uint` or `uvecN` as a `float` or `vecN` with no numeric conversion. Output component count matches the input.
Core Advantages
Zero‑cost type punning between unsigned integers and floats, ideal for restoring IEEE‑754 values from integer textures/buffers into the float pipeline.
Common Uses
Recover IEEE‑754 floats from R32UI/RGBA32UI data textures or SSBOs
Pair with `floatBitsToUint` for reversible packing/transport
Convert `uvecN` back to `vecN` to continue float‑based shading
How to adjust
Provide `uint` or `uvecN` input. Output becomes `float/vecN` according to vector length. No arithmetic is performed; results may be NaN/Inf depending on input bits. Use `floatBitsToUint` for the inverse; use `intBitsToFloat` if the source is signed.
Code Examples
1<Canvas>
2 <mesh>
3 <sphereGeometry args={[0.4, 128, 128]} />
4 <meshStandardNodeMaterial
5 colorNode={
6 vec3(
7 uintBitsToFloat(
8 uint( 0x3F800000 ) // bit pattern of 1.0f
9 )
10 )
11 }
12 />
13 </mesh>
14</Canvas>