Some writers are haunted by their shadows. Vince Gilligan sees a dance partner.

There’s a night spent in the Sofitel Hotel on Beverly Boulevard, circa 1995. Gilligan notices the light from the TV set project his shadow on the wall, and thinks, “Wouldn’t it be creepy if that came to life?”

A hint of darkness, a hint of wonder. These are the building blocks for the creator of Breaking Bad, whose lighthearted, conversational demeanor stands in unmistakable contrast to the brooding AMC drama.

“For people who have known me for many years, and for people who just meet me in passing, there seems to be this running theme of people being surprised how dark the show is vs. how light I seem to be — more or less normal,” says Gilligan. “The simple fact is that I’m not as normal as I seem.”

The shadow appears at a fortuitous moment for Gilligan. After some precocious but modest success in film, enough to give him a living but little more than that, Gilligan is wasting his life in his home state of Virginia, five years and counting, “basically farting around, playing videogames and eating Cheetos from 1990-95.”

And watching TV. A new series, The X-Files, enthralls him. When he mentions it to his agent, simply in passing, she tells him she is related by marriage to X-Files creator Chris Carter and would be happy to arrange an introduction the next time Gilligan was in California. Would he like to meet him?

“Yeah, that’d be cool,” Gilligan thinks. “Maybe I get a free T-shirt out of it, shake his hand. That’s literally all I intended.”

Even today, amid the compelling success of Breaking Bad on AMC, Gilligan is hands-down one of the most down-to-earth people you’ll meet in Hollywood. You can imagine how he was two decades ago, when he was meeting the guy behind his favorite show.

They start talking with each other. Carter is familiar with Gilligan’s 1993 film, Wilder Napalm. He is also dead tired. X-Files is a hit for Fox, and Carter and his staff are in the soup of a 26-episode order.

“They needed some help,” Gilligan says. “They needed some warm bodies.”

Carter asks Gilligan if he has any ideas, and Gilligan, without any planning, mentions the shadow at the Sofitel from the night before. (“If I had known I was going in to pitch, I probably would have messed it up,” he muses.) Carter is intrigued, and the 23rd episode of season two of the show is born — along with Gilligan’s transition into television.

“I’m about to lose my Writers Guild insurance,” Gilligan recalls. “The movie end of things has really been sucking ass the last few years. Why shouldn’t I move to California to learn a new trade?”

Gilligan recognizes that for aspiring writers, even if he’s not evil, the story kind of is. “Every time I tell that story, I wind up pissing somebody off,” he says. “I was sort of like Kramer on Seinfeld — I fell ass backward into it. … If it helps anybody, I’ve had plenty of kicks in the butt since then. You pay your dues — either you pay them in advance or you pay them later on.”

Is that where the shadow comes from, in all its darkness and wonder? Where’s the trigger, the moment that TV has made us so familiar with, the inciting incident that set Gilligan down the path toward the bleak reality depicted in Breaking Bad?

“I don’t know,” he says. “I’ve got no real reason to be dark and unhappy. My life’s been really good. I had a good childhood. … I don’t have any real tragedies or traumas. I think some people are just melancholy by nature.

“Sometimes our brains are wired the way they’re wired.”

* * *

Years back, Gilligan is a boy in Farmville, Va., spending weekday afternoons with his mother, an elementary school reading teacher at the J.P. Wynne Laboratory School. Breaking Bad Trivial Pursuit champs will recognize J.P Wynne as the name of the high school where Walter White (Bryan Cranston) is teaching chemistry when we meet him.

The elementary school doubles as the local college’s

student-teacher training facility, with a great focus on the arts, a place where the young Gilligan could indulge his love of painting, writing, making sculptures.

“I always loved telling stories,” Gilligan says, “and soon as I learned how to write, I loved writing them down. And my mom was very supportive of that.”

“I would stay after school until she was ready to go home, and I would hang out in her classroom. It was the best classroom. It had the most fun stuff — she had a space capsule you could climb into, and she had a greenhouse she got the janitor guys at the college to build for her … and she had this tree in one corner that she made out of construction paper that went up to the 14-foot ceiling,” underneath which Gilligan could read.

At NYU’s Tisch School of the Arts, Gilligan writes a screenplay during his senior year (ultimately the Drew Barrymore starrer Home Fries), which leads not only to an agent but also a mentee-mentor relationship with producer Mark Johnson, a judge of a Virginia screenwriting contest that gave the script a prize.

Our top story tonight: Nice guy finishes first.

“It affected me positively in that it kind of boosted my self-esteem,” Gilligan says. “I’ve never been the most aggressively confident person in the world, and that early success did bolster me in ways I probably needed.

“But the downside of success is there’s not much of an element of working to earn it,” he adds. “The scariest part is when some early success hits, you kind of take it for granted — you assume it’s meant to be.”

At first, Gilligan compares it to winning the lottery and says he didn’t deserve it any more than anyone else, though he pulls back on the analogy.

“I did work my butt off writing scripts,” he says. “Instead of going out dating, I was in my dorm room writing.”

Logically, Gilligan would have pulled up stakes after graduation and headed to Hollywood, but Johnson suggests he remain in his home state. “He had the best of intentions,” Gilligan says. “He said, ‘You have a very distinct voice, and it’s a voice steeped in the South and it’s born of the South.’ ”

Over time, it’s the right idea, but for the wrong personality. Optioning the occasional script, Gilligan earns just enough money to sap his initiative.

“In hindsight, it reminds me of Jack Nicholson in The Shining, especially in the winter when I got snowed in that little house,” Gilligan says. “Instead of writing, I was slowly going insane.

“What I needed was an enormous kick in the ass. Mark Johnson sometimes would call me and ask, ‘What the hell are you doing out there?’ … Me sitting around on my butt doing nothing was ultimately more harmful to my personality and my career than trying to write the next big blockbuster in West L.A. would have been.”

But the happy accident of Chris Carter and The X-Files lands, showing that Gilligan doesn’t need to live large, like “the Bukowskis of the writing world and the Hunter S. Thompsons and the Ken Keseys and Kerouac.” He needs a change of scenery, not a change of soul.

He cites a quote from Gustave Flaubert: “Be regular and orderly in your life like a bourgeois, so that you may be violent and original in your work.” Gilligan could access the wild recesses of his imagination and the darkness without becoming the darkness.

“We all put on good faces in our lives, some more successfully than others,” Gilligan says. “We try to fit in, we try to be light for the most part … unless you’re young and full of beans and sort of pissed off in army boots, with a cloud over your head and having people cross the street to avoid you. I had that time in my early 20s. That darkness never completely goes away, even if you hide it from the world.

“I’m more of the guy who lives the quiet, boring life, exceedingly square, pretty much uninteresting, but I have a wild imagination. Breaking Bad has given me the opportunity to exorcise some of this out of my skull and get rid of some of these toxins.”

With that, the departure point of Breaking Bad protagonist Walter White from Gilligan’s psyche becomes as clear as — well, not crystal meth, but you get the idea.

* * *

Gilligan calls the Walter we meet at the start of the series “milquetoast.” He tries to be a good husband and father, but he’s not particularly interesting — until he gets cancer and sees not only his life, but his family’s (how will they survive without him?) flash before his eyes.

“He’s got some darknesses in him that begin to come out,” Gilligan says. “When he is thereby freed, he breaks bad and he does things that he otherwise wouldn’t have done and mostly enjoys them, I think. At end of the day, he’s doing it for himself.

“It’s fun to be able to break bad on paper. It was tough, six years on end, to have Walter White in my head, especially when he’s gotten as dark as he has the last few seasons. But then again, to have him do the crazy shit that he does … has probably been a liberating experience.”

Instead of becoming the drug kingpin of the Southwest, Gilligan’s adrenaline rush is to write himself into a corner.

“Some people race motorcycles or go out and have unprotected sex or whatever their thing is,” he says. “Some people out there walk on tightropes for a living. This is our version of walking on tightropes.”

He recalls an episode in season three, when Walter and unlikely cohort Jesse are tracked to a junkyard by Walter’s DEA agent brother Hank, and neither Gilligan nor his staff had any idea how they would get Walter out. “When it finally came to us” — after a day and a half — “it was like the heavens shining down and light springing out,” Gilligan beams.

Over the past year and change, the final 16-episode season of Breaking Bad, and in particular the final eight episodes that air this summer beginning Aug. 11, become the ultimate razor’s edge. Gilligan says the process of breaking the stories was brutal.

“Writers (were) pacing in the writers room, just trying to figure it out: how we’re going to end it in a satisfying manner, how we’re going to please people,” he says. “It’s kept me awake at night.”

Even after the story issues are solved, Gilligan is hardly through. In mid-May, it’s a race to get post-production done before the editors put Walter White in their rear-view mirrors and move on to other jobs.

“This past year has probably taken several years off my life — I’m visibly grayer,” he says. “It’s been rough, but it’s been really self-imposed. … I have nightmares of people saying ‘I used to love this, and now it sucks. What kind of bullshit ending was that?’ This last year has been a giant game of chess, played by very much non-professional chess players.”

As is the case with every other corner, Gilligan and the staff spin ’round and ’round until they find their way out. For the longest time, the thought was “no matter what we came up with, I would not be satisfied by it.” But what happens is he is satisfied, even as he knows some won’t be.

“I’m not gonna lie that if everyone else on earth hated it, it wouldn’t affect me,” he reflects. “It would trouble me greatly. But the writers and I always felt we were the first audience for our show. If we can’t please ourselves, how can we please anybody?”

Gilligan says he hasn’t decided what to do after Breaking Bad, though he has his eye on TV in general and muses about one project in particular. You might consider it a shadow on the wall of Breaking Bad: a spinoff centered around Bob Odenkirk’s ethically questionable Saul Goodman lawyer character. (“Better call Saul!”)

“In my heart of hearts, I’d love to see a Saul Goodman spinoff,” Gilligan says.

It’s not at all clear what the show would be, even whether it would be a half-hour or an hour. It might never happen. Gilligan thinks about it out loud, cheerfully, but as you now know, inside, he’s churning.

“I’m absolutely creatively satisfied in TV, especially in this particular moment in time, where TV is in ascendancy in terms of the respect it’s given,” he says. “The only downside to TV is that it’s absolutely exhausting — it just grinds you down like you’re under a millstone. That’s cable I’m talking about. Network TV, which I worked on for seven years, was even more grinding.

“I do think a movie schedule might be more healthful. I love movies — I always have — but movies have just been more heartbreaking for me, and TV has been wonderfully satisfying. If I’m smart, I’ll just start training like it’s the Ironman triathlon. … Writing itself is not that much fun to do, but having written is satisfying.”