In Disney's Bedtime Stories (opening Christmas Day), Adam Sandler plays a hotel maintenance man who finds the fantastical tales he concocts for his niece and nephew are somehow coming real. And the stories Sandler tells veer wildly, from a chariot race in ancient Rome to a Wild West horse race and a showdown in outer space.

Keeping it all believable and of a single piece was the task handed to Visual Effects Supervisor John Andrew Berton Jr., who was intrigued by the challenge of creating effects that contributed to the storytelling in a realistic way while fitting into the style of comedy moviegoers expect from Sandler.

"That to me was a really interesting mix to try to find, to get the effects into the story so that it didn't look like sort of cheesy comedy effects, but was really high quality visual effects work in service of a really family oriented story," he says.

Berton oversaw eight visual effects facilities working on around 500 shots for the film. And the sequences were as different and challenging as the stories within the movie, which ranged from a Ben-Hur-style chariot race to a medieval knights in shining armor scenario to a zero gravity showdown in outer space.

Each section needed to have its own kind of spectacle to it, Berton says, while still looking photorealistic instead of too fantastic.

"We wanted it to look like a real place, a real story with real people in it, but yet still have this feeling of these sort of grand landscapes and grand storyscapes, if you will," Berton adds. "So each one of those had to be handled a little bit differently, but still had to have a tonality that went across the whole movie in terms of the way the visual effects work with the story."

A prime example was the medieval sequence, created by Hydraulx, for which Berton says footage was shot at a winery in Napa that turned out to look too small on film. "We ended up rebuilding the entire thing in computer graphics, but it still had to match all the photography that we did at Napa," he continues. "It's sort of a classical visual effects problem, to take something that's fantastical and wonderful and put it into a live-action environment and make it all look like believable photography."

Similarly, the chariot sequence -- also created by Hydraulx -- was shot with a minimum of live-action elements and the rest created digitally. "We had a couple of little set pieces where the main actors stood and we had the real chariot and we had the real horses and we had a big piece of dirt, but that was about it," Berton explains. "It was very difficult work, actually, working with these environments that have to match into something that's not really there. There's lots of dirt, there's lots of dust, there's real animals. All the stuff is giving you clues to realism, and to make the rest of the synthetic stuff fit into it to look like we actually shot in the big stadium somewhere was really the trick there."

Berton says director Adam Shankman, who previously helmed the remake of Hairspray, was a real collaborator when it came to the visual effects. "Adam was very open to ideas and in fact the visual effects team did quite a lot of creative work in terms of developing the ways in which these scenes would play themselves out," Berton suggests.

The space sequence was another challenge, as Sandler's character faced off in a zero gravity duel aboard a spherical space station that had to be created from scratch. The challenge for this sequence, shot against a bluescreen on the Sony lot, was making it look as real as the rest of the movie. "We don't have any reference, we don't know what space stations look like when they're floating out in the middle of the galaxy somewhere," he says. “So we had to make it all up, but we still had to give it that feel of reality that we needed to have it carry on with the rest of the film."

The space sequence was done by London-based Cinesite Europe and supervised by Matt Johnson, who worked out of Los Angeles for the duration of the production.

The first challenges in this sequence came about on set. Johnson says Sandler's costume included a full-length duster jacket that had to look like it was floating in the zero gravity environment. Johnson also says they had to create a shorter jacket, cut off at the waist and with tracking markers attached to it, so they could create a CG coat for the weightless shots.

The sequence was prevised by the production, with a postvis process used to place a simple geometry of the sequence into each shot about 15 minutes after it was shot.

Johnson adds that the design of the space station was left open for his crew to make specific. "I flew back to London for a week or so and worked with a team, and we basically just brainstormed a bunch of different ideas," he explains. "We were given kind of free rein for everyone to use their imaginations. I had maybe about 10 guys coming up with different designs of what it could be. We had a few kind of key ideas, like maybe Flash Gordon would be a look, the kind of late '70s, early '80s Flash Gordon; maybe 2001 was a look; Star Wars was a look." Artwork was prepared for all these ideas and presented to Shankman, who helped Cinesite refine the look to the point it could be built in the computer and the geometry fleshed out.

The final look had to evoke realism, Johnson continues. "It all had to basically make sense in the sense that if there was a staircase, you needed to know how the staircase was going to attach itself to the wall, where it would attach to the bleachers, whether there was a doorway that made sense," he says. "We tried to make it a fantasy basketball court. I was going to Staples Center a lot and taking a lot of photographs and looking at these sports stadiums online."

The other element that had to be developed was the alien creature Sandler's character fights in this scene. Originally envisioned as a kind of scary monster with fangs, it was decided fairly late in the game to go for a more comedic look and redesign the creature. The final result was a mucous-covered, slightly transparent alien dubbed the "booger monster."

"We were trying to come up with something universal, that every 9-year-old boy would find funny -- and boogers was obviously fairly high up that list," says Johnson. "The fangs and teeth went away and we had to kind of smother the creature in this goopy, mucousy stuff that would kind of fly off and interact with everything."

The creature required a number of dynamic simulations -- one for the creature itself and another one created in Houdini for its gooey covering.

Another interesting effect was the creation of a red horse for one sequence -- an effect achieved on set by actually painting a white horse red. However, a few additional shots required the use of a different horse, this one with a brown coat that had to be repainted digitally to match the look of the painted white horse, Berton says.

Sydney-based Fuel VFX created a key sequence in which Sandler's character encounters gumballs falling from the sky. The sequence required Fuel to add in many more gumballs than were used on set, as well as to make them interact with other objects correctly and match the color of the real gumballs.

"We did a lot of work on those shots to really make sure the gumballs all look right, they all shadowed each other, they bounced off of each other," Berton says. "We even got things bouncing off of Adam Sandler and off of his umbrella."

Fuel also contributed a CG shot of the hotel evolving and getting built up over a 30-year span. Berton says the final shot is amazing for all the detail Fuel packed into it.

"They just did all the research and put in billboards from the '70s that transform into billboards from the 21st century, and the building's going up and there's airplanes flying through the sky, there's freeways being built and the cars racing along, all imitating the look of time lapse photography but all actually created synthetically."

A completely different challenge was creating Bugsy, the children's comic-relief guinea pig with the gigantic eyes. Tippett Studio was in charge of this character, which posed some unusual challenges. The character had to look photoreal, cartoony at the same time.

"We were working in an environment where what was funny about Bugsy wasn't what he really did, it was just how he looked," Berton says. "Every time we tried to make him more characteristic, he became less funny. So we had to really keep our focus on how to make his eyes look funny in every shot."

Lola VFX contributed some head replacements: in particular, for one sequence in which Sandler was injured and his stunt double stepped in. "We reshaped the stunt double's face to match Adam's," says Edson Williams, supervisor of the facility's work. "We had to move the jaw line, adjust the thickness of the neck and shoulders, reduce the prominent chin, add 5 o'clock shadow and change the hairline."

Other facilities working on the film were Whiskytree, Rotofactory and Look Effects.

Berton and Johnson both used the latest in communication tools to oversee the work being done on the film. Berton says he used video iChat, instant messaging, video conferencing and cineSync to review shots with vendors in remote places.

According to Berton, another concern in the pipeline was color timing. The movie was shot with Genesis digital cameras and to ensure colors weren't ranging all over the place, the visual effects work avoided doing any color correction at all, working on raw footage from the camera. "Which it turns out was pretty effective, because the camera was very well calibrated. It delivered almost exactly the same color no matter which camera we were using or what day we were using it on," he says.

Johnson used the time difference between his base in L.A. and his London crew to his advantage. Cinesite created a mirror of its London digital dailies room in L.A., with the servers updating comments and changes from each end automatically to the other.

"The team was in London and essential looking at the same thing, calibrated in the same way." Johnson adds. "They were able to see me, I was able to see them. I could kind of point to the screen to give my feedback, they could see what I was pointing at and kind of make changes accordingly."

Johnson says he would spend his days reviewing sequences and shots with Shankman and Berton at Sony, and then provide notes and requests for changes at the end of the day. When the crew came to work in the morning London time, they could start work immediately and have changes and updates ready for Johnson to review by the time the sun rose in L.A.

Berton says his favorite sequences are the chariot race and the space station. "Both of them really play on the screen. They're bit, spectacular and imaginative," he says. "You believe it, it's realistic and it looks like a real story."

Thomas J. McLean is a freelance journalist whose articles have appeared in Variety, Below the Line,i>, Animation Magazine and Publishers Weekly. He writes a comic book blog for Variety.com called Bags and Boards, and is the author of Mutant Cinema: The X-Men Trilogy from Comics to Screen, forthcoming from Sequart.com Books.