Computer scientists at Princeton University have created a computer algorithm which simulates paint brush strokes in considerable detail.

Computer simulations struggle to recreate the complex, varied, random and accidental results of human art and design. This has been true for paint brush strokes particularly, which typically require hours of effort just to mimic the smallest strokes.

A new program has been designed to make the process far easier, producing realistic brushstrokes including smudging, smearing, spines and other fine elements of brushwork.

“Our goal is to have it look like a photograph of a real stroke but to have it follow whatever path you happen to be drawing,” said Adam Finkelstein, a computer science professor and the senior researcher on the project.

“The challenge is if you have a photo of a paint stroke, how do you make it fit a different path?”

The program, called ‘RealBrush’, allows users to input samples of strokes from whatever they like – oil paint, smeared toothpaste, nail polish or anything else - the program uses the sample brushstrokes as baselines indicating fundamental characteristics of the strokes. RealBrush works by looking at the centre line, or spine, of a segment to help determine a basic shape, which can then be warped and moulded in any direction.

“We use feature matching — it is a machine-learning approach... based on the shape of the spine, we want to find segments of the exemplar that have a similar spine and use the segments to make similar shapes,” said Jingwan Lu, a graduate student in computer science who was the lead author of a paper published this week.

“For each style, we need about 20 to 30 strokes,” Lu said.

“If you are a casual user, you can use pre-captured strokes. Or you can paint your own strokes and record those in our system. You can share those with your friends.”

The collaborative influence of ‘big data’ infrastructure has influenced the new paintbrush simulation.

“In the old days, people wrote clever algorithms to simulate what they were trying to achieve,” Finkelstein said.

“What algorithm can I use that will look like a brush on canvas? It was hard, and it met with limited success.”

“How do you draw the fundamental characteristics of paint from many examples of paint? How do you extrapolate traffic patterns from what traffic was like today, or last week, or last month?”

“We are entering a realm where you don't have to apply a clever algorithm to simulate the world; you can say, 'this is how the world really is’.”

More information is available from the dedicated project page