Mat Johnson published fiction, nonfiction, even a graphic novel. He landed a post teaching in the prestigious creative writing program at the University of Houston.

Readers? He didn’t have many. Which offered some benefits, actually.

“Part of my artistic freedom was the safe knowledge that nobody was ever going to read anything I wrote,” he says.

Things change.

His edgy, comedic, he-can’t-say-that-can-he? approach gained widespread recognition, if not sales, with “Pym.” The 2011 novel blends Edgar Allan Poe scholarship, some less-than-intrepid black Antarctic adventurers and a colony of exceptionally large, white ice monsters that tries to enslave them. It also has a lot of Little Debbie cakes.

Then came this year’s “Loving Day” (Spiegel & Grau, $26).

advertisement | advertise on newsday

It’s a novel that he describes as “emotionally autobiographical,” featuring a protagonist who, like Johnson, is the son of an Irish father and African-American mother. His character inherits a decaying Philadelphia mansion, discovers a teenage daughter he never knew and grapples with a world where he always feels like an outsider. Along the way, he flays all kinds of perspectives on race: black, white and in-between.

Farewell, obscurity: The New York Times Book Review put him on the cover. Terry Gross interviewed him on “Fresh Air.” NPR’s critic called it a “beautiful, triumphant miracle of a book.” Showtime is developing a comedy series, with Johnson acting as creator, co-executive producer and head writer.

How does that feel?

“I was hanging with a bunch of other middle-aged guy friends,” says Johnson, 45. “I still think in my head I’m 28. My identity is there. . . . I think as a writer, it’s similar: In my head, I’m still a struggling writer who nobody reads.”

The secret to his success? He offers a surprisingly short answer: “Twitter.” Which he joined as it was starting out.

@Newsday

“Twitter was really fantastic for me because at heart I’m a humorist,” he says. “Comedy translated extremely well on Twitter. I could be quirky and funny and odd in a way that people could see instantly and get a feel for what I was doing.”

Toronto’s Globe and Mail even used a tweet in the lead of its review, noting his St. Patrick’s Day observation: “I celebrate my Irish heritage and my African American heritage simultaneously by re-enacting the Draft Riots on myself till I pass out.”

Such bursts helped him gather more than 68,000 Twitter followers. But they probably wouldn’t have mattered if his writing didn’t also reflect keen insight and a type of literary fearlessness. He writes like he doesn’t care whom he’s potentially offending.

“It’s not that I don’t care,” Johnson says. “It’s just if I cared, I wouldn’t be able to do it right. I’m not good enough to hold back.”

If he finds craziness on matters of race, it’s because he finds the notion of race as crazy. “We’re all just people,” he says. “We happen to have different levels of melanin and different features, but we’re all the same.” Which is perhaps why he’s driven to the edge in writing about it.

advertisement | advertise on newsday

“There’s no way your response is not going to be insane. If you’re forced to interact in a lunatic system, the only way you can react is as a lunatic.”

It’s also why he uses humor to attack those views.

“When you’re using humor, for me, to talk about race, it’s this excellent way of pushing people off-balance. And once they are off-balance, then you can actually get them out of these rigid notions and all of a sudden they have to challenge things that they take for granted as absolutes.”

He thinks “Loving Day” will be his final word on racial issues; his next novel, he says, will be science fiction. But first, there’s the matter of the Showtime series. Showtime hasn’t approved a pilot, but he’s been enjoying the chance to develop the characters at the periphery of his book.

Though Hollywood beckons, he has no plans to leave Houston, his home since 2007. Married and raising three kids there, he has fallen in love with the city’s arts scene and energizing ethnic diversity.

advertisement | advertise on newsday

His career can’t be called a sudden success — “It’s not overnight; it’s 15 years later” — but he’s happy with what “Loving Day” accomplished for him.

The book, he says, felt like a kind of exorcism. One that let him move, “as a grown man, to switch from me trying to make you feel comfortable to me actually making myself feel comfortable.”