Voxel grid

On this page 7

A voxel grid is a three-dimensional data structure that partitions space into equally sized cubic cells called voxels, each storing information such as occupancy, color, a point count or a distance value. In robotics perception, voxel grids are the standard way to downsample point clouds, build 3D occupancy maps and give planners a discrete model of free and blocked space.

The concept extends the pixel to three dimensions: where a pixel covers an area of an image, a voxel covers a volume of the world. The single most important design choice is the voxel size, because it trades geometric detail against memory, computation time and noise robustness.

How a voxel grid discretizes 3D space

A voxel grid is defined by an origin, a resolution and the grid extent. Any 3D point maps to integer voxel indices by subtracting the origin, dividing each coordinate by the voxel edge length and taking the floor. This constant-time index computation is what makes voxel grids fast for insertion and lookup.

What each voxel stores depends on the task. A downsampling filter keeps a running sum of points per cell, an occupancy map keeps a log-odds probability of occupancy, and a reconstruction pipeline keeps a signed distance to the nearest surface together with a weight. The table below summarizes common voxel payloads.

Voxel payloadTypical useMemory per voxel
Point centroidPoint cloud downsamplingAbout 12-16 bytes
Binary occupancyCollision checking1 bit to 1 byte
Log-odds occupancyProbabilistic mappingAbout 4 bytes
Truncated signed distanceSurface reconstructionAbout 8 bytes with weight
Semantic labelSemantic mapping1-4 bytes or a class histogram
Common data stored per voxel

Voxel grid downsampling of point clouds

The most widespread use of a voxel grid in perception is the voxel grid filter, which reduces a dense point cloud to one representative point per occupied voxel. Libraries such as the Point Cloud Library and Open3D implement it as a core preprocessing step before registration, segmentation or object recognition.

Two variants dominate. The centroid variant replaces all points in a voxel with their average, which smooths noise but creates points that were never measured. The nearest-point variant keeps the original point closest to the voxel center, which preserves real measurements. In both cases the filter produces a roughly uniform point density, which stabilizes algorithms such as iterative closest point that otherwise favor densely sampled regions near the sensor.

The following table shows how voxel size typically affects a LiDAR scan of an indoor or street scene. Exact point counts depend on the sensor and scene.

Voxel edge lengthRemaining detailTypical application
1-2 cmFine edges and small objectsGrasp planning and inspection
5-10 cmWalls, furniture, vehiclesRegistration and odometry
20-50 cmCoarse obstacles and terrainGlobal mapping and path planning
Above 1 mOnly large structuresLong-range coarse localization
Effect of voxel size on a typical LiDAR scan

Dense, sparse and hierarchical voxel structures

A naive voxel grid allocates every cell in a fixed volume, which grows with the cube of the extent divided by resolution. A 100 m cube at 5 cm resolution contains eight billion voxels, which is impractical. Real systems therefore use sparse or hierarchical layouts that allocate memory only where data exists.

StructureStrengthWeakness
Dense arrayFastest access, simple GPU useMemory explodes for large areas
Hashed voxel blocksScalable, near-constant lookupHash collisions and fragmentation
Octree such as OctoMapCompact, multi-resolution queriesSlower updates due to tree traversal
VDB-style treesEfficient sparse volumes at scaleMore complex implementation
Storage strategies for voxel grids

OctoMap is the classic octree-based occupancy map in robotics, while voxel hashing underlies many real-time TSDF reconstruction systems. These choices change memory and speed, but the logical model remains a voxel grid.

Using voxel grids for mapping and navigation

In mapping, each new sensor ray is traced through the grid with an algorithm such as the Amanatides-Woo traversal. Voxels the ray passes through receive a free-space update, and the voxel containing the endpoint receives an occupied update. Accumulating these updates over time with log-odds filtering removes transient noise and moving objects.

Planners then query the grid directly. A manipulator checks its collision geometry against occupied voxels, and a mobile robot projects the grid into a 2.5D costmap or runs traversability estimation on voxel columns. Unknown voxels, which no ray has observed, deserve special care because treating them as free is a common source of collisions.

  • Choose resolution from the task, roughly half the smallest obstacle that must be avoided.
  • Clamp log-odds values so the map can still adapt when the environment changes.
  • Inflate occupied voxels by the robot radius rather than shrinking the grid resolution.
  • Keep unknown space explicit in exploration and safety-critical planning.

Limitations and common pitfalls

A voxel grid introduces discretization error up to half the voxel diagonal, so thin structures such as poles, wires or table legs can vanish at coarse resolutions. Axis alignment also matters: slanted surfaces produce staircase artifacts, and results can shift when the grid origin moves.

PitfallConsequenceRemedy
Voxel size too largeThin obstacles disappearUse finer cells near the robot
Voxel size too smallSparse, noisy voxels and high memoryMatch resolution to sensor noise
Centroid smoothing on edgesCorners and features blurUse the nearest-point variant
Integer overflow in indicesCorrupted map far from originUse 64-bit keys or local submaps
Unknown treated as freeCollisions in unseen areasStore and respect unknown state
Frequent pitfalls and how to avoid them

The simple explanation

Imagine filling a room with identical transparent sugar cubes. A voxel grid is that set of cubes, and for each cube the robot writes down a note such as empty, blocked or not yet seen. Instead of tracking millions of separate laser dots, it only needs to look at the cubes.

Small cubes show fine detail but need much more memory. Large cubes are quick to handle but can hide thin things like a pole or a cable. Choosing the cube size is the main decision.

How it is used in practice

A warehouse mobile robot carries a 32-beam LiDAR that produces about 600,000 points per second. Before running scan matching, the perception stack applies a voxel grid filter with a 10 cm voxel size, which reduces each scan to roughly 15,000 to 25,000 points while keeping shelves, pallets and walls clearly defined.

The same data also updates a sparse 5 cm occupancy grid around the robot for obstacle avoidance. Forklift forks, which are thin, remain visible because the finer local grid preserves them. The result is scan matching that runs comfortably in real time on an embedded computer, while collision checks still catch low, narrow obstacles near the vehicle.