STICKY SITUATION In Spider-Man 3, it's M.J. (Dunst) who rides the emotional rollercoaster when Peter's personality takes a dark turn

The first year and a half of skydiving, from mid-2004 through the end of 2005, was all about settling on a new mix of characters plucked from vintage Spidey comic books and finding actors to play them. Never mind that an actual studio-approved, trimmed-down script would barely be ready in time for the start of principal filming in January 2006. ''There's guys that are brilliant that can write a script in a couple of weeks,'' says Raimi. ''I'm not one of those guys. It usually takes me a year. And that's if you've got an idea.'' Because of the massive technical work involved in cloning any new cast members into CG versions of themselves for parts of the action scenes, Raimi had to get things moving as early as possible. There was nothing to be done about it.

So, with no break at all after Spider-Man 2's opening, Raimi began. Working with his brother Ivan, a Detroit doctor who has partnered with him on story concepts for years, the director of the underground-classic Evil Dead trilogy cranked out a first rough treatment within two months. Alvin Sargent, who wrote the screenplay for Spider-Man 2 and doctored parts of the first one — and, incidentally, is married to Spider-Man producer Laura Ziskin — came back to hash the Raimis' ideas into actual script pages, elaborating on characters and refining dialogue. So many plot strands piled up that at one point, the story broke into two films that might have been made back-to-back as parts 3 and 4 — a game plan that collapsed when nobody could find a satisfying intermediate climax.

Eventually, the swelling came down and the Peter-M.J. romance anchored a one-movie plot that would tie up most of the threads from parts 1 and 2. While Peter was the punching bag for most of Spider-Man 2 — ''I've noticed audiences love to watch him get his butt kicked,'' says Raimi — it's M.J. who's pummeled in this one. Her acting career misfires, Peter's always busy with the web thing, and her boyfriend plans a proposal, but things don't go smoothly. And worse, Peter quickly falls afoul of the riskiest story conceit in part 3: He gets taken over by a weird black alien goo — a ''symbiote'' — that attaches itself to him and turns him into an increasingly egotistical, vengeful, violent version of himself. (That's what the black Spidey suit is all about.) In a sense, our hero is the biggest villain in the movie.

Maguire, privy to early drafts, loved the idea. It would let him break free from and subvert his sweet-nerd screen image. ''I pushed for even more of that,'' he says. ''I think that's where everybody was headed, but I wanted to go further into it. I said, 'I'd love to see it go a little darker.' We worked on the tone quite a bit. The question was, How far can we go and still keep people rooting for Peter?''

While Parker's main fight would be with himself, Raimi was determined that Spider-Man bash heads with a trio of other villains. Peter's rich-kid pal Harry Osborn (James Franco) reappears as the New Goblin, taking up where his dad, the Green Goblin (Willem Dafoe), left off in the first movie. In January 2005, Thomas Haden Church (Sideways) signed up as escaped convict Flint Marko, a.k.a. shape-shifter Sandman. Sir Ben Kingsley took a meeting in late February to discuss playing the winged felon Vulture — but a week later, that story line fizzled in the still-evolving script. Instead, Raimi swapped in Topher Grace, onetime star of the long-running sitcom That '70s Show, to play Eddie Brock, a photographer rival of Peter Parker's who becomes the toothy fiend Venom. At first, Grace was puzzled at being tapped, since in the comics Brock is a middleaged, muscle-bound guy. ''My first reaction was, This is probably a really bad idea,'' says Grace. ''People are religious about not straying too far from the page.'' But Grace figured Raimi knew what he was doing when he explained that Brock, in the film, would be a kind of dark doppelgänger to Parker.

Throughout 2005, while a massive preproduction effort geared up and Sargent and the Raimis kept refining Spider-Man's journey to the dark side, a long line of hopefuls tried and failed to land a key new female role: Gwen Stacy, a love interest — or at least flirtation target — for Peter Parker. ''The women have been tougher to cast,'' says producer Ziskin. ''It's about chemistry. There's lots of wonderful actresses that just didn't have the spark with Tobey.''

The filmmakers thought they'd finally found a firecracker in Bryce Dallas Howard, perky, redheaded daughter of perky, redheaded director-producer Ron Howard. But Howard's agent nixed her doing an up-front audition. (The actress says she wasn't aware of her rep setting any such condition.) ''It's so stupid,'' says Ziskin. ''Actors like to read. That's how they shine. I don't expect a performance. I just want to see a quality.'' Howard took a meeting, and to her surprise found Maguire there. They read a scene, and everyone saw the elusive chemical reaction they'd been looking for.

NEXT PAGE: ''This better result in the best shot I've ever seen.''