When objects are closer together, we automatically perceive them as being in a group. Again, that sounds obvious, but it’s pretty interesting how it works. For example, proximity actually often trumps similarity.
In the lefthand example below, you see a group of 18 circles; in the righthand, 2 groups of 9. These circles haven’t changed in form—I’ve merely added more space between them. In other words, the ground has now expanded to create two figures where there was once one.
You can also see in the lefthand example below there are two groups—one of grey circles and one of green circles. Then, on the right, proximity takes precedence and you have two groups of mixed circles—the black orange distinction stops having as much power.