In Hollywood, Peter Weir has picked up the reputation of being a miracle worker.

The director of such films as "Witness" and "The Year of Living Dangerously" is often credited with transforming comedian Robin Williams from a wacky comedian into an actual actor for the acclaimed 1989 drama "Dead Poets Society."Weir's latest is "The Truman Show," a film that's hard to categorize with its story of a man who is unaware that his life is really a documentary television soap opera.

And it may be his greatest "miracle" to date.

Weir is receiving raves for pulling a Williams-like feat with manic comic actor Jim Carrey, whose dramatic performance is the most controlled of his career. And he's also getting huzzahs for making a film that supposedly couldn't be made.

"This was an idea everybody said they wanted to make into a movie until it came time to put the money up," Weir said during a telephone interview from Hollywood. "But when I saw the script, I knew I couldn't pass up this opportunity. The ideas were too fresh, and the potential was there to do something great."

However, even with a talented director and screenwriter (Andrew Niccol) attached to it, the film still almost didn't get made - at least not until Carrey expressed an interest in playing the main character.

"Jim and I had talked about working together for quite some time. Things never seemed to work out, though," Weir explained. "But when Jim read the first draft, he said that this was the one."

Still, the director had some reservations about having the star play the lead character, a naive insurance salesman who is "adopted" by a television network as a child and whose life becomes the subject of a carefully crafted television program in the hands of an egotistical producer named Christof (played by veteran character actor Ed Harris).

"I'd like to claim I always had Jim in mind to play Truman, but it's not really true," he said. "I knew it was possible to get the right performance out of him, because of what happened with Robin, but there had to be a willingness on Jim's part to really work on his acting."

Fortunately for all involved, Carrey did put in the effort, resulting in what many critics are already calling his "breakthrough" performance. "It's exciting and very gratifying when someone like Jim is willing to make changes for the sake of his craft rather than for furthering his career."

Having Carrey on board also ensured that Weir and Niccol had time to work on the story. Though all three committed to make "The Truman Show" in 1995, Carrey still had obligations to make the movies "The Cable Guy" and "Liar Liar."

"It sounds bad, but we really couldn't have asked for better working circumstances," Niccol said in a separate telephone interview. "With so much time, Peter and I were able to shape the story we wanted to tell."

Through multiple rewrites, the focus changed and the story became less of a paranoid science-fiction thriller and more of a satire on the pervasive nature of mass media and its effects on everyday life.

"The movie is not about what I originally thought it was about," said Niccol, who also wrote and directed the film "Gattaca" during the long production delay. "Thanks to Peter, my storytelling skills really sharpened. He knew what I was trying to say even when I didn't."

Niccol has nothing but praise for Weir, even though he originally wanted to direct the film himself.

"In Hollywood, a first-time writer/director might get the chance to make a $20 million movie. But given the fact that Jim's salary is in that range by itself, there was very little chance of me directing it," Niccol said. "So it's fortunate that we wound up with Peter, who really took off and ran with it."

Weir is much more humble about his participation, instead crediting Carrey and Niccol for the successful final result.

"All I did was be a facilitator for their talents," Weir said. "There's only so much a director can do with a movie if he doesn't have a great cast or a terrific script. I was very fortunate to have those things."

While Weir continues to downplay his contributions, Niccol said he was involved in almost all facets of the movie, from its production design to the costuming to the music.

"It's impossible for Peter to leave things alone," he said. "Give him enough time and he'll find a better way to do something. That's his real talent."

But in no way does Weir actually resemble the megalomaniacal Chris-tof character, Niccol said with a laugh. "At least Peter knows how to compromise on some things. Peter doesn't always think he's right, or at least that's what he says."

One thing Weir and Niccol want to make clear is that "The Truman Show" is not meant to be a blanket condemnation of television, though they admit they wanted to call attention to the public's dependence on it.

"You can't trust everything you see. You've got to be skeptical and think for yourself," Weir said. "I hope that's what audiences will get out of the movie."

Both the screenwriter and director also agree they have benefited from some eerie coincidences, which make the film even more timely and relevant.

"There's no way of predicting what will happen when you're mak-ing a movie," Niccol said. "But since the movie wrapped we've seen people committing suicide on live television.

"Truth really is stranger than fiction, I guess."