New research aims to unlock how spiders, whose brains are no bigger than a fly’s, builds their intricate, elegant, geometric webs—in the dark.

The spiders in Andrew Gordus’ laboratory spin their webs under close surveillance. Every movement of every one of their eight legs, every step through the two hours or so that it takes to create a web, gets recorded under infrared light.

“How does a brain encode all these behaviors in the correct sequence?” says Gordus, an assistant biology professor at Johns Hopkins University.

How much of the spider’s construction project results from genetics—and how much is a response to surroundings?

New research could eventually shed light on the abilities of higher animals, but, for now, it’s necessary to start with a creature with a tiny brain, a small genetic profile, and a behavior performed over and over.

Spiders construct an abstract shape in space. They can sense where they are in relation to this complex shape. They’re not using their vision, but some sort of spatial memory, Gordus says.

The spider appears ghostly white on a black background, legs twitching in what seems no particular pattern.

It’s a remarkable feat, if you think about it. Especially when you consider spider brains have roughly 100,000 neurons, about as many as a fruit fly. A 2009 study concluded that the average human brain has 86 billion.

To find out how spiders pull it off, the scientists put their subjects—from a species called Uloborus diversus, native to the American southwest, California, and Mexico—onto a frame inside a black box equipped with an infrared camera. The boxes close and the spiders get to work.

In the video, the spiders are black on a white background and their movements are sped up 10,000 times. In a research video, the spider appears ghostly white on a black background, legs twitching in what seems no particular pattern.

The web is invisible; the infrared light highlights the spider, so its leg movements are as clear as possible.

The Gordus lab is developing software to analyze web-building activities, down to the movement of each spider leg. Movements will be computer-cataloged and coded so that complex sequence of behavior can be broken down into small pieces.

At the same time, the team will create a genetic profile. The genome of this spider species has not been “sequenced,” so the scientists do it themselves.

Then will come the work of linking behaviors to the genome, to see what specific elements of web building are encoded in spider DNA. The researchers will disable certain genes to see how that affects the spider. As Gordus puts it, they want to figure out what the genetic “players” are in the web-building sequence.

Gordus also plans to trace the behavior through nerve pathways, to create a genetic and physiological map of behavior. Similar techniques could eventually help scientists understand higher animal behavior, but this is a start. One small spider step at a time.