float3
float3 is a three-component vector type used in shading languages such as HLSL. It represents a 3D vector of 32-bit single-precision floats and is commonly used to encode positions, directions, normals, or RGB colors in graphics pipelines.
A float3 contains components named x, y, and z, with alternative swizzles using r, g, and b.
Operations on float3 include vector arithmetic (addition, subtraction, scaling), dot product (dot(a,b)), cross product (cross(a,b)), length(v)
In shaders, float3 is used for 3D positions in world or view space, direction vectors, normals, or
Memory and layout: a float3 consists of 12 bytes. In practice, GPU memory layouts often apply padding
Example in HLSL: float3 position = float3(1.0, 2.0, 3.0); float3 dir = normalize(position);