Last week, over the course of a few hours, I felt my life slowly taking on the colors and moods of an Edward Hopper painting. It’s happened to me before — in those uncanny minutes after I’ve let myself in to unfamiliar hotel rooms in unfamiliar cities. It may have happened to you.

What made it strange was that I was on my way to see “Edward Hopper and the American Hotel,” a magnificent exhibition at the Virginia Museum of Fine Arts.

My plan was to drive from Washington in the evening, stay in a bed-and-breakfast a few blocks from the museum and see the show the next day. I got to Richmond late, ordered a burger and a beer at a bar (not quite “Nighthawks,” but not so far off either), then drove to the bed-and-breakfast. The two entrances I tried were locked, so I called the number on the reservation email, and in less than a minute, someone was leading me up the stairs that opened onto my bedroom.

Strange feeling. The “Dream Suite,” it said on the door. Bedside lamp, floral sheets, cast-iron headboard, framed photo of the sun setting over the sea.

In the morning, I drifted into a communal space where the sun streamed in and an elderly couple sat planning their day. The woman was engrossed in maps and pamphlets (oh, the endless unspooling days of retirement!). The man was watching me slyly as I struggled with the coffee machine and the whereabouts of the milk.

I arrived at the museum just after it opened and walked into the show with a feeling both of relief and uncanny familiarity.

V.S. Naipaul, who traveled a lot, was clear about what he liked about hotels: “the temporariness, the mercenary services, the absence of responsibility, the anonymity, the scope for complaint.” But most people who stay regularly in hotels see them, I think, in a more ambivalent light.

Certainly Edward Hopper did, and it’s hard to overstate the influence that his distinctive vision of hotels had on America’s cultural imagination, not just in the visual arts, but also in short stories, novels, films and television.

The Richmond exhibition was organized by Leo Mazow with Sarah Powers, and is the first to home in on a subject that was, you feel intuitively, of central importance to the career and sensibility of this great 20th-century American artist. It includes more than a dozen major Hopper paintings, borrowed from across the United States (and, in one case, Madrid); a terrific spread of drawings and watercolors; and a smart selection of hotel- and Hopper-related art by others. These include photographs by William Eggleston, Cindy Sherman and Gregory Crewdson, three-dimensional works by Joseph Cornell and Derrick Adams, and paintings by Thomas Hart Benton, John Singer Sargent, Ed Ruscha and Robert Cottingham.

Hopper spent a few years in the 1920s making cover illustrations for two widely read hotel trade magazines. He and his wife, Jo, also traveled a great deal. Between 1941 and 1953, they made at least five major road trips across the United States and even into Mexico (those same years, more or less, saw Vera Nabokov drive her butterfly-chasing husband, Vladi­mir, all over America as he worked on “Lolita”).

A lot within Hopper’s pictures hints at the changing nature of the American hospitality trade. If you’re hungry for social history, including discussions of race and labor and a careful parsing of the differences between hotels, motels, tourist homes, boardinghouses and apartment hotels, you can spend an afternoon with the catalogue, which includes essays with titles such as “Edward Hopper and the Legibility of Whiteness” and “Room, Lobby, and Window: Hopper and the Invisibility of Hotel Labor.”

Like Anton Chekhov, Hopper was both a realist and a ruthless editor. Just as Chekhov’s stories, beneath their veneer of lifelikeness, have a boiled-down, biblical simplicity, Hopper’s interiors are shorn of detail.

Inside the exhibition, the curators have re-created the room depicted by Hopper in “Western Motel” (1957). Visitors can actually stay overnight there — surely a first for an art museum? — but I can’t think of anything more creepy than waking up in such a place at 3 a.m. The room is faithful to the painting, but it’s inhumanly empty and, if nothing else, a reminder of how radically depleted Hopper’s scenes are.

Registering the artifice in Hopper’s limpid art may free us to see a link between hotel rooms and painting itself: Both magnetize desire and a longing to escape. Both, too, have a certain kind of disappointment built in. (A hotel room is never your home, and even the greatest painting is, in the end, just a painting — something you could accidentally put your elbow through.) By including suitcases, lamps, books and certain kinds of attire, Hopper plants clues that suggest story lines. But his shreds of narrative fail to coalesce. They don’t go anywhere.

That may in fact be what Hopper most liked about hotel rooms — that they are places where narrative breaks down, where stories go nowhere — and where your life is in limbo.

One of the exhibition’s first works is a rendering, in dull-colored oils, of the room in Hopper’s mother’s house in Nyack, N.Y., where he stayed on weekends while studying as an art student in the city. The view shows the end of his bed, a door and a lamp — all elements that recur in his later hotel room paintings.

It’s almost as if he had anticipated his later preoccupation by converting even his childhood bedroom into the kind of hotel interior we now automatically think of as “Hopper-esque” — that’s to say, a site of both anticipation and stuckness. (Then again, past a certain age, what else is a childhood bedroom?)

Besides “Hotel Lobby” (1943) and the very beautiful “Hotel Room” (1931), my favorite painting in the show is “Room in New York” (1932). A woman in a red dress idly toys with the keys on a piano while her male companion reads. Her body seems to squirm with an anticipation of physical pleasure and, at the same time, to burn with neglect.

That’s my projection, of course — how can I know? But there’s no doubt Hopper was alive to the flavor of ambivalence in all the promises held out by hotels. Sex, most obviously, but also a mental and physical freshness that always teeters on the edge of staleness. (If there were a word for “the brittle tedium of being yourself in a foreign place” I would use it.)

Hopper’s paintings are least successful when they try to make both things — the sexiness and the stuckness — explicit in the same picture (“Room in New York” is a rare exception); when they show, for instance, an inexplicably naked woman looking out of a hotel window (as in “Morning in a City”). Part of the problem is Hopper’s persistently clunky handling of female bodies. The deeper problem is just that they seem leering and gratuitous, even as Hopper’s rigid handling infuses them with a certain Yankee primness.

But I love Hopper — love him — and can forgive his scattered weak pictures, because even they breathe with a plain-spoken love of ordinary, vulnerable life. Amid their taut geometries are passages of enfolding softness and effulgent color harmonies — rich reds, pale yellows and blues against his favorite milky lime green. Every eloquent expanse of empty wall is limned by a trill of thin stripes defining doorjambs, drawn curtains and window frames. And every diagonal line announces the arrival of outside light.

I don’t see Hopper as a religious painter. But few artists have more thoroughly mined the poetic potential of diagonal shafts of colored light. And in his best paintings, those lozenges of light have the beneficence of the lines of miraculous words that, in early Renaissance depictions of the Annunciation, stream from the mouth of the Angel Gabriel toward the Virgin Mary.

What is there left to say? Moved, bewildered, awaiting, perhaps, some kind of message, I left the museum, and drove back up Interstate 95, aiming for home.

Edward Hopper and the American Hotel Through Feb. 23 at the Virginia Museum of Fine Arts, 200 N. Arthur Ashe Blvd., Richmond, Va.

Read more by Sebastian Smee: