San Francisco artist Martin Machado says it’s a toss-up which came first, his love of art or of the sea. Growing up in San Jose, he was a creative kid who drew and painted, and also dreamed of one day becoming a marine biologist. He learned to surf during visits to Santa Cruz to spend time with his grandfather, a newspaper cartoonist, who would take Machado out on small fishing boats.

“Finally, in college (at UC Santa Barbara) I was at this crossroads,” Machado, 37, said on a recent morning at his Russian Hill home. “Do I follow the art path or do I go marine biology? I went towards art.”

The walls and table surfaces of Machado’s basement studio were covered with his fastidiously detailed fine-line drawings of ships, ports and sailors reminiscent of centuries-old etchings, and surprisingly tranquil black-and-white photographs of enormous container ships cutting through the churn of the open ocean. Machado was readying art he’s created over the last five years for the exhibition “Martin Machado: Fluid State,” on view now through Aug. 19 at the San Francisco Art Institute’s Fort Mason campus. (A reception with the artist is being held on Friday, June 8.)

With hindsight, Machado admits it’s a telling coincidence that in 2007 he received his master of fine arts from SFAI and also joined the 127-year-old Sailors’ Union of the Pacific. He started two careers at once — as a professional artist and a merchant mariner. “I thought I’d see if I could work on the big container ships because maritime themes and imagery, and issues around global trade and industry, had started to peek their way into my artwork,” he said. “I wanted to be true to that world, and not just represent a community that I wasn’t part of.”

For the past 11 years, Machado has spent three to four months of every year working on container ships that haul goods from the Port of Oakland to Asia and the Middle East and back. His transoceanic voyages on the kind of immense 1,000-foot vessels one sees creeping through the Golden Gate regularly have become both the inspiration and the subject of Machado’s captivating body of artwork.

As an art student, Machado was put off by the emphasis on conceptualism. “I don’t want to make art about other art, as much as art that speaks of my lived experience. You know how land artists like Andy Goldsworthy and Richard Long would take a walk and then make art about that walk? I started thinking about my sea voyages that way.”

On board, he works as deck crew and a “watch stander,” scanning the water from the bridge for dangers and anomalies, and navigating the ship safely into port.

After the hard work of doing things like tightening the lashing gear on the high stacks of containers, Machado spends his limited downtime creating art in his cabin. “I rearrange my room to have more wall space,” he said. “My wife gave me these really thick, strong magnets, which are key” to adhering paper to the cabin’s steel walls.

Since his first voyages, Machado has brought art supplies (and occasionally a surfboard): ink, gouache and oil paints, and “a 4-by-5 camera that was my grandfather’s from World War II. It’s been fun photographing the new technology of modern shipping with these really old cameras.”

Machado’s work alternates between being grounded in the realities of labor (drawings of fellow merchant mariners and various ports’ giant hammerhead cranes) “when I’m in documentary mode,” he said, and then “it becomes more fantasy-based. I imagine containers falling off the ships, and them getting rigged up with sails and sailing off into the night.”

In some drawings, contemporary containers float beside historic figures and tribal seafarers. “I sort of see myself in this long chain dating back to the artists like (John) Webber who traveled with Captain Cook” on his famous South Seas voyages in the 1770s, Machado said.

As for the ubiquitous image of the steel shipping container itself, Machado said it’s “representative of our new global paradigm. It’s the most obvious modern symbol of consumerism and global trade.”

“Fluid State” inspires viewers to think about the “invisible industry” that transports 90 percent of the world’s goods by sea. Men like Machado (the industry is still overwhelmingly male) most likely brought our toothpaste, cereal, television and car across thousands of miles of open ocean, yet “people assume it all happens naturally, or automatically,” he said, pointing to a detailed black-ink portrait of a fellow hard-hatted crew member standing on the deck of a ship. “But there are real people’s lives behind everything. Without them, globalization is just an idea.”

Machado recalled being involved in one “Captain Phillips”-like incident in “what’s called the ‘pirate corridor’ off Yemen. High-speed skiffs came up on us really quickly. Everybody went to the safe room, and I was on the bridge, steering, doing these evasive turns.”

Notwithstanding potential dangers on the high seas, Machado said being on a ship for weeks on end, especially on watch duty, is overwhelmingly calm. “You get into this hypnotic mode where you just stare at the ever-changing-but-the-same water movement. On watch, it’s like endless meditation because eight hours of the day you’re staring at the water. And you’ve got to stay awake. So drink some coffee. Stargaze. Stare some more. And then, at least for me, make some art.”

Jessica Zack is a freelance writer who frequently covers film, art and books for The San Francisco Chronicle. Twitter: @jwzack