The image on the right shows how much the liquid rebounds off the wall compared to the uncoated wall on the left.
Late night revellers and heavy drinkers may think nothing of relieving themselves in public.
But now walls are fighting back against the disgusting habit.
Walls in San Francisco have been coated with water-repellent paint so that desperate drinkers get a nasty surprise if they urinate on them.
Nine walls around the Mission and Soma districts have been treated with hydrophobic Ultra-Ever Dry paint, so that if someone wees on them, their urine sprays back over their legs and shoes, hopefully deterring them from urinating in public again.
The nanotechnology spray can be applied to almost any material.
It turns into a super hydrophobic shield when applied, so that breeze blocks can be made non-porous, walls hydrophobic and gloves completely dry even when submerged in water, for example.
When liquid is sprayed onto a surface treated with Ultra-Ever Dry, the droplets remain almost spherical, so they can bounce off a surface.
Mark Shaws demoed the technology at a TED talk in 2013, explaining: "The surface of the spray coating is formed with nanoparticles that form a rough surface.
"It has billions of interstitial spaces [spaces between layers] and those spaces, along with the nanoparticles, reach up and grab the air molecules and cover the surface with air."
"It's an umbrella of air all across it... This layer of air is what the water [or mud or urine] hits and it glides right off."
Testing out a new pee repellent that "pees back" to prevent public urination. pic.twitter.com/6eDJ4w9MWH
The coating costs several hundred dollars per wall, The San Francisco Chronicle reported via The Next Web, leading some people to comment that more public toilets are a better solution to the dirty problem.
Public Works chief Mohammed Nuru told the paper: "The team that did the testing [were] excited because the liquid bounces back more than we thought it would."
If the pilot is a success and deters people from using public walls as toilets, the hydrophobic paint could be applied to more neighbourhoods.
The technology is also being used in the St Pauli Interest Community in Hamburg where there are many pubs and locals are tired of "wildpinkler," which literally means "free pee-ers" in German.
In a short video produced by the group, members can be seen putting up signs reading "DO NOT PEE HERE! We pee back" on specially-treated walls.
The spray can also be used to prevent ice, corrosion and bacteria and can even be applied to clothes and cars to enable them to be "self-cleaning".