In 1977, a 22-year-old truck driver named James Cameron went to see Star Wars with a pal. His friend enjoyed the movie; Cameron walked out of the theater ready to punch something. He was a college dropout and spent his days delivering school lunches in Southern California’s Orange County. But in his free time, he painted tiny models and wrote science fiction — stories set in galaxies far, far away. Now he was facing a deflating reality: He had been daydreaming about the kind of world that Lucas had just brought to life. Star Wars was the film he should have made.

It got him so angry he bought himself some cheap movie equipment and started trying to figure out how Lucas had done it. He infuriated his wife by setting up blindingly bright lights in the living room and rolling a camera along a track to practice dolly shots. He spent days scouring the USC library, reading everything he could about special effects. He became, in his own words, “completely obsessed.”

He quickly realized that he was going to need some money, so he persuaded a group of local dentists to invest $20,000 in what he billed as his version of Star Wars. He and a friend wrote a script called Xenogenesis and used the money to shoot a 12-minute segment that featured a stop-motion fight scene between an alien robot and a woman operating a massive exoskeleton. (The combatants were models that Cameron had meticulously assembled.)

The plan was to use the clip to get a studio to back a full-length feature film. But after peddling it around Hollywood for months, Cameron came up empty and temporarily shelved his ambition to trump Lucas.

The effort did yield something worthwhile: a job with B-movie king Roger Corman. Hired to build miniature spaceships for the film Battle Beyond the Stars, Cameron worked his way up to become one of Corman’s visual effects specialists. In 1981, he made it to the director’s chair, overseeing a schlocky horror picture, Piranha II: The Spawning.

One night, after a Piranha editing session, Cameron went to sleep with a fever and dreamed that he saw a robot clawing its way toward a cowering woman. The image stuck. Within a year, Cameron used it as the basis for a script about a cyborg assassin sent back in time to kill the mother of a future rebel leader.

This time, he wouldn’t need any dentists. The story was so compelling, he was able to persuade a small film financing company to let him direct the picture. When it was released in 1984, The Terminator established Arnold Schwarzenegger as a huge star, and James Cameron, onetime truck driver, suddenly became a top-tier director.

Over the next 10 years, Cameron helmed a series of daring films, including Aliens, The Abyss, Terminator 2: Judgment Day, and True Lies. Generating $1.1 billion in worldwide box office revenue, they gave Cameron the kind of clout he needed to revisit his dream of making an interstellar epic. So in 1995, he wrote an 82-page treatment about a paralyzed soldier’s virtual quest on a faraway planet after Earth becomes a bleak wasteland. The alien world, called Pandora, is populated by the Na’vi, fierce 10-foot-tall blue humanoids with catlike faces and reptilian tails. Pandora’s atmosphere is so toxic to humans that scientists grow genetically engineered versions of the Na’vi, so-called avatars that can be linked to a human’s consciousness, allowing complete remote control of the creature’s body. Cameron thought that this project — titled Avatar — could be his next blockbuster. That is, the one after he finished a little adventure-romance about a ship that hits an iceberg.

Titanic, of course, went on to become the highest-grossing movie of all time. It won 11 Oscars, including best picture and best director. Cameron could now make any film he wanted. So what did he do?

He disappeared.

Cameron would not release another Hollywood film for 12 years. He made a few underwater documentaries and did some producing, but he was largely out of the public eye. For most of that time, he rarely mentioned Avatar and said little about his directing plans.

But now, finally, he’s back. On December 18, Avatar arrives in theaters. This time, Cameron, who turned 55 this year, didn’t need to build half an ocean liner on the Mexican coast as he did with Titanic, so why did it take one of the most powerful men in Hollywood so long to come out with a single film? In part, the answer is that it’s not easy to out-Lucas George Lucas. Cameron needed to invent a suite of moviemaking technologies, push theaters nationwide to retool, and imagine every detail of an alien world. But there’s more to it than that. To really understand why Avatar took so long to reach the screen, we need to look back at the making of Titanic.

“People may not remember, but it was an absolutely vicious time,” Cameron tells me in the private movie theater at his sprawling home in Malibu, California. He looks softer than he did at the Oscars in 1998 — his hair is longer and grayer and his face clean-shaven. But his famous impatience is still close to the surface. Early in our conversation about what he’s been doing for the past decade, he informs me that I “don’t know fuck,” so I try to let him explain how things unfolded.

“When we were filming Titanic,” he says, “we were just trying to figure out how much money we were going to lose.” Indeed, in the mythic afterglow of box office success, it’s easy to forget that Titanic was expected to be a disaster. The project went more than $100 million over its initial $100 million budget, making it the most expensive movie ever made. The main financier, 20th Century Fox, pressured Cameron to contain the overruns.

As a sign of his commitment, Cameron agreed to give up his entire directing fee and any profit participation in the movie. When Titanic missed its July 4 release date, it appeared that the project was in big trouble. Cameron kept a razor blade on his editing desk with a note: Use only if film sucks. “I just realized I made a $200 million chick flick where everyone dies. What the hell was I thinking?” he confided to a friend at the time. “I’m going to have to rebuild my career from scratch.”

The Hollywood trade journal Variety called it “the biggest roll of the dice in film history” and questioned whether Fox would come anywhere near breakeven. “Everybody was predicting catastrophic failure,” says Rae Sanchini, the former president of Cameron’s production company.

And then, miraculously, this Titanic dodged the iceberg and sailed into the record books, grossing $1.8 billion worldwide. “We went from the lowest lows to the highest high,” Sanchini says. “It was a disorienting experience for all of us, but most of all for Jim. He was emotionally and physically exhausted.”

Still, Sanchini expected the director to bounce back. Before Titanic, Cameron was excited about Avatar — it was, after all, the space epic he had been dreaming about since 1977. But now he didn’t seem very interested.

Part of this ambivalence stemmed from a meeting at Digital Domain, the visual effects company Cameron cofounded in 1993. He presented his concept for Avatar and explained that the main characters were 10-foot-tall blue aliens with narrow waists and powerful legs and torsos. They had to look utterly real, and the effect couldn’t be achieved with prosthetics. The aliens would have to be computer-generated. But given the state of the art, his team told him, that was impossible. It would take too much time and money and an unthinkable amount of computing power.

“If we make this, we’re doomed,” one of the artists told him. “It can’t be done. The technology doesn’t exist.”

Cameron was actually relieved. He didn’t feel like dealing with actors and agents and “all that Hollywood bullshit.” He needed a break. Luckily, a huge windfall was headed his way. Fox executives knew it was in their best interest to keep the self-anointed king of the world happy. They decided to overlook the fact that he had given up his financial stake in Titanic and, in the wake of its historic Oscar run, wrote him a check for tens of millions of dollars. (Reportedly, Cameron eventually earned more than $75 million from the film.) He wouldn’t have to work another day in his life.

“I had my fuck-you money,” Cameron says. “It was time to go play.”

Here’s James Cameron’s idea of play: scuba diving near unexploded, World War II-era depth charges in Micronesia. In the summer of 2000, he chartered an 80-foot boat and invited a group of people to dive down to a fleet of sunken Japanese battleships. He brought along Vincent Pace, an underwater camera specialist who had worked on Titanic and The Abyss. Pace, expecting to experiment with hi-def video, packed all of his gear but soon began to suspect that Cameron had something else on his mind.

They were looking over footage from a day’s dive when Cameron asked Pace a question: What would it take to build “the holy grail of cameras,” a high-definition rig that could deliver feature-film quality in both 2-D and 3-D? Pace wasn’t sure — he was no expert but knew about the cheap red-and-blue paper glasses of conventional 3-D filmmaking. They were notoriously uncomfortable, and the images could cause headaches if the projectors weren’t calibrated perfectly. Cameron believed there must be a way to do it better. What he really wanted to talk about was his vision for the next generation of cameras: maneuverable, digital, high-resolution, 3-D.

Inventing such a camera wouldn’t be easy, but Cameron said he was ready to break new ground. He mentioned a mysterious, long-gestating film project that would bring viewers to an alien planet. Cameron didn’t want to make the movie unless viewers could experience the planet viscerally, in 3-D. Since no satisfactory 3-D cameras existed, he’d have to build one. He’d brought Pace on the Pacific adventure to ask if the underwater cameraman wanted to help. His goal seemed kind of extreme, but Pace thought it sounded interesting and signed on. “Jim had a clear ambition on the dive trip,” Pace says. “It was fun, but I didn’t really know what I was getting into.”

Two months later, Cameron sent Pace a $17,000 first-class ticket from Los Angeles to Tokyo, and soon they were sitting in front of the engineers at Sony’s hi-def-camera division. Pace was there to help persuade Sony to separate the lens and image sensor from the processor on the company’s professional-grade HD camera. The bulky CPU could then be kept a cable-length away from the lens — rather than struggling with a conventional 450-pound 3-D system, a camera operator would just have to handle a 50-pound, dual-lens unit.

Sony agreed to establish a new line of cameras, and, using the prototype, Pace set to work. After three months, he had fitted the lenses into a rig that allowed an operator to precisely control the 3-D imaging. He figured they’d start with a simple test using an actor or two, but Cameron had other ideas. He asked Pace to install the gear in a rented World War II-era P-51 fighter and then sent him up in a B-17 Flying Fortress. Cameron jumped in behind the pilot of the P-51 and once airborne started filming while the pilot fired .50-caliber machine gun blanks at Pace’s B-17. “It was my first taste of what Jim considers ‘testing,'” Pace says.

The camera performed well, delivering accurate 3-D images that wouldn’t cause headaches over the course of a long movie. Pace thought Cameron would launch right into Avatar. Instead, the director took his new camera 2.3 miles under the sea to film the wreck of the Titanic in 3-D. The way Cameron tells it, he wasn’t done having “manly adventures.”

His partner on these adventures was the deep-sea explorer Andrew Wight. An intrepid Australian, Wight had explored a collapsing underwater cave, swum with great white sharks, and stared saltwater crocodiles in the eye. But even he had trouble matching Cameron’s intensity. When a hurricane headed up the Eastern seaboard toward their position over the Titanic, Wight assumed they would turn and outrun the weather. Cameron argued that it was a perfect opportunity to “tweak the tail” of the hurricane and get some great storm footage. The Russian captain of the ship overruled Cameron, and to the director’s chagrin, they ran.

“He’s a tough bugger,” Wight says. “But it’s not a death wish — it’s just his idea of fun.”

Sanchini, the former head of Cameron’s production company, wasn’t quite sure what to make of it. “I knew he was tired of the film business,” she says, “but I didn’t expect him to keep taking detours.”

Cameron wasn’t just goofing off. He wanted to make Avatar, and he wanted to do it in digital 3-D. Unfortunately, theater chains were not adopting the technology. It would cost approximately $100,000 per theater, and exhibitors had to be convinced it would pay off. They needed some high-profile 3-D films that could generate enough revenue to justify the conversion.

So Cameron decided to let other directors test his system. The first was Robert Rodriguez, who shot Spy Kids 3-D using the new camera. The picture would still have to be viewed wearing old-fashioned red-and-blue glasses, but Cameron hoped it would demonstrate demand for more 3-D movies and goad theater owners into investing in next-gen projection systems. Released in the summer of 2003, Spy Kids 3-D made $200 million worldwide, but exhibitors remained reluctant to invest in the technology.

Cameron decided to talk to theater owners directly and showed up at their annual convention in March 2005. ShoWest, at the Paris Las Vegas Hotel and Casino, was in full swing, and Cameron was ready to proselytize. He laid it on thick, telling exhibitors that the world was “entering a new age of cinema.” And in case the inspirational approach didn’t work, he tried something more ominous, telling them that those who didn’t switch would regret it. By the end of the year only 79 theaters in the entire country could show digital 3-D movies. But exhibitors had gotten the message: Between 2005 and 2009, they added some 3,000 screens capable of showing digital 3-D.

However, the lack of 3-D theaters wasn’t the only thing holding Cameron back. Special-effects companies were still struggling to create fully photo-realistic animated characters. That had begun to change in 2002, when Peter Jackson’s Weta Digital in New Zealand debuted Gollum, a stunningly believable computer-generated character who held his own against the hobbits in the Lord of the Rings trilogy. Cameron finally felt the time had come to try to build a CG world that would be indistinguishable from reality.

So in the spring of 2005, he met with Fox and asked for a few million dollars to prove he could create just such a world. The executives had some initial concerns, not all of which were technical. For instance: The tails — were the tails on the aliens absolutely necessary?

“Yes,” Cameron said flatly. “They have to have tails.”

He didn’t say anything else. He didn’t have to. The Fox executives stopped asking questions and agreed to pay for the test. Cameron’s Hollywood clout was intact.

The director spent five weeks putting together the 30-second test scene. It depicted an alien and an Avatar running through a forest and talking. Lucas’ own Industrial Light & Magic did the effects work, and it was enough to persuade Fox that the project was feasible. The studio agreed to a budget of $195 million, and Cameron was finally back in the director’s chair.

The first time Cameron set out to out-Lucas Lucas, he had to make do with $20,000 and a special effects studio set up in the back bedroom of his house in Orange County. This time around, money was not an issue, and his special effects were handled by hundreds of artists at Weta and ILM. But it wasn’t all about f/x. Lucas has had 30 years to expand the Star Wars universe. The franchise has gotten so big that he has developed a sophisticated system for cataloging and tracking all its far-flung characters, planets, societies, and conflicts. To conjure something even more elaborate for Avatar, Cameron went looking for expert help.

He started by hiring USC linguistic expert Paul Frommer to invent an entirely new language for the Na’vi, the blue-skinned natives of Pandora. Frommer came on board in August 2005 and began by asking Cameron what he wanted the language to sound like? Did he want clicks and guttural sounds or something involving varying tones? To narrow the options, Frommer turned on a microphone and recorded a handful of samples for Cameron.

The director liked ejective consonants, a popping utterance that vaguely resembles choking. Frommer locked down a “sound palette” and started developing the language’s basic grammatical structure. Cameron had opinions on whether the modifier in a compound word should come first or last (first) and helped establish a rule regarding the nature of nouns. It took months to create the grammar alone. “He’s a very intense guy,” Frommer says. “He didn’t just tell me to build a language from scratch. He actually wanted to discuss points of grammar.”

Thirteen months after he began work on Avatar, Frommer wrote a pamphlet titled Speak Na’vi and started teaching the actors how to pronounce the language. He held Na’vi boot camps and then went over lines one by one with each actor. “Cameron wanted them to be emotional, but they had to do it in a language that never existed,” Frommer says. If an actor flubbed a Na’vi word, Frommer would often step in with a correction. “There were times when the actors didn’t want me to tell them that they had mispronounced a word that had never been pronounced before,” he says.

With the language established, Cameron set about naming everything on his alien planet. Every animal and plant received Na’vi, Latin, and common names. As if that weren’t enough, Cameron hired Jodie Holt, chair of UC Riverside’s botany and plant sciences department, to write detailed scientific descriptions of dozens of plants he had created. She spent five weeks explaining how the flora of Pandora could glow with bioluminescence and have magnetic properties. When she was done, Cameron helped arrange the entries into a formal taxonomy.

This was work that would never appear onscreen, but Cameron loved it. He brought in more people, hiring an expert in astrophysics, a music professor, and an archaeologist. They calculated Pandora’s atmospheric density and established a tripartite scale structure for the alien music. When one of the experts brought in the Star Wars Encyclopedia, Cameron glanced at it and said, “We’ll do better.”

Eventually, a team of writers and editors compiled all this information into a 350-page manual dubbed Pandorapedia. It documents the science and culture of the imaginary planet, and, as much as anything, it represents the fully realized world Cameron has created. For fans who want to delve deeper, parts of Pandorapedia will be available online this winter.

Cameron is trying to show me something with a laser pointer. He queues up a scene toward the end of Avatar and freezes the frame on an image of a large crowd of Na’vi. He uses the pointer to draw attention to an ornate headdress composed of hundreds of tiny beads. The onscreen image is amazingly crisp, and the headdress appears utterly real. Each bead was designed by a digital artist, Cameron says, so it would look handmade. “Every leaf, every blade of grass in this world was created,” he says, and his laser pointer streaks across the screen, alighting on so many things I can’t follow its path.

Back in 1997, when Cameron was struggling to complete Titanic, disaster seemed right around the corner. “We were pegged the biggest idiots in film history,” he says. Now he has the opposite problem: Expectations couldn’t be higher. “It’s making me work harder,” he says.

This time, though, Cameron seems to be enjoying the work. At least there’s no razor blade next to the editing controls. “For Jim, this project was in some ways the antidote to Titanic,” Sanchini says. “He didn’t have to deal with weather, wardrobe problems, historical accuracy, or huge sets. If the leading lady had a pimple, it wasn’t a disaster. Avatar gave Jim total control.”

Thirty-two years after realizing that he desperately wanted to make a space epic to rival Star Wars, Cameron has put the finishing touches on his picture. Now he has to wait to see what the public and critics make of the result. The days of total control are over.

Contributing editor Joshua Davis (www.joshuadavis.net) wrote about the world’s biggest diamond heist in issue 17.04.