It doesn’t take long to figure out that “Shrek” is not going to be your ordinary animated fairy tale. Was Pinocchio ever spied in an outhouse? Did Snow White ever pull cones of wax out of her ears and use them as dinner candles? Did Beauty–or even the Beast–let loose fish-killing farts? The hero and title character of “Shrek” does all these things in the first 10 minutes of DreamWorks’s hilarious and captivating computer-animated family movie. He’s not a teenager in a Farrelly brothers gross-out comedy, however, but a reclusive green ogre who lives in a swamp, speaks with a Scottish-Canadian burr (courtesy of Mike Myers) and just wants to be left alone. It’s a safe bet that kids, as well as their sib-lings, parents, aunts and uncles, are going to take this disgusting creature to their hearts. For “Shrek” is the wittiest and most endearing Hollywood animated movie since “Toy Story 2.”

Pinocchio and Snow White, as it happens, make guest appearances in “Shrek,” along with the Three Blind Mice, the Big Bad Wolf, Robin Hood, the Pied Piper and the Three Little Pigs. These fairy-tale characters have all been evicted from their homes by the evil (and very short) Lord Farquaad (John Lithgow), and they have landed on Shrek’s muddy doorstep, to the angry ogre’s horror. To get them out of his hair–though he has none–Shrek makes a deal with Farquaad: he will rescue the beautiful Princess Fiona (Cameron Diaz) from her dragon-protected castle so Farquaad can marry her. In return, the fairy-tale characters will get their homes back and Shrek will once again be left in peace. Talking his way into becoming Shrek’s sidekick on his quest is the motormouth Donkey (Eddie Murphy), a loyal but jive jackass who refuses to leave his savior, Shrek, alone.

Adapted from William Steig’s children’s book, this irreverent comedy, directed by Andrew Adamson and Vicky Jenson, sets out to turn the conventions of fairy tales –particularly their Hollywood renditions–on their heads. In this version of things, Cinder-ella bitch-slaps Snow White, an adorable Gingerbread Man screams “Eat me!” and when the heroine breaks into sweet song, her soprano is so shrill it causes birds to explode. It doesn’t take a detective to sniff out the subtext here: DreamWorks is taking potshots at its animation rival, Disney. Any doubt about this is removed when we are taken to Lord Farquaad’s fanatically ordered, rule-ridden kingdom, Duloc, which bears a suspicious resemblance to Disneyland. (“You are parked in Lancelot,” the loudspeakers announce to the arriving visitors.) It’s a very small world after all.

There’s been bad blood between the studios since Disney chief Jeffrey Katzenberg left the Magic Kingdom to join with Steven Spielberg and David Geffen in forming DreamWorks. When the new studio came out with its first animated feature, “Antz,” Disney accused DreamWorks of ripping off its own “A Bug’s Life.” Separately, Katzenberg filed suit against Disney and his old boss, Michael Eisner, for breach of contract, which resulted in a spiteful trial and a $250 million settlement. “There’s nothing [in the movie] in our view that is mean-spirited or nasty to the Disney heritage,” insists Katzenberg. “It’s not a revenge plot on my part.” Indeed, DreamWorks set up a special screening of “Shrek” for its competitor, to see if there was anything in it that particularly bothered Disney. “They were gracious and complimentary,” Katzenberg says.

It wouldn’t be surprising if they were worried, too. “Antz,” “The Prince of Egypt” and “The Road to El Dorado” posed no threat to Disney’s artistic or commercial dominance. With “Shrek,” DreamWorks has leveled the playing field and made Disney’s traditional features look creaky in their piety. Made by Pacific Data Im-ages (PDI)–which turns out computer-animated movies for DreamWorks as Pixar does for Disney– “Shrek” merges state-of-the-art computer animation, capable of producing remarkably vivid facial expressions, and camera moves modeled on Spielberg and Scorsese with storytelling as swift and sophisticated as it comes. There’s good reason “Shrek” was selected to compete at this year’s Cannes Film Festival.

The finished project (written by Ted Elliott, Terry Rossio, Joe Stillman and Roger S.H. Schulman) looks seamless, but the movie is actually the result of many false starts, setbacks and backbreaking hours at the computer screen. Originally “Shrek’s” computer characters were to be set against live-action backgrounds, as in “Dinosaurs.” Chris Farley was going to be the voice of the ogre, and he had even recorded dialogue before he died of a drug overdose in 1997. Lithgow recalls how over time the whole tone of the movie seemed to shift. When he first recorded Farquaad, “he was more sinister, less comic. A year later, when I came back to re-record, it felt like a different movie. They told me to cut loose, have some fun.”

Having human characters at the center of this computer-animated film posed a challenge. “Nobody knows what a talking donkey looks like,” says PDI’s Raman Hui. “But Fiona was much harder. If you get anything wrong, it shows.” “Shrek’s” lead characters each have some 900 movable muscles, more than 200 of them in the face. Fiona’s flowing hair alone is made up of more than 1 million digital polygons.

As this delightfully irreverent creation unfolds, the sweat never shows. Myers, Diaz, Lithgow and a particularly inspired Murphy seem to have caught the film’s contagious high spirits. The biggest surprise, in the end, is not the hip references (Princess Fiona suspended in the air in “Matrix”-style fighting mode) or the bathroom humor or the tale’s sweet but conventional moral of self-acceptance. It’s how good this fractured and funky fairy tale makes you feel. The rousing musical number (“I’m a Believer”) that brings “Shrek” to its close manages to both send up all musical Big Finales and put you in a state of foot-stomping glee. No small accomplishment for a story about an ugly green fat guy and a talking ass. Release date: May 18